[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: python3.2 'MODLIBS' includes -lffi (but not in Ubuntu)



On Mon, 28 May 2012, Jakub Wilk wrote:
> >>python3.2 -c "from distutils.sysconfig import get_config_var; print(get_config_var('MODLIBS'))"
> >-lssl -lcrypto   -lssl -lcrypto    -lffi  -L/usr/lib -lz  -lexpat
> >while with python2 and python3.2 under Ubuntu 12.04 does not
> >include -lffi .
> Are you sure?

I was quite sure -- I logged into a clean 12.04 chroot and ran the
command and cut/pasted output -- could not go wrong! ;)

> $ dpkg-deb -x python3.2-minimal_3.2.3-0ubuntu1_i386.deb .
> $ grep LOCALMODLIBS.*ffi usr/lib/python3.2/config/Makefile
> LOCALMODLIBS=                     -lssl -lcrypto   -lssl -lcrypto    -lffi  -L$(exec_prefix)/lib -lz  -lexpat

now I am not 100% sure but ... I also got an email from MK confirming
that it is a bug and it would be fixed with the next upload (whenever that
would be)....

> >Maybe some one has a ready answer?
> Does "do not use (LOCAL)MODLIBS" count as an answer? :)

;-)  gygy -- thanks for such an in-depth answer since it works!  

indeed such a blunt patch

--- a/setup.py
+++ b/setup.py
@@ -235,7 +235,7 @@ def executables():
         for var in ('LIBDIR', 'LIBPL'):
             library_dirs += split_quoted(cfgDict.get(var, ''))
         for var in ('LDFLAGS',
-                    'LIBS', 'MODLIBS', 'SYSLIBS',
+                    'LIBS', 'SYSLIBS',
                     'LDLAST'):
             link_args += split_quoted(cfgDict.get(var, ''))
     # MPI-enabled Python interpreter

helps even with other failures and seems to not cause any new ;)  Below
is the diff from unpatched build and patched build... hopefully within few days
I could wrap my head around WTF...  or may be Bradley (CCed who was helping
with this package and pushed python3 packaging) could confirm that this is a
logical thing to do ;) (I have pushed the patch for now to alioth's git)

@@ -203,30 +182,7 @@
 building 'python2.7-mpi' executable
 /usr/bin/mpicc.openmpi -fPIC -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -I/usr/include/python2.7 -c src/python.c -o build/temp.linux-x86_64-2.7/src/python.o
 creating build/exe.linux-x86_64-2.7
-/usr/bin/mpicc.openmpi -Wl,-export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions build/temp.linux-x86_64-2.7/src/python.o -L/usr/lib/python2.7/config -lpython2.7 -o build/exe.linux-x86_64-2.7/python2.7-mpi -Wl,-z,relro -lpthread -ldl -lutil -lssl -lcrypto -lssl -lcrypto -L/usr/lib -lz -lm
-/usr/lib/libmpi.so: undefined reference to `MPL_trid'
-/usr/lib/libmpi.so: undefined reference to `MPL_trvalid'
-/usr/lib/libmpi.so: undefined reference to `MPL_env2int'
-/usr/lib/libmpi.so: undefined reference to `MPL_trrealloc'
-/usr/lib/libmpi.so: undefined reference to `MPL_trspace'
-/usr/lib/libmpi.so: undefined reference to `MPL_trDebugLevel'
-/usr/lib/libmpi.so: undefined reference to `MPL_TrSetMaxMem'
-/usr/lib/libmpi.so: undefined reference to `MPL_trlevel'
-/usr/lib/libmpi.so: undefined reference to `MPL_trmalloc'
-/usr/lib/libmpi.so: undefined reference to `MPL_putenv'
-/usr/lib/libmpi.so: undefined reference to `MPL_env2bool'
-/usr/lib/libmpi.so: undefined reference to `MPL_env2range'
-/usr/lib/libmpi.so: undefined reference to `MPL_trcalloc'
-/usr/lib/libmpi.so: undefined reference to `MPL_trfree'
-/usr/lib/libmpi.so: undefined reference to `MPL_env2str'
-/usr/lib/libmpi.so: undefined reference to `MPL_trstrdup'
-/usr/lib/libmpi.so: undefined reference to `MPL_trdump'
-/usr/lib/libmpi.so: undefined reference to `MPL_trinit'
-collect2: ld returned 1 exit status
-warning: build_exe: building extension "python2.7-mpi" failed
-
-warning: build_exe: command '/usr/bin/mpicc.openmpi' failed with exit status 1
-
+/usr/bin/mpicc.openmpi -Wl,-export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions build/temp.linux-x86_64-2.7/src/python.o -L/usr/lib/python2.7/config -lpython2.7 -o build/exe.linux-x86_64-2.7/python2.7-mpi -Wl,-z,relro -lpthread -ldl -lutil -lm
 : # Build for Python 3
 set -e; for v in 3.2; do \
                python$v setup.py build \
@@ -319,13 +275,7 @@
 building 'python3.2-mpi' executable
 /usr/bin/mpicc.openmpi -fPIC -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -I/usr/include/python3.2mu -c src/python.c -o build/temp.linux-x86_64-3.2/src/python.o
 creating build/exe.linux-x86_64-3.2
-/usr/bin/mpicc.openmpi -Wl,-export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions build/temp.linux-x86_64-3.2/src/python.o -L/usr/lib/python3.2/config-3.2mu -lpython3.2 -o build/exe.linux-x86_64-3.2/python3.2-mpi -Wl,-z,relro -lpthread -ldl -lutil -lssl -lcrypto -lssl -lcrypto -lffi -L/usr/lib -lz -lexpat -lm
-/usr/bin/ld: cannot find -lffi
-collect2: ld returned 1 exit status
-warning: build_exe: building extension "python3.2-mpi" failed
-
-warning: build_exe: command '/usr/bin/mpicc.openmpi' failed with exit status 1
-
+/usr/bin/mpicc.openmpi -Wl,-export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions build/temp.linux-x86_64-3.2/src/python.o -L/usr/lib/python3.2/config-3.2mu -lpython3.2 -o build/exe.linux-x86_64-3.2/python3.2-mpi -Wl,-z,relro -lpthread -ldl -lutil -lm

-- 
Yaroslav O. Halchenko
Postdoctoral Fellow,   Department of Psychological and Brain Sciences
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834                       Fax: +1 (603) 646-1419
WWW:   http://www.linkedin.com/in/yarik        


Reply to: