我正在使用TI-SDK为ARM交叉编译python 3.7。
我已经在ubuntu上下载了源代码,并按照以下说明进行操作
[当我运行make
时,出现以下错误。您能告诉我如何解决链接器错误吗?
*ar rc libpython3.5m.a Modules/config.o Modules/getpath.o Modules/main.o Modules/gcmodule.o
ar rc libpython3.5m.a Modules/_threadmodule.o Modules/signalmodule.o Modules/posixmodule.o Modules/errnomodule.o Modules/pwdmodule.o Modules/_sre.o Modules/_codecsmodule.o Modules/_weakref.o Modules/_functoolsmodule.o Modules/_operator.o Modules/_collectionsmodule.o Modules/itertoolsmodule.o Modules/atexitmodule.o Modules/_stat.o Modules/timemodule.o Modules/_localemodule.o Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o Modules/zipimport.o Modules/faulthandler.o Modules/_tracemalloc.o Modules/hashtable.o Modules/symtablemodule.o Modules/xxsubtype.o
ranlib libpython3.5m.a
gcc -pthread -Xlinker -export-dynamic -o python Programs/python.o libpython3.5m.a -lpthread -ldl -lutil -lm
libpython3.5m.a(fileutils.o): In function `set_inheritable':
/home/pcadmin/work/OTIS/Python-3.5.9/Python/fileutils.c:892: undefined reference to `fcntl64'
/home/pcadmin/work/OTIS/Python-3.5.9/Python/fileutils.c:903: undefined reference to `fcntl64'
libpython3.5m.a(fileutils.o): In function `get_inheritable':
/home/pcadmin/work/OTIS/Python-3.5.9/Python/fileutils.c:777: undefined reference to `fcntl64'
/home/pcadmin/work/OTIS/Python-3.5.9/Python/fileutils.c:777: undefined reference to `fcntl64'
libpython3.5m.a(fileutils.o): In function `set_inheritable':
/home/pcadmin/work/OTIS/Python-3.5.9/Python/fileutils.c:892: undefined reference to `fcntl64'
libpython3.5m.a(fileutils.o):/home/pcadmin/work/OTIS/Python-3.5.9/Python/fileutils.c:903: more undefined references to `fcntl64' follow
collect2: error: ld returned 1 exit status
Makefile:555: recipe for target 'python' failed
make: *** [python] Error 1*
如果需要更多信息以帮助我解决此问题,请发表评论。
我找到了解决方案。以为如果我发布它可能对其他人有帮助。
链接器错误是由于对libxml2的依赖关系。我已经交叉编译了libxml2并链接到python,它起作用了。
配置脚本包括libxml的路径以及其他选项。
./configure CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ AR=arm-linux-gnueabihf-ar LD=arm-linux-gnueabihf-ld RANLIB=arm-linux-gnueabihf-ranlib --host=arm-linux-gnueabihf --target=arm -prefix=/home/sagar/otis/python3_install --without-sqlite3 --without-pdo-sqlite --without-pear --enable-simplexml --disable-mbregex --enable-sockets --enable-fpm --disable-opcache --enable-libxml --without-zlib --with-libxml-dir=/home/sagar/otis/libxml/_install/ --build=x86_64-linux-gnu --disable-all --disable-ipv6 ac_cv_have_long_long_format=yes ac_cv_file__dev_ptmx=no ac_cv_file__dev_ptc=no