使用buildozer将Kivy与numpy库打包为Android时出现错误

55

我试图使用 buildozer 创建一个包含 numpyKivy 应用程序的 Android 包,但当我尝试包含 numpy 时出现了以下错误:

错误概述:

compile options: '-DNO_ATLAS_INFO=1 -Inumpy/core/include -Ibuild/src.linux-x86_64-2.7/numpy/core/include/numpy -Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -Inumpy/core/include -I/home/joao/github/buildozer/.buildozer/android/platform/python-for-android/build/python-install/include/python2.7 -Ibuild/src.linux-x86_64-2.7/numpy/core/src/multiarray -Ibuild/src.linux-x86_64-2.7/numpy/core/src/umath -c'
ccache: numpy/linalg/lapack_litemodule.c
ccache: numpy/linalg/python_xerbla.c
/usr/bin/gfortran -Wall -lm build/temp.linux-x86_64-2.7/numpy/linalg/lapack_litemodule.o build/temp.linux-x86_64-2.7/numpy/linalg/python_xerbla.o -L/usr/lib -L/home/joao/github/buildozer/.buildozer/android/platform/python-for-android/build/python-install/lib -Lbuild/temp.linux-x86_64-2.7 -llapack -lblas -lpython2.7 -lgfortran -o build/lib.linux-x86_64-2.7/numpy/linalg/lapack_lite.so
/usr/bin/ld: build/temp.linux-x86_64-2.7/numpy/linalg/lapack_litemodule.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: build/temp.linux-x86_64-2.7/numpy/linalg/lapack_litemodule.o: Relocations in generic ELF (EM: 40)
build/temp.linux-x86_64-2.7/numpy/linalg/lapack_litemodule.o: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status
/usr/bin/ld: build/temp.linux-x86_64-2.7/numpy/linalg/lapack_litemodule.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: build/temp.linux-x86_64-2.7/numpy/linalg/lapack_litemodule.o: Relocations in generic ELF (EM: 40)
build/temp.linux-x86_64-2.7/numpy/linalg/lapack_litemodule.o: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status
unable to execute _configtest: Exec format error
error: Command "/usr/bin/gfortran -Wall -lm build/temp.linux-x86_64-2.7/numpy/linalg/lapack_litemodule.o build/temp.linux-x86_64-2.7/numpy/linalg/python_xerbla.o -L/usr/lib -L/home/joao/github/buildozer/.buildozer/android/platform/python-for-android/build/python-install/lib -Lbuild/temp.linux-x86_64-2.7 -llapack -lblas -lpython2.7 -lgfortran -o build/lib.linux-x86_64-2.7/numpy/linalg/lapack_lite.so" failed with exit status 1

有人知道如何解决吗?

P.S. 我正在使用Ubuntu 14.04 64位操作系统


2
你确定这个库可以在Android环境中编译和链接吗?你使用的是哪些指令? - hpaulj
5
你们的系统架构是什么(我猜可能是基于ARM的)?看起来numpy的C扩展仍在为x86_64构建,即它们没有被正确地交叉编译为ARM。 - ali_m
@ali_m:就记录而言,我认为x86_64的事情是误导性的,因为通过环境变量设置arm构建,setup.py无法识别,因此即使编译可能针对正确的架构,它也会以这种方式命名文件夹。 - inclement
@inclement 我不知道...“通用ELF重定位(EM:40)”通常是某些东西没有正确交叉编译的明显迹象。@JoaoAbrantes:我看到你发布了完整的构建日志,但链接现在似乎已经失效了。你能修复一下吗? - ali_m
@ali_m,我修复了链接。不确定log.txt是否与之前完全相同,但我认为是这样的。 - João Abrantes
显示剩余6条评论
1个回答

10
尝试运行sudo apt-get install libatlas-base-dev,似乎您缺少一些库。

抱歉,我在接下来的一个月内无法测试它...但如果它获得超过10个赞,我将假定它对10个人有效并接受它。 - João Abrantes

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接