0
votes

I am trying to cross-compile the latest pycurl package, but the problem may apply to earlier versions as well. My googling has revealed this package not to be very cross-compile friendly.

First of, I am using buildroot and the buildroot toolchain( uclibc latest version) for the cross compilation.

The package uses gentargets to build, as it was not written for autotargets. And the build command simply calls setup.py:

define PYCURL_BUILD_CMDS 
(cd $(@D);\
 CC="$(TARGET_CC)"\
 LD="$(TARGET_LD)"\
$(HOST_DIR)/usr/bin/python setup.py build\
--curl-config=$(STAGING_DIR)/usr/bin/curl-config)     
endef

The problem is that after the object files are built, the build script decides to use the host compiler insted of the target compiler:

building object files:

/media/N/svn_main/buildroot/output/host/usr/bin/ccache /media/N/svn_main/buildroot/output/host/usr/bin/x86_64-unknown-linux-uclibc-gcc -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -I/media/N/svn_main/buildroot/output/host/usr/x86_64-unknown-linux-uclibc/sysroot/usr/include -I/media/N/svn_main/buildroot/output/host/usr/x86_64-unknown-linux-uclibc/sysroot/lib -fPIC -DPYCURL_VERSION="7.19.5.1" -DHAVE_CURL_OPENSSL=1 -DHAVE_CURL_SSL=1 -I/media/N/svn_main/buildroot/output/host/usr/include/python2.7 -c src/stringcompat.c -o build/temp.linux-x86_64-2.7/src/stringcompat.o

linking the library: /media/N/svn_main/buildroot/output/host/usr/bin/ccache /usr/bin/gcc -pthread -shared -L/media/N/svn_main/buildroot/output/host/usr/x86_64-unknown-linux-uclibc/sysroot/ -L/media/N/svn_main/buildroot/output/host/usr/x86_64-unknown-linux-uclibc/sysroot/lib --sysroot=/media/N/svn_main/buildroot/output/host/usr/x86_64-unknown-linux-uclibc/sysroot build/temp.linux-x86_64-2.7/src/docstrings.o build/temp.linux-x86_64-2.7/src/easy.o build/temp.linux-x86_64-2.7/src/module.o build/temp.linux-x86_64-2.7/src/multi.o build/temp.linux-x86_64-2.7/src/oscompat.o build/temp.linux-x86_64-2.7/src/pythoncompat.o build/temp.linux-x86_64-2.7/src/share.o build/temp.linux-x86_64-2.7/src/stringcompat.o build/temp.linux-x86_64-2.7/src/threadsupport.o -L/media/N/svn_main/buildroot/output/host/usr/x86_64-unknown-linux-uclibc/sysroot/usr/lib -lcurl -lcrypto -o build/lib.linux-x86_64-2.7/pycurl.so

If you'we ever cross compiled this package or have any idea about the problem I'm facing I'd appreciate the help.

2

2 Answers

0
votes

You should use the python-package infrastructure to package pycurl in Buildroot. It will use the distutils-based setup.py provided in pycurl sources.

0
votes

I solved eventually by setting the LDSHARED variale:

LDSHARED="$(TARGET_CC) -pthread -shared"

apparently distutils uses a different tool to link the final, share object, which is specified by LDSHARED.