cross-compiling - libffi 由 pkg-config 安装并识别,但不被 glib 安装和识别

标签 cross-compiling configure mingw-w64 libffi

我想为 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/

相关文章:

linker - mingw64 下的 GetACP 链接错误(mingw-builds)

visual-studio - TFS 2010 - 每晚构建和测试

java - 在 Windows 上使用 JNI 从 Java 调用 Golang 导致 "A dynamic link library (DLL) initialization routine failed"

c - 在 C 中获取屏幕分辨率,w/o "windows.h"

linux - 通过工具链使用 automake 和 configure

java - 将 Objective-C 编译为 Java

boost - 尝试构建 Boost MPI,但未创建 lib 文件。这是怎么回事?

mingw - 使用mingw交叉编译时找不到zlib头文件?

Android NDK工具链异常处理seg faults

c++ - 用arm-linux-g++编译opencv失败(交叉编译)