Libimobiledevice: 无法为 Windows 编译

创建于 2019-10-30  ·  5评论  ·  资料来源: libimobiledevice/libimobiledevice

我尝试使用 cygwin 和 MinGW 编译 libimobiledevice 及其依赖项。 解决所有问题后,我能够创建 Windows 可执行文件。 但是,对于两种环境(Cygwin 和 MinGW),我都遇到了相同的错误:

./idevice_id -l
socket_connect: getaddrinfo: Unknown error
ERROR: Unable to retrieve device list!

这里也报告了同样的错误https://github.com/libimobiledevice/libimobiledevice/issues/783

是否有一些我可以遵循的在 Windows 中编译的文章? 以下是我遵循的各个步骤的汇编:

安装 MSys2
https://stackoverflow.com/questions/26453293/what-is-the-best-way-to-install-pkg-config-on-mingw-in-2014
https://www.msys2.org/

安装 MinGW
http://www.mingw.org/wiki/MSYS
将bin文件夹设置为windows中的环境变量

构建 libplist
./autogen.sh
制作
进行安装
(我记得收到 python 错误,所以必须安装 --without-cython)

构建usbmuxd
./autogen.sh
制作
进行安装

将 GNUTLS 安装为无法找到 openssl dev libs
https://github.com/libimobiledevice/libimobiledevice/issues/617
pacman -S mingw-w64-x86_64-gnutls
吃豆子 -S gnutls
pacman -S libgnutls
pacman -S openssl
pacman -S libopenssl
pacman -S openssl-devel

安装 libcrypt
pacman -S libgcrypt-devel

建造
./autogen.sh --without-cython --disable-openssl
制作
进行安装

最有用的评论

这是我必须安装的清单,以便在没有 python 问题的情况下构建上面的所有内容:

吃豆子 -S git
pacman -S libedit
pacman -S mingw-w64-i686-toolchain
pacman -S --needed base-devel msys2-devel
pacman -S mingw-w64-x86_64-python
pacman -S msys/libcrypt-devel
pacman -S openssl
pacman -S libopenssl
pacman -S openssl-devel

为了还构建https://github.com/libimobiledevice/ideviceinstaller,我还必须执行以下操作:

pacman -S mingw-w64-x86_64-libzip
cp /mingw64/lib/pkgconfig/libzip.pc /usr/lib/pkgconfig/
// 从复制的 libzip.pc 中删除包含无效 D:/msys64 路径的行
sed -i '/-lD:\/msys64/d' /usr/lib/pkgconfig/libzip.pc
git 克隆https://github.com/libimobiledevice/ideviceinstaller.git
cd ideviceinstaller
// 删除切换到威胁警告作为错误,因为有一些警告
sed -i 's/ -Werror//g' configure.ac
./autogen.sh
制作
安装

所有5条评论

使用 msys2,不要使用 cygwin 或 mingw。 我在链接问题中提到过。

tbh。 我不知道 mingw/cygwin 是否只是过时了,或者它们的堆栈根本无法在 Windows 10 1809/1903 上运行,但 msys2 可以工作。

@mexmer我确实使用过 MSys2 终端。 我是否需要删除 mingw 并从头开始在 Msys2 终端上重试构建?

我能够使用带有 OpenSSL 的 MSys2 进行编译。

这可能会帮助其他人:

安装 MSys2
https://stackoverflow.com/questions/26453293/what-is-the-best-way-to-install-pkg-config-on-mingw-in-2014
https://www.msys2.org/

构建 libplist
git 克隆https://github.com/libimobiledevice/libplist.git
(我记得收到 python 错误,所以必须安装 --without-cython)
./autogen.sh --without-cython
制作
进行安装

构建 libusb
git 克隆https://github.com/libusb/libusb.git
./自动生成
制作
进行安装

构建 libusbmuxd
git 克隆https://github.com/libimobiledevice/libusbmuxd.git
./autogen.sh
制作
进行安装

安装 libcrypt
pacman -S libgcrypt-devel

使用默认情况下的 OpenSSL 支持:
pacman -S openssl
pacman -S libopenssl
pacman -S openssl-devel

如果找不到 openssl 开发库,请安装 GNUTLS
https://github.com/libimobiledevice/libimobiledevice/issues/617
pacman -S mingw-w64-x86_64-gnutls
吃豆子 -S gnutls
pacman -S libgnutls
pacman -S libgnutls-devel

构建 libimobiledevice
git 克隆https://github.com/libimobiledevice/libimobiledevice.git
_// 使用 OpenSSL_
./autogen.sh --without-cython
_// 使用 GNU TLS_
./autogen.sh --without-cython --disable-openssl
制作
进行安装

这是我必须安装的清单,以便在没有 python 问题的情况下构建上面的所有内容:

吃豆子 -S git
pacman -S libedit
pacman -S mingw-w64-i686-toolchain
pacman -S --needed base-devel msys2-devel
pacman -S mingw-w64-x86_64-python
pacman -S msys/libcrypt-devel
pacman -S openssl
pacman -S libopenssl
pacman -S openssl-devel

为了还构建https://github.com/libimobiledevice/ideviceinstaller,我还必须执行以下操作:

pacman -S mingw-w64-x86_64-libzip
cp /mingw64/lib/pkgconfig/libzip.pc /usr/lib/pkgconfig/
// 从复制的 libzip.pc 中删除包含无效 D:/msys64 路径的行
sed -i '/-lD:\/msys64/d' /usr/lib/pkgconfig/libzip.pc
git 克隆https://github.com/libimobiledevice/ideviceinstaller.git
cd ideviceinstaller
// 删除切换到威胁警告作为错误,因为有一些警告
sed -i 's/ -Werror//g' configure.ac
./autogen.sh
制作
安装

@anshumanchatterji ,一旦你构建了项目,你在开发自己的程序时如何将其用作库?

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

alxjandroszlv picture alxjandroszlv  ·  3评论

dreamerblue picture dreamerblue  ·  6评论

abraunstein picture abraunstein  ·  3评论

truonggiang0710 picture truonggiang0710  ·  3评论

iOSShohrab picture iOSShohrab  ·  6评论