Bug 210963 - lang/python27: Failed to compile with security/openssl
Summary: lang/python27: Failed to compile with security/openssl
Status: Closed DUPLICATE of bug 210820
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: arm Any
: --- Affects Only Me
Assignee: Fukang Chen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-10 12:13 UTC by Fukang Chen
Modified: 2016-07-10 15:43 UTC (History)
3 users (show)

See Also:
koobs: maintainer-feedback+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fukang Chen freebsd_committer freebsd_triage 2016-07-10 12:13:12 UTC
I got this error message while compiling lang/python27 with
DEFAULT_VERSIONS+=ssl=openssl in make.conf
It looks like it's using the OpenSSL in base.

building '_ssl' extension
cc -fPIC -fno-strict-aliasing -O -pipe -fno-strict-aliasing -DNDEBUG -I. -IInclude -I./Include -I/usr/local/include -I/usr/ports/lang/python27/work/Python-2.7.12/Include -I/usr/ports/lang/python27/work/Python-2.7.12 -c /usr/ports/lang/python27/work/Python-2.7.12/Modules/_ssl.c -o build/temp.freebsd-11.0-CURRENT-arm-2.7/usr/ports/lang/python27/work/Python-2.7.12/Modules/_ssl.o
In file included from /usr/ports/lang/python27/work/Python-2.7.12/Modules/_ssl.c:47:
In file included from /usr/ports/lang/python27/work/Python-2.7.12/Modules/socketmodule.h:59:
In file included from /usr/include/bluetooth.h:51:
/usr/include/netgraph/bluetooth/include/ng_btsocket.h:246:2: warning: "Make sure new member of
      socket address initialized" [-W#warnings]
#warning "Make sure new member of socket address initialized"
 ^
1 warning generated.
cc -shared -lpthread -Wl,-rpath=/usr/lib:/usr/local/lib -L/usr/local/lib -Wl,-rpath,/usr/local/lib -lpthread -Wl,-rpath=/usr/lib:/usr/local/lib -L/usr/local/lib -Wl,-rpath,/usr/local/lib -O -pipe -fno-strict-aliasing -I/usr/local/include -I/usr/local/include build/temp.freebsd-11.0-CURRENT-arm-2.7/usr/ports/lang/python27/work/Python-2.7.12/Modules/_ssl.o -L/usr/local/lib -L. -lssl -lcrypto -lpython2.7 -o build/lib.freebsd-11.0-CURRENT-arm-2.7/_ssl.so
*** WARNING: renaming "_ssl" since importing it failed: build/lib.freebsd-11.0-CURRENT-arm-2.7/_ssl.so: Undefined symbol "SSLv2_method"


# ldd work/Python-2.7.12/build/lib.freebsd-11.0-CURRENT-arm-2.7/_ssl_failed.so 
work/Python-2.7.12/build/lib.freebsd-11.0-CURRENT-arm-2.7/_ssl_failed.so:
	libthr.so.3 => /lib/libthr.so.3 (0x20068000)
	libssl.so.8 => /usr/lib/libssl.so.8 (0x20095000)
	libcrypto.so.8 => /usr/local/lib/libcrypto.so.8 (0x20800000)
	libpython2.7.so.1 => /usr/local/lib/libpython2.7.so.1 (0x20a00000)
	libc.so.7 => /lib/libc.so.7 (0x20100000)
	libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x2027c000)
	libintl.so.8 => /usr/local/lib/libintl.so.8 (0x2028b000)
	libutil.so.9 => /lib/libutil.so.9 (0x2029c000)
	libm.so.5 => /lib/libm.so.5 (0x202b5000)

# make -V LDFLAGS
 -lpthread -Wl,-rpath=/usr/lib:/usr/local/lib -L/usr/local/lib -Wl,-rpath,/usr/local/lib



a temporary workaround is to let ssl set the LDFLAGS before ncurses:

Index: Makefile
===================================================================
--- Makefile    (revision 418235)
+++ Makefile    (working copy)
@@ -12,7 +12,7 @@
 
 LICENSE=       PSFL
 
-USES=          cpe ncurses pkgconfig readline ssl tar:xz
+USES=          cpe ssl ncurses pkgconfig readline tar:xz
 USE_LDCONFIG=  yes
 GNU_CONFIGURE= yes

# make -V LDFLAGS
 -lpthread -Wl,-rpath,/usr/local/lib -Wl,-rpath=/usr/lib:/usr/local/lib -L/usr/local/lib

# ldd work/Python-2.7.12/build/lib.freebsd-11.0-CURRENT-arm-2.7/_ssl.so 
work/Python-2.7.12/build/lib.freebsd-11.0-CURRENT-arm-2.7/_ssl.so:
	libthr.so.3 => /lib/libthr.so.3 (0x20068000)
	libssl.so.8 => /usr/local/lib/libssl.so.8 (0x20095000)
	libcrypto.so.8 => /usr/local/lib/libcrypto.so.8 (0x20800000)
	libpython2.7.so.1 => /usr/local/lib/libpython2.7.so.1 (0x20a00000)
	libc.so.7 => /lib/libc.so.7 (0x20100000)
	libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x2027c000)
	libintl.so.8 => /usr/local/lib/libintl.so.8 (0x2028b000)
	libutil.so.9 => /lib/libutil.so.9 (0x2029c000)
	libm.so.5 => /lib/libm.so.5 (0x202b5000)
Comment 1 Fukang Chen freebsd_committer freebsd_triage 2016-07-10 13:41:24 UTC
ooops, it works fine on 10.3 amd64. Not sure if this only occurs on the ARM platform. 
I will upgrade my 10.3 amd64 to 11.0 and try again.
Comment 2 Kubilay Kocak freebsd_committer freebsd_triage 2016-07-10 14:22:52 UTC
May be duplicate of 210820
Comment 3 Fukang Chen freebsd_committer freebsd_triage 2016-07-10 15:19:25 UTC
Thank you koobs@ for the link. Yes, that's the same problem.

I think I know why it works on 10.3, it searches /usr/lib for
libssl.so.8 first, but there's only libssl.so.7 there.

# readelf -d /usr/local/lib/python2.7/lib-dynload/_ssl.so | head -n 10

Dynamic section at offset 0x13be0 contains 27 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libthr.so.3]
 0x0000000000000001 (NEEDED)             Shared library: [libssl.so.8]
 0x0000000000000001 (NEEDED)             Shared library: [libcrypto.so.8]
 0x0000000000000001 (NEEDED)             Shared library: [libpython2.7.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.7]
 0x000000000000000f (RPATH)              Library rpath: [/usr/lib:/usr/local/lib]
 0x000000000000001d (RUNPATH)            Library runpath: [/usr/lib:/usr/local/lib]

# echo /usr/lib/libssl.so*
/usr/lib/libssl.so /usr/lib/libssl.so.7

It's has been upgraded to libssl.so.8 on 11.0-CURRENT 
# echo /usr/lib/libssl.so*
/usr/lib/libssl.so /usr/lib/libssl.so.8

SSLv2 has been disabled in base:
https://svnweb.freebsd.org/base?view=revision&revision=280306

SSlv2 is still enabled in the port security/openssl:
https://svnweb.freebsd.org/ports?view=revision&revision=410039

On 11.0-CURRENT /usr/local/lib/python2.7/lib-dynload/_ssl.so 
can't find SSLv2_method from /usr/lib/libssl.so.
Comment 4 Kubilay Kocak freebsd_committer freebsd_triage 2016-07-10 15:31:16 UTC
@Fukang, can you please add your information to bug 210820 and close this as a duplicate of that one please. We'll continue isolation there
Comment 5 Fukang Chen freebsd_committer freebsd_triage 2016-07-10 15:43:05 UTC

*** This bug has been marked as a duplicate of bug 210820 ***