为OpenWrt构建cx_Freeze时出错:“未定义引用`__finite'”等

时间:2018-01-17 19:34:32

标签: python-2.7 linker cx-freeze openwrt musl

我正在尝试为OpenWrt打包Python模块cx_Freeze。我已经编写了Makefile(包含在下面)并且对它的工作方式和我定义的内容感到满意(我的理解是Build/Compile/PyMod将使用工具链的编译器设置有效地运行setup.py

尝试构建cx_Freeze(作为常规make world作业的一部分)时,在链接到python2.7时声称存在未定义的引用__isnan__isinf时,它会失败, __finite__rawmemchr。我在下面列出了完整的错误列表。

我已经清理了buildroot,并且重新编译了整个工具链。我也尝试了多种架构(特别是x86和brcm2708),只是为了得到同样的错误。构建任何其他Python包都没有问题 - 区别似乎是cx_Freeze尝试链接Python本身。

将C库切换到glibc可以工作,但是我也想支持默认的C库,musl。

如果我能提供有关主机系统的更多信息或有关此问题的任何其他背景信息,请与我们联系。

生成文件

include $(TOPDIR)/rules.mk

PKG_NAME:=cx_Freeze
PKG_VERSION:=5.1.1
PKG_RELEASE:=1
PKG_LICENSE:=PSF

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://pypi.python.org/packages/5f/16/eab51d6571dfec2554248cb027c51babd04d97f594ab6359e0707361297d/
PKG_HASH:=2eadddde670f5c5f6cf88638a0ac4e5d5fe181292a31063275fa56c7bf22426b

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_BUILD_DEPENDS:=python

include $(INCLUDE_DIR)/package.mk
$(call include_mk, python-package.mk)

define Package/python-cx_Freeze
    SUBMENU:=Python
    SECTION:=lang
    CATEGORY:=Languages
    TITLE:=cx_Freeze
    URL:=https://github.com/anthony-tuininga/cx_Freeze
    DEPENDS:=+python
endef

define Package/python-cx_Freeze/description
    cx_Freeze is a set of scripts and modules for freezing Python scripts into executables, in much the same way that py2exe and py2app do.
endef

define Build/Compile
    $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR))
endef

define Package/python-cx_Freeze/install
    $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
    $(INSTALL_DIR) $(1)/usr/bin
    $(CP) \
        $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
        $(1)$(PYTHON_PKG_DIR)/
    $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin
endef

$(eval $(call BuildPackage,python-cx_Freeze))

链接器错误输出:

running build_ext
building 'cx_Freeze.util' extension
creating build/temp.linux2-2.7
creating build/temp.linux2-2.7/source
x86_64-openwrt-linux-musl-gcc -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -iremap /home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/cx_Freeze-5.1.1:cx_Freeze-5.1.1 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -I/home/vagrant/workspace/staging_dir/target-x86_64_musl-1.1.16/usr/include -I/home/vagrant/workspace/staging_dir/target-x86_64_musl-1.1.16/include -I/home/vagrant/workspace/staging_dir/toolchain-x86_64_gcc-5.4.0_musl-1.1.16/usr/include -I/home/vagrant/workspace/staging_dir/toolchain-x86_64_gcc-5.4.0_musl-1.1.16/include/fortify -I/home/vagrant/workspace/staging_dir/toolchain-x86_64_gcc-5.4.0_musl-1.1.16/include -I/home/vagrant/workspace/staging_dir/target-x86_64_musl-1.1.16/usr/include/python2.7 -fPIC -I/home/vagrant/workspace/staging_dir/target-x86_64_musl-1.1.16/usr/include/python2.7 -c source/util.c -o build/temp.linux2-2.7/source/util.o
x86_64-openwrt-linux-musl-gcc -shared -L/home/vagrant/workspace/staging_dir/target-x86_64_musl-1.1.16/usr/lib -L/home/vagrant/workspace/staging_dir/target-x86_64_musl-1.1.16/lib -L/home/vagrant/workspace/staging_dir/toolchain-x86_64_gcc-5.4.0_musl-1.1.16/usr/lib -L/home/vagrant/workspace/staging_dir/toolchain-x86_64_gcc-5.4.0_musl-1.1.16/lib -znow -zrelro -lpython2.7 -Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -iremap /home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/cx_Freeze-5.1.1:cx_Freeze-5.1.1 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -I/home/vagrant/workspace/staging_dir/target-x86_64_musl-1.1.16/usr/include -I/home/vagrant/workspace/staging_dir/target-x86_64_musl-1.1.16/include -I/home/vagrant/workspace/staging_dir/toolchain-x86_64_gcc-5.4.0_musl-1.1.16/usr/include -I/home/vagrant/workspace/staging_dir/toolchain-x86_64_gcc-5.4.0_musl-1.1.16/include/fortify -I/home/vagrant/workspace/staging_dir/toolchain-x86_64_gcc-5.4.0_musl-1.1.16/include -I/home/vagrant/workspace/staging_dir/target-x86_64_musl-1.1.16/usr/include/python2.7 build/temp.linux2-2.7/source/util.o -o build/lib.linux2-2.7/cx_Freeze/util.so
creating build/temp.linux2-2.7/source/bases
x86_64-openwrt-linux-musl-gcc -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -iremap /home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/cx_Freeze-5.1.1:cx_Freeze-5.1.1 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -I/home/vagrant/workspace/staging_dir/target-x86_64_musl-1.1.16/usr/include -I/home/vagrant/workspace/staging_dir/target-x86_64_musl-1.1.16/include -I/home/vagrant/workspace/staging_dir/toolchain-x86_64_gcc-5.4.0_musl-1.1.16/usr/include -I/home/vagrant/workspace/staging_dir/toolchain-x86_64_gcc-5.4.0_musl-1.1.16/include/fortify -I/home/vagrant/workspace/staging_dir/toolchain-x86_64_gcc-5.4.0_musl-1.1.16/include -I/home/vagrant/workspace/staging_dir/target-x86_64_musl-1.1.16/usr/include/python2.7 -fPIC -I/home/vagrant/workspace/staging_dir/target-x86_64_musl-1.1.16/usr/include/python2.7 -c source/bases/Console.c -o build/temp.linux2-2.7/source/bases/Console.o
creating build/lib.linux2-2.7/cx_Freeze/bases
x86_64-openwrt-linux-musl-gcc build/temp.linux2-2.7/source/bases/Console.o -L/home/vagrant/workspace/staging_dir/target-x86_64_musl-1.1.16/host/lib/python2.7/config -lpython2.7 -o build/lib.linux2-2.7/cx_Freeze/bases/Console -Xlinker -export-dynamic -lpthread -ldl -lutil -lm -lz -s
/home/vagrant/workspace/staging_dir/target-x86_64_musl-1.1.16/host/lib/python2.7/config/libpython2.7.a(floatobject.o): In function `float_richcompare':
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/Objects/floatobject.c:431: undefined reference to `__finite'
/home/vagrant/workspace/staging_dir/target-x86_64_musl-1.1.16/host/lib/python2.7/config/libpython2.7.a(floatobject.o): In function `float_is_integer':
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/Objects/floatobject.c:992: undefined reference to `__finite'
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/Objects/floatobject.c:992: undefined reference to `__finite'
/home/vagrant/workspace/staging_dir/target-x86_64_musl-1.1.16/host/lib/python2.7/config/libpython2.7.a(floatobject.o): In function `float_as_integer_ratio':
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/Objects/floatobject.c:1731: undefined reference to `__isinf'
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/Objects/floatobject.c:1737: undefined reference to `__isnan'
/home/vagrant/workspace/staging_dir/target-x86_64_musl-1.1.16/host/lib/python2.7/config/libpython2.7.a(floatobject.o): In function `float_hex':
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/Objects/floatobject.c:1383: undefined reference to `__isnan'
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/Objects/floatobject.c:1383: undefined reference to `__isinf'
/home/vagrant/workspace/staging_dir/target-x86_64_musl-1.1.16/host/lib/python2.7/config/libpython2.7.a(floatobject.o): In function `float_pow':
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/Objects/floatobject.c:837: undefined reference to `__isnan'
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/Objects/floatobject.c:840: undefined reference to `__isnan'
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/Objects/floatobject.c:843: undefined reference to `__isinf'
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/Objects/floatobject.c:858: undefined reference to `__isinf'
/home/vagrant/workspace/staging_dir/target-x86_64_musl-1.1.16/host/lib/python2.7/config/libpython2.7.a(floatobject.o): In function `_PyFloat_Pack4':
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/Objects/floatobject.c:2396: undefined reference to `__isinff'
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/Objects/floatobject.c:2396: undefined reference to `__isinf'
/home/vagrant/workspace/staging_dir/target-x86_64_musl-1.1.16/host/lib/python2.7/config/libpython2.7.a(longobject.o): In function `PyLong_FromDouble':
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/Objects/longobject.c:178: undefined reference to `__isinf'
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/Objects/longobject.c:183: undefined reference to `__isnan'
/home/vagrant/workspace/staging_dir/target-x86_64_musl-1.1.16/host/lib/python2.7/config/libpython2.7.a(object.o): In function `_Py_HashDouble':
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/Objects/object.c:1033: undefined reference to `__finite'
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/Objects/object.c:1034: undefined reference to `__isinf'
/home/vagrant/workspace/staging_dir/target-x86_64_musl-1.1.16/host/lib/python2.7/config/libpython2.7.a(sysmodule.o): In function `makepathobject':
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/Python/sysmodule.c:1552: undefined reference to `__rawmemchr'
/home/vagrant/workspace/staging_dir/target-x86_64_musl-1.1.16/host/lib/python2.7/config/libpython2.7.a(posixmodule.o): In function `posix_tmpnam':
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/./Modules/posixmodule.c:7614: undefined reference to `tmpnam_r'
/home/vagrant/workspace/staging_dir/target-x86_64_musl-1.1.16/host/lib/python2.7/config/libpython2.7.a(tokenizer.o): In function `tok_nextc':
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/Parser/tokenizer.c:1000: undefined reference to `__rawmemchr'
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/Parser/tokenizer.c:953: undefined reference to `__rawmemchr'
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/Parser/tokenizer.c:927: undefined reference to `__rawmemchr'
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/Parser/tokenizer.c:870: undefined reference to `__rawmemchr'
/home/vagrant/workspace/staging_dir/target-x86_64_musl-1.1.16/host/lib/python2.7/config/libpython2.7.a(complexobject.o): In function `_Py_c_abs':
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/Objects/complexobject.c:196: undefined reference to `__finite'
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/Objects/complexobject.c:196: undefined reference to `__finite'
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/Objects/complexobject.c:200: undefined reference to `__isinf'
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/Objects/complexobject.c:205: undefined reference to `__isinf'
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/Objects/complexobject.c:215: undefined reference to `__finite'
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/Objects/complexobject.c:196: undefined reference to `__finite'
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/Objects/complexobject.c:196: undefined reference to `__finite'
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/Objects/complexobject.c:200: undefined reference to `__isinf'
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/Objects/complexobject.c:205: undefined reference to `__isinf'
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/Objects/complexobject.c:215: undefined reference to `__finite'
/home/vagrant/workspace/staging_dir/target-x86_64_musl-1.1.16/host/lib/python2.7/config/libpython2.7.a(bltinmodule.o): In function `builtin_round':
/home/vagrant/workspace/build_dir/target-x86_64_musl-1.1.16/host/Python-2.7.13/Python/bltinmodule.c:2198: undefined reference to `__finite'
collect2: error: ld returned 1 exit status
error: command 'x86_64-openwrt-linux-musl-gcc' failed with exit status 1

软件版本:

  • OpenWrt 17.01.4
  • cx_Freeze 5.1.1
  • Python 2.7
  • 构建操作系统:VirtualBox中的CentOS 7.4

CentOS 7构建VM上已安装的软件包:

  • 开发工具包组
  • GCC-C ++
  • GIT中
  • ncurses的devel的
  • perl的
  • perl的线程队列
  • 解压
  • wget的
  • XZ
  • 的zlib-devel的
  • zlib的静电

0 个答案:

没有答案