【发布时间】:2021-01-15 00:13:55
【问题描述】:
我需要在 Fedora 的 rawhide 上使用 MinGW64 编译 boost-python 1.73.0,这样我就可以为 Windows 10 64 位构建 Python 绑定(不,很遗憾我不能使用 Visual Studio)。不幸的是,Fedora 的 mingw64-boost 软件包中唯一缺少的库是 boost-python,啊!
其实所有的依赖都打包在Fedora for MinGW64上,挺好的。因此,我正在尝试通过以下方式建立自己:
wget https://dl.bintray.com/boostorg/release/1.73.0/source/boost_1_73_0.tar.bz2
tar -xjf boost_1_73_0.tar.bz2 && cd boost_1_73_0
./bootstrap.sh
# in a docker container, so /root
./b2 --with-python address-model=64 target-os=windows toolset=gcc-mingw64 \
variant=release link=shared --user-config=/root/user-config.jam
还有一个~/user-config.jam:
using gcc : mingw64 : x86_64-w64-mingw32-g++ ;
using python
: 3.9
: /usr/x86_64-w64-mingw32/sys-root/mingw/bin/python3.9.exe
: /usr/x86_64-w64-mingw32/sys-root/mingw/include/python3.9
: /usr/x86_64-w64-mingw32/sys-root/mingw/lib/python3.9 ;
它成功运行了一段时间,但随后出现错误
/usr/lib/gcc/x86_64-w64-mingw32/10.2.1/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lutil
collect2: error: ld returned 1 exit status
所以libutil 不知何故不见了。多么具体的名字啊!我尝试(重新)安装所有 glibc 软件包(libutil.so 显然通常在其中),但无济于事。还找到了/usr/x86_64-w64-mingw32/sys-root/mingw/lib/libutildll.a,尝试通过./b2 library=... 包含它,再次失败。
这里发生了什么?顺便说一句,this gist 的完整命令失败了。
【问题讨论】:
标签: boost mingw cross-compiling boost-python mingw-w64