You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@serf.apache.org by br...@apache.org on 2016/11/15 10:57:03 UTC

svn commit: r1769776 - /serf/trunk/SConstruct

Author: brane
Date: Tue Nov 15 10:57:03 2016
New Revision: 1769776

URL: http://svn.apache.org/viewvc?rev=1769776&view=rev
Log:
Make sure we don't link with the obsolete OpenSSL shipped with macOS.

* SConstruct: Prepend OpenSSL include and library paths on macOS.

Modified:
    serf/trunk/SConstruct

Modified: serf/trunk/SConstruct
URL: http://svn.apache.org/viewvc/serf/trunk/SConstruct?rev=1769776&r1=1769775&r2=1769776&view=diff
==============================================================================
--- serf/trunk/SConstruct (original)
+++ serf/trunk/SConstruct Tue Nov 15 10:57:03 2016
@@ -403,8 +403,17 @@ else:
   env.Append(CPPPATH=['$ZLIB/include'])
   env.Append(LIBPATH=['$ZLIB/lib'])
 
-  env.Append(CPPPATH=['$OPENSSL/include'])
-  env.Append(LIBPATH=['$OPENSSL/lib'])
+  # MacOS ships ancient OpenSSL libraries, but no headers, so we can
+  # assume we're building with an OpenSSL installed outside the
+  # default include and link paths. To prevent accidentally linking to
+  # the old shared libraries, make sure that the OpenSSL paths are
+  # first in the search lists.
+  if sys.platform == 'darwin':
+    env.Prepend(CPPPATH=['$OPENSSL/include'])
+    env.Prepend(LIBPATH=['$OPENSSL/lib'])
+  else:
+    env.Append(CPPPATH=['$OPENSSL/include'])
+    env.Append(LIBPATH=['$OPENSSL/lib'])
 
 
 # If build with gssapi, get its information and define SERF_HAVE_GSSAPI



Re: svn commit: r1769776 - /serf/trunk/SConstruct

Posted by Branko Čibej <br...@apache.org>.
On 15.11.2016 11:57, brane@apache.org wrote:
> Author: brane
> Date: Tue Nov 15 10:57:03 2016
> New Revision: 1769776
>
> URL: http://svn.apache.org/viewvc?rev=1769776&view=rev
> Log:
> Make sure we don't link with the obsolete OpenSSL shipped with macOS.
>
> * SConstruct: Prepend OpenSSL include and library paths on macOS.


FYI, this is what happens without this change:

$ scons -Y ../serf-trunk OPENSSL=/usr/local/opt/openssl check
...
gcc -o test/serf_get test/serf_get.o libserf-2.a -L/usr/lib -L/usr/lib -L/usr/lib -L/usr/local/opt/openssl/lib -lssl -lcrypto -lz -lapr-1 -lpthread -laprutil-1 -lldap -llber -lexpat -liconv -lsqlite3 -lldap -llber
Undefined symbols for architecture x86_64:
  "_SSL_get0_alpn_selected", referenced from:
      _ssl_decrypt in libserf-2.a(ssl_buckets.o)
  "_SSL_set_alpn_protos", referenced from:
      _serf_ssl_negotiate_protocol in libserf-2.a(ssl_buckets.o)
ld: symbol(s) not found for architecture x86_64



That's because -L/usr/local/opt/openssl/lib appears after -L/usr/lib in
the link line, so the linker picks up the old OpenSSL shared libs
(version 0.9.8 something, I think).

-- Brane