[SERVER-22602] Automatically include openssl on osx from brew if available Created: 12/Feb/16  Updated: 05/Apr/17  Resolved: 15/Mar/17

Status: Closed
Project: Core Server
Component/s: Build
Affects Version/s: None
Fix Version/s: 3.5.5

Type: Improvement Priority: Minor - P4
Reporter: Scott Hernandez (Inactive) Assignee: Andrew Morrow (Inactive)
Resolution: Done Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-22808 --variables-files=etc/scons/propagate... Closed
Backwards Compatibility: Fully Compatible
Sprint: Platforms 2017-03-27
Participants:

 Description   

Otherwise you need to run this line manually to include linkflags and cpppath:

scons LINKFLAGS=-L/usr/local/opt/openssl/lib CPPPATH=/usr/local/opt/openssl/include --ssl  mongod 



 Comments   
Comment by Githook User [ 15/Mar/17 ]

Author:

{u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@mongodb.com'}

Message: SERVER-22602 Provide advice when OpenSSL components are not found on macOS
Branch: master
https://github.com/mongodb/mongo/commit/a1f15dfd788a78da77bda6675132d4144691fce1

Comment by Scott Hernandez (Inactive) [ 16/Feb/16 ]

I can understand that, maybe a nicer message would be possible? Then at least you can search for the correct terms to find this solution from that message.

diff --git a/SConstruct b/SConstruct
index 0e980fd..250d722 100644
--- a/SConstruct
+++ b/SConstruct
@@ -2231,6 +2231,8 @@ def doConfigure(myenv):
                 "C",
                 "SSL_version(NULL);",
                 autoadd=True):
+            if is_running_os('osx'):
+                print "Try addding scons options: LINKFLAGS=-L/usr/local/opt/openssl/lib CPPPATH=/usr/local/opt/openssl/include"
             conf.env.ConfError("Couldn't find OpenSSL ssl.h header and library")
 
         if not conf.CheckLibWithHeader(
@@ -2239,6 +2241,8 @@ def doConfigure(myenv):
                 "C",
                 "SSLeay_version(0);",
                 autoadd=True):
+            if is_running_os('osx'):
+                print "Try addding scons options: LINKFLAGS=-L/usr/local/opt/openssl/lib CPPPATH=/usr/local/opt/openssl/include"
             conf.env.ConfError("Couldn't find OpenSSL crypto.h header and library")
 
         def CheckLinkSSL(context):

Output:

> scons --config force --ssl mongod
scons: Reading SConscript files ...
scons version: 2.4.1
...
Checking for SSL_version(NULL) in C library ssl... no
Try addding scons options: LINKFLAGS=-L/usr/local/opt/openssl/lib CPPPATH=/usr/local/opt/openssl/include
Couldn't find OpenSSL ssl.h header and library
See /Users/scotthernandez/git/mongo/build/scons/config.log for details

The reason this is more of an issue now is that apple no longer includes openssl in osx/xcode – http://lists.apple.com/archives/macnetworkprog/2015/Jun/msg00025.html

Comment by Andrew Morrow (Inactive) [ 16/Feb/16 ]

I'd strongly prefer that we not do this. We previously had "support" for searching for macports and homebrew in the top level SConstruct and we intentionally stripped it out because it caused problems. You can install those systems to any path, and we don't want to hardcode awareness of these particular package management systems. The purpose exposing the LINKFLAGS and CPPPATH options was to make it easy to reference these sorts of package systems. If you find specifying these options as needed on your system on the command line inconvenient, you can add them to your mongo_custom_variables.py file and they will be automatically set.

Generated at Thu Feb 08 04:00:53 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.