python - Windows Python 错误的交叉编译

标签 python c linux configure autogen

我尝试为 64 位 Windows 交叉编译 libplist ( https://github.com/libimobiledevice/libplist ) 并从中创建一个 DLL。我在 Windows 10 (Ubuntu 14.04 bash) 上下载了适用于 Linux 子系统的 mingw-w64 并设置了环境变量(CC、CXX、CPP、RANLIB)。我使用 ./autogen.sh --host=x86_64-w64-mingw32 配置包。但是它退出并出现错误:

configure:16825: error:
  Could not link test program to Python. Maybe the main Python library has been
  installed in some non-standard library path. If so, pass it to configure,
  via the LDFLAGS environment variable.
  Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"
  ============================================================================
   ERROR!
   You probably have to install the development version of the Python package
   for your distribution.  The exact name of this package varies among them.
  ============================================================================

config.log 中说:

configure:16813: x86_64-w64-mingw32-gcc -o conftest.exe -g -O2  -I/usr/include/python2.7 -I/usr/include/x86_64-linux-g$
In file included from /usr/include/python2.7/Python.h:8:0,
                 from conftest.c:33:
/usr/include/python2.7/pyconfig.h:78:3: error: #error unknown multiarch location for pyconfig.h
 # error unknown multiarch location for pyconfig.h
   ^
In file included from /usr/include/python2.7/pyport.h:4:0,
                 from /usr/include/python2.7/Python.h:58,
                 from conftest.c:33:
/usr/include/python2.7/pyconfig.h:78:3: error: #error unknown multiarch location for pyconfig.h
 # error unknown multiarch location for pyconfig.h
   ^
In file included from /usr/include/python2.7/pymath.h:4:0,
                 from /usr/include/python2.7/Python.h:77,
                 from conftest.c:33:
/usr/include/python2.7/pyconfig.h:78:3: error: #error unknown multiarch location for pyconfig.h
 # error unknown multiarch location for pyconfig.h
   ^
configure:16813: $? = 1

当我尝试为 Linux 编译它时它没有返回此错误,所以我认为这是因为它需要为 Windows x86_64 编译的 python 库。我从 Windows 从 C:/Python27/include 复制了适当的文件,并尝试为配置 LDFLAGS="-L/path/to/python/include" 设置环境变量和 PKG_CONFIG_PATH=/path/to/python/include 分开。他们都没有工作。我还注意到,在 C:/Python27/include 中还有一个名为 pyconfig.h 的文件。为什么脚本使用安装在 Linux 上的那个?有没有办法强制它使用另一个?

我的主要目标是从 libusbmuxd ( https://github.com/libimobiledevice/libusbmuxd ) 制作一个 64 位 Windows DLL,但它也需要编译 libplist。我该如何解决这个问题?提前感谢您的回答。

最佳答案

您可以试试 libimobiledevice-win32。尽管名称有点困惑,但它构建了 32 位和 64 位 Windows 版本的 libimobiledevice。

您可以使用 Visual Studio 为 Windows 编译 libplist、libusbmuxd、libimobildevice 和各种实用程序,避免交叉编译。

我工作的公司 Quamotion 维护着 libimobiledevice-win32,我们努力跟上最新的上游变化。

您可以从 CI 构建下载预编译版本,参见例如https://ci.appveyor.com/project/qmfrederik/imobiledevice-net/build/artifacts用于包含最新位的 zip 文件。

关于python - Windows Python 错误的交叉编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39225184/

相关文章:

c - scanf ("%[^\n]s")对于普通变量可以正常工作,但对于 C 中的结构变量不起作用

在Linux中创建char设备并打开错误

python - 在 anaconda 3 上安装 hazm

python - 用正则表达式检查大小写?

c - 我在使用命令行参数时遇到问题

linux - 如何在 Git Bash 上初始化 bashrc

linux -/etc/lsb-release 与/etc/os-release

python - 将python中的数据保存为CSV UTF-8文件格式的excel文件

python - 使用模式制作列表

c 程序允许用户更改已经设置的 4 位引脚