我想为 Windows 交叉编译 glib。配置抛出此错误:
configure: WARNING: using cross tools not prefixed with host triplet configure: error: Package requirements (libffi >= 3.0.0) were not met:
No package 'libffi' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix.
Alternatively, you may set the environment variables LIBFFI_CFLAGS and LIBFFI_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.
但是pkg-config --modversion libffi
打印“3.1”。我已经从 debian jessie 存储库安装了 libffi 和 libffi-dev。
(我不确定这是否属于 super 用户,因为它也与包问题有关)
最佳答案
Checkout the steps to Bootstrap GLIB with MinGW
1。本质上,首先需要下载源代码,构建并安装libffi
cd /path/to/libffi/source
mkdir bld
cd bld
../configure --prefix=/mingw
make && make install
2。 ...然后构建glib
而不使用PKG_CONFIG
cd /path/to/glib/source
mkdir bld
cd bld
export LIBFFI_CFLAGS='-I /mingw/lib/libffi-VERSION/include'
VERSION is to be replaced with whatever version you built above.
For me VERSION is 3.0.10.
export LIBFFI_LIBS=-lffi
export lt_cv_deplibs_check_method="pass_all"
export CFLAGS=”O0 -g -pipe -Wall -march=i486 -mms-bitfields -mthreads”
export CPPFLAGS=”-DG_ATOMIC_OP_USE_GCC_BUILTINS=1”
export LDFLAGS=”-Wl,--enable-auto-image-base”
../configure --prefix=/mingw --with-pcre=internal --disable-static --disable-gtk-doc --enable-silent-rules
make
make install
3。随后,可以构建并安装pkg_config
。
4。然后glib
就可以正常重建如下:
cd /path/to/glib/source/bld
make clean
../configure --prefix=/mingw
make
make install
关于cross-compiling - libffi 由 pkg-config 安装并识别,但不被 glib 安装和识别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41184475/