Patch for building Python libs under Linux x64 (fixed on Ubuntu 10)
Justin Hendren <[email protected]>
| Newsgroups | gmane.comp.encryption.cryptlib |
|---|---|
| Message-ID | <[email protected]> |
Hello all, just dropping this email to inform about a bug I found when building the Python libraries under Ubuntu (linux 2.6.32-24 x86_64) on a x64 system (Intel i5). After a little research, I found that this will more than likely also affect other linux distributions if not patched. When building the python bindings you may get this error: --------- creating build/lib.linux-x86_64-2.6 gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions build/temp.linux-x86_64-2.6/python.o -L.. -lcl -o build/lib.linux-x86_64-2.6/cryptlib_py.so /usr/bin/ld: ../libcl.a(cryptcrt.o): relocation R_X86_64_32S against `_etext' can not be used when making a shared object; recompile with -fPIC ../libcl.a: could not read symbols: Bad value collect2: ld returned 1 exit status error: command 'gcc' failed with exit status 1 --------- Here is the patch to cryptlib/tools/ccopts.sh: --- ccopts.sh 2009-07-15 18:06:50.000000000 -0400 +++ ccopts.sh 2010-07-29 22:56:02.909399364 -0400 @@ -293,7 +293,7 @@ if [ "$GCC_VER" -ge 30 ] ; then case $ARCH in 'x86_64') - CCARGS="$CCARGS -march=opteron" ;; + CCARGS="$CCARGS -march=opteron -fPIC" ;; 'i686') CCARGS="$CCARGS -march=pentiumpro" ;; This should force the compiler to use the -fPIC flag on all source files when building the main libraries. Rebuild them after patching the file, then build the python bindings. Copy/symlink/install your libs as normal, and everything should work as expected after that :). The -fPIC is necessary for the STATIC libraries, for SHARED libraries I've read that -fpic is necessary. However, I have not tested this, so any input would be appreciated. I'm still trying to read up on gcc and linker options when building libs, so this is pretty new to me. Hope this helps someone! Also, I hope this would be patched into the source release, unless there is a better solution to be had (the shared lib build might require the -fpic, but I'm not sure). Justin _______________________________________________ Cryptlib mailing list [email protected] via Mail: [email protected] Archive: ftp://ftp.franken.de/pub/crypt/cryptlib/archives/ http://news.gmane.org/gmane.comp.encryption.cryptlib Posts from non-subscribed addresses are blocked to prevent spam, please subscribe in order to post messages.