libffi由pkg-config安装和识别,但不是由glib安装

问题描述 投票:2回答:2

我想为Windows交叉编译glib。 configure抛出此错误:

configure:警告:使用不带有host triplet configure的交叉工具:error:不满足包要求(libffi> = 3.0.0):

找不到包'libffi'

如果以非标准前缀安装软件,请考虑调整PKG_CONFIG_PATH环境变量。

或者,您可以设置环境变量LIBFFI_CFLAGS和LIBFFI_LIBS以避免需要调用pkg-config。有关更多详细信息,请参见pkg-config手册页。

然而,pkg-config --modversion libffi打印“3.1”。我已经从debian jessie存储库安装了libffi和libffi-dev。

(我不确定这是否属于超级用户,因为它也与包问题有关)

cross-compiling configure mingw-w64 libffi
2个回答
2
投票

查看Bootstrap GLIB with MinGW的步骤


1. Essentially one needs to first Download the source, build and install libffi

cd /path/to/libffi/source
mkdir bld
cd bld
../configure --prefix=/mingw
make && make install

2. ...followed by building glib without 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. Subsequently, pkg_config can be built and installed.

4. Then glib can be rebuilt normally as follows:

cd /path/to/glib/source/bld
make clean
../configure --prefix=/mingw
make
make install

0
投票

在我的情况下,我在运行npm i时收到了下一条错误消息:

node-gyp rebuild

Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libffi', required by 'gobject-2.0', not found
gyp: Call to 'pkg-config --cflags  cairo poppler-qt5' returned exit status 1 while in binding.gyp. while trying to load binding.gyp

我发现问题在于导出PATH

所以我跑了brew reinstall -s poppler

在安装结束时,您可以运行路径的导出

If you need to have qt first in your PATH run:
  echo 'export PATH="/usr/local/opt/qt/bin:$PATH"' >> ~/.zshrc

For compilers to find qt you may need to set:
  export LDFLAGS="-L/usr/local/opt/qt/lib"
  export CPPFLAGS="-I/usr/local/opt/qt/include"

For pkg-config to find qt you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/qt/lib/pkgconfig"

这为我修好了。

我希望你觉得这对你有帮助。

© www.soinside.com 2019 - 2024. All rights reserved.