Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - python compiles but each dynamic module is failing to build: (7 Items)
   
python compiles but each dynamic module is failing to build  
I'm now working on lang/python24. Python itself compiles and works(read starts), but all the dynamic modules are failing
 to build.

Executing the failing cc or ld command lines directly on the shell are working. Therefore there may be a problem with 
the toolchain.

The parser pgen is build in a subdirectory, too and was perfectly build.

Where is the toolchain customized (or where it is described?)?
Any ideas how to fix it?

Here are some of the relevant messages:

creating build/temp.qnx-6.3.2-x86pc-2.4
cc -DNDEBUG -O2 -I/usr/pkg/include/db4 -I/usr/include -I/usr/pkg/include -fno-strict-aliasing -OPT:Olimit=0 -I. -I/usr/
src/HEAD/pkgsrc/lang/python24/work/Python-2.4.4/./Include -I/usr/pkg/include -I/usr/src/HEAD/pkgsrc/lang/python24/work/
Python-2.4.4/Include -I/usr/src/HEAD/pkgsrc/lang/python24/work/Python-2.4.4 -c /usr/src/HEAD/pkgsrc/lang/python24/work/
Python-2.4.4/Modules/structmodule.c -o build/temp.qnx-6.3.2-x86pc-2.4/structmodule.o
sem_trywait: Invalid argument
sem_wait: Invalid argument
sem_post: Invalid argument
creating build/lib.qnx-6.3.2-x86pc-2.4
ld -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/lib -Wl,-R/usr/lib -O2 -I/usr/pkg/include/db4 -I/usr/include -I/usr/pkg/
include -I/usr/pkg/include/db4 -I/usr/include -I/usr/pkg/include build/temp.qnx-6.3.2-x86pc-2.4/structmodule.o -L/usr/
pkg/lib -o build/lib.qnx-6.3.2-x86pc-2.4/struct.so -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/lib -Wl,-R/usr/lib
sem_trywait: Invalid argument
sem_wait: Invalid argument
sem_post: Invalid argument
/usr/qnx632/host/qnx6/x86/usr/bin/ld: warning: cannot find entry symbol _start; defaulting to 08048074
build/temp.qnx-6.3.2-x86pc-2.4/structmodule.o: In function `get_pylong':
build/temp.qnx-6.3.2-x86pc-2.4/structmodule.o(.text+0xc): undefined reference to `PyInt_Type'
build/temp.qnx-6.3.2-x86pc-2.4/structmodule.o(.text+0x16): undefined reference to `PyInt_Type'
build/temp.qnx-6.3.2-x86pc-2.4/structmodule.o(.text+0x21): undefined reference to `PyType_IsSubtype'
build/temp.qnx-6.3.2-x86pc-2.4/structmodule.o(.text+0x38): undefined reference to `PyLong_FromLong'
build/temp.qnx-6.3.2-x86pc-2.4/structmodule.o(.text+0x4d): undefined reference to `PyLong_Type'
build/temp.qnx-6.3.2-x86pc-2.4/structmodule.o(.text+0x57): undefined reference to `PyLong_Type'
build/temp.qnx-6.3.2-x86pc-2.4/structmodule.o(.text+0x62): undefined reference to `PyType_IsSubtype'
build/temp.qnx-6.3.2-x86pc-2.4/structmodule.o(.text+0xc3): undefined reference to `PyLong_Type'
build/temp.qnx-6.3.2-x86pc-2.4/structmodule.o(.text+0xcd): undefined reference to `PyLong_Type'
build/temp.qnx-6.3.2-x86pc-2.4/structmodule.o(.text+0xd8): undefined reference to `PyType_IsSubtype'
build/temp.qnx-6.3.2-x86pc-2.4/structmodule.o(.text+0x11c): undefined reference to `PyErr_SetString'
build/temp.qnx-6.3.2-x86pc-2.4/structmodule.o: In function `get_long':
build/temp.qnx-6.3.2-x86pc-2.4/structmodule.o(.text+0x13c): undefined reference to `PyInt_AsLong'
build/temp.qnx-6.3.2-x86pc-2.4/structmodule.o(.text+0x14d): undefined reference to `PyErr_Occurred'
build/temp.qnx-6.3.2-x86pc-2.4/structmodule.o(.text+0x15a): undefined reference to `PyExc_TypeError'
build/temp.qnx-6.3.2-x86pc-2.4/structmodule.o(.text+0x15f): undefined reference to `PyErr_ExceptionMatches'
build/temp.qnx-6.3.2-x86pc-2.4/structmodule.o(.text+0x179): undefined reference to `PyErr_SetString'
build/temp.qnx-6.3.2-x86pc-2.4/structmodule.o: In function `get_ulong':
build/temp.qnx-6.3.2-x86pc-2.4/structmodule.o(.text+0x1a9): undefined reference to `PyLong_Type'


Re: python compiles but each dynamic module is failing to build  
During the build process of the dynamic modules the system libraries are dropped. Therefore symbols like _start and 
memcpy are missing. How can this happen!?

The statically linked python executable is happily build and seems to work. 

Is there already any support for dynamic modules in the pkgsrc build? 

Python does nothing special. It uses the standard dlopen() to load the dynamic modules.

On my build machine Python 2.2 and 2.3 suffers the same problem. They are listed as working on the status page. 
Therefore I suppose that something with my build environment is wrong. But other packages are working fine ...

Any ideas?



I've attached the .work.log.

I worked a little with a single module (struct.so) and got all symbols resolved except the _start one. It is located in 
crt1.o.


This is the ld command used during the build:

/usr/qnx632/host/qnx6/x86/usr/bin/ld -L/usr/src/HEAD/pkgsrc/lang/python24/work/.buildlink/lib -R/usr/pkg/lib -O2 -I/usr/
src/HEAD/pkgsrc/lang/python24/work/.buildlink/include/db4 -I/usr/src/HEAD/pkgsrc/lang/python24/work/.buildlink/include 
build/temp.qnx-6.3.2-x86pc-2.4/structmodule.o -o build/lib.qnx-6.3.2-x86pc-2.4/struct.so


after adding  -L. -lpython2.4 -lm -lc -Bstatic  -lc -Bdynamic 

$ /usr/qnx632/host/qnx6/x86/usr/bin/ld -L/usr/src/HEAD/pkgsrc/lang/python24/work/.buildlink/lib -R/usr/pkg/lib -O2 -I/
usr/src/HEAD/pkgsrc/lang/python24/work/.buildlink/include/db4 -I/usr/src/HEAD/pkgsrc/lang/python24/work/.buildlink/
include -L/lib  build/temp.qnx-6.3.2-x86pc-2.4/structmodule.o -L. -lpython2.4 -lm -lc -Bstatic  -lc -Bdynamic   -o build
/lib.qnx-6.3.2-x86pc-2.4/struct.so

only this warning remains:
/usr/qnx632/host/qnx6/x86/usr/bin/ld: warning: cannot find entry symbol _start; defaulting to 0804af1c

but the struct.so is generated, but corrupted:
ldd: ./build/lib.qnx-6.3.2-x86pc-2.4/struct.so: Accessing a corrupted shared lib




Attachment: Text .work.log 365.46 KB
Re: python compiles but each dynamic module is failing to build  
I've found some successfully build and working dynamic libs:

# ldd /usr/pkg/sbin/sshd
/usr/pkg/sbin/sshd:
        libwrap.so.7 => /usr/pkg/lib/libwrap.so.7 (0xb8200000)
        libcrypto.so.0.9.7 => /usr/pkg/lib/libcrypto.so.0.9.7 (0xb8208000)
        libz.so.1 => /usr/pkg/lib/libz.so.1 (0xb82f4000)
        libsocket.so.2 => /lib/libsocket.so.2 (0xb8305000)
        libc.so.2 => /usr/lib/ldqnx.so.2 (0xb0300000)

# ldd /usr/pkg/lib/libcrypto.so.0.9.7
/usr/pkg/lib/libcrypto.so.0.9.7:
        libcrypto.so.0.9.7 => /usr/pkg/lib/libcrypto.so.0.9.7 (0xb8200000)
        libsocket.so.2 => /lib/libsocket.so.2 (0xb82ec000)

libcrypto is build with openssl:
pkgsrc/security/openssl/work/openssl-0.9.7i/libcrypto.so


Here is a relevant bit from the build:
 /usr/src/HEAD/pkgsrc/security/openssl/work/.gcc/bin/qcc -shared -o libcrypto.so.0.9.7 -Wl,-h -Wl,libcrypto.so.0.9.7 -Wl
,--whole-archive libcryp
to.a -Wl,--no-whole-archive -L. -Wl,-R/usr/pkg/lib -I/usr/src/HEAD/pkgsrc/security/openssl/work/.buildlink/include -L/
usr/src/HEAD/pkgsrc/security/
openssl/work/.buildlink/lib  -lsocket

I've attached the .work.log for the openssl build.
Attachment: Text openssl.work.log 488.99 KB
SOLVED (mostly)Re: python compiles but each dynamic module is failing to build  
The problem was that Python was not prepared to handle QNX 8-(

I've found that the required changes are described by Vladimir Timonin on this web page:
http://timonin.home.mindspring.com/

python24 now builds and the dynamic modules are looking good. Most of the test are working, too.

I'll post the patch tomorrow.
Re: SOLVED (mostly)Re: python compiles but each dynamic module is failing to build  
Hi Christian,

I was able to build python24 using pkgsrc using self-hosted QNX.  My next step is to cross-compile it for QNX ppc.  Do 
you have any info or tips for cross-compiling it using pkgsrc?  Thanks.

-Wilson
Re: SOLVED (mostly)Re: python compiles but each dynamic module is failing to build  
pkgsrc doesn't currently support cross compilation.

That said, if you have configured to build with qcc (not gcc), it is a relatively simple matter to set CFLAGS/LDFLAGS to
 add "-Vgcc_ntoppcbe", and convert the entire tree to a PPC target.
Re: SOLVED (mostly)Re: python compiles but each dynamic module is failing to build  
Hi Rennie,

Thanks for the tip.  I'm using gcc right now with pkgsrc.  I will try to rebuild everything using qcc.  Where should I 
change the CFLAGS/LDFLAGS?  In the python24 Makefile? Will I add it on both?  

Got a question.  When cross-compiling it may invoke other build tools like ar, ranlib, strip.  Shouldn't I be using the 
cross-compiler build tools instead of the default defined in the pkgsrc.