Subject: pkg/37287: Python extension compile (link) problems with DB4
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <jesse@exbiblio.com>
List: pkgsrc-bugs
Date: 11/06/2007 08:35:01
>Number:         37287
>Category:       pkg
>Synopsis:       Python extension compile (link) problems with DB4
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 06 08:35:01 +0000 2007
>Originator:     Jesse Peterson
>Release:        Linux x86_64
>Organization:
>Environment:
Linux localhost 2.6.9-42.0.3.ELsmp #1 SMP Fri Oct 6 06:28:26 CDT 2006 x86_64 x86_64 x86_64 GNU/Linux

This is a CentOS 4.4 x86_64 machine. Problem is repeatable on Ubuntu 7.10 amd64 (perhaps all Linux x86_64 machines?)
>Description:
Two packages will not compile on these OS's that I've tested while others do compile. The packages are:

  * www/ap-python
  * databases/py-psycopg

Interestingly databases/py-psycopg2 does compile. Other non-compiled extensions install fine.

FOR AP-PYTHON (in final link stages of build):

libtool --silent --mode=link gcc -o mod_python.la  -rpath /usr/pkg/lib/httpd -module -avoid-version    hlistobject.lo hlist.lo filterobject.lo connobject.lo serverobject.lo util.lo tableobject.lo requestobject.lo _apachemodule.lo mod_python.lo -L/usr/pkg/lib/python2.4/config -Wl,-R/usr/pkg/lib/python2.4/config -L/usr/lib64 -Wl,-R/usr/lib64 -Wl,-R/usr/pkg/lib -Xlinker -export-dynamic -L/usr/lib64 -Wl,-R/usr/lib64 -Wl,-R/usr/pkg/lib -lm /usr/pkg/lib/python2.4/config/libpython2.4.a -lpthread -ldl -ldb4 -lutil -lm *** Warning: Linking the shared library mod_python.la against the *** static library /usr/pkg/lib/python2.4/config/libpython2.4.a is not portable! /usr/bin/ld: cannot find -ldb4 collect2: ld returned 1 exit status apxs:Error: Command failed with rc=65536 . *** Error code 1 Stop. bmake: stopped in /usr/pkgsrc-local/wrkobjdir/www/ap2-python/work/mod_python-3.2.10/src

FOR PY-PSYCHOPG (in configure script):

checking location of python library... $(prefix)/lib/python2.4/site-packages
checking location of python shared modules... $(exec_prefix)/lib/python2.4/site-packages checking for x86_64-unknown-linux-gcc... gcc -pthread checking for C compiler default output file name... configure: error: C compiler cannot create executables
See `config.log' for more details.
*** Error code 77

Stop.
bmake: stopped in /usr/pkgsrc/databases/py-psycopg
*** Error code 1

Stop.
bmake: stopped in /usr/pkgsrc/databases/py-psycopg

.. clearly a failure (though seemingly unrelated) in the configure script but in the config.log:

configure:2015: checking for C compiler default output file name
configure:2018: gcc -pthread -O2 -Wno-format -fno-builtin -I/usr/pkg/include/python2.4 -I/usr/include -I/usr/pkg/lib/python2.4/site-packages/mx/DateTime/mxDateTime -I/usr/pkg/include -I/usr/pkg/include/python2.4 -I/usr/include -I/usr/pkg/lib/python2.4/site-packages/mx/DateTime/mxDateTime -I/usr/pkg/include -L/usr/pkg/lib/python2.4/config -Wl,-R/usr/pkg/lib/python2.4/config -L/usr/lib64 -Wl,-R/usr/lib64 -Wl,-R/usr/pkg/lib -L/usr/lib64 -Wl,-R/usr/lib64 -Wl,-R/usr/pkg/lib conftest.c  -lpthread -ldl -ldb4 -lutil >&5
/usr/bin/ld: cannot find -ldb4
collect2: ld returned 1 exit status
configure:2021: $? = 1
configure: failed program was:
| /* confdefs.h.  */

It looks like my python24 package has a requirement on db4>=4.5.20 (which is installed and indeed /usr/pkg/lib/libdb4* [both a and so] seem to exist) so the Python setup/buildlink is probably putting those flags in there but I'm not sure why ld is not finding libdb4 - the linker flags all appear fine.

Am willing to help debug as my time allows.
>How-To-Repeat:
Install a Linux x86_64 OS and attempt to compile and install either of the above two packages.
>Fix: