2

I can't seem to be able to build _ssl or _hashlib on Mac OSX Sierra. I looked in the make logs, and I've found out it doesn't even try to look in the appropriate places for includes:

gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 
    -Wall -Wstrict-prototypes -Werror=declaration-after-statement -I./Include 
    -I. -IInclude -I/usr/local/include -I/usr/local/src/Python-3.5.2/Include 
    -I/usr/local/src/Python-3.5.2 -c /usr/local/src/Python-3.5.2/Modules/_ssl.c 
    -o build/temp.macosx-10.12-x86_64-3.5/usr/local/src/Python-3.5.2/Modules/_ssl.o

I have an updated version of OpenSSL installed in /usr/local:

$ which openssl
/usr/local/bin/openssl
$ openssl version
OpenSSL 1.1.0c  10 Nov 2016

The configure script has placed the OpenSSL libs in /usr/local/lib and the headers in /usr/local/include/openssl, and make does not seem to make use of those. So I thought I could solve the problem by setting appropriately the CPPFLAGS and LDFLAGS environment variables, as specified here:

$ echo $CPPFLAGS
-I/usr/local/include/ -I/usr/local/include/openssl/
$ echo $LDFLAGS
-L/usr/local/lib/
$ echo $LD_LIBRARY_PATH 
/usr/local/lib/

but I am still not able to build either _ssl or _hashlib. I've also tried to modify Setup.local, after I read this answer in this way:

$ cat Modules/Setup.local 
# Edit this file for local setup changes

SSL=/usr/local
_ssl _ssl.c \
    -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
    -L$(SSL)/lib -lssl -lcrypto

with no success. I did notice that the gcc command changed though:

gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG
    -g -fwrapv -O3 -Wall -Wstrict-prototypes -Werror=declaration-after-statement   
    -I. -IInclude -I./Include    -DPy_BUILD_CORE  -DUSE_SSL -I/usr/local/include 
    -I/usr/local/include/openssl -c ./Modules/_ssl.c -o Modules/_ssl.o

Any help would be appreciated.

Community
  • 1
  • 1
farsil
  • 955
  • 6
  • 19
  • 1
    I believe the location is `SSL=/usr/local/ssl`, and not `SSL=/usr/local`. If you can `ls /usr/local/ssl/lib`, then its the former, which is the default location for OpenSSL. You should also use `CFLAGS`, not `CPPFLAGS`. It is the compiler driver's job to pass `CFLAGS` down to the preprocessor; not the other way around. You will also need to set an `RPATH` because dynamic linking is being used. Also see [Compilation and Installation](https://wiki.openssl.org/index.php/Compilation_and_Installation) on the OpenSSL wiki. – jww Dec 06 '16 at 04:14
  • 1
    Just wanted to point out that I was compiling against OpenSSL 1.1.0c. Compiling against OpenSSL 1.0.2j and appropriately editing `Modules/Setup.local` fixed the issue for me. – farsil Dec 12 '16 at 15:58
  • Thanks for the update. Modifying `Modules/Setup.local` worked for me too. Any idea why editing `Setup.local` is required? This isn't mentioned in the Python developer (https://docs.python.org/devguide/setup.html) docs, maybe it should be? – durden2.0 Dec 27 '16 at 14:29

0 Answers0