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

时间:2016-12-16 12:31:05

标签: cross-compiling configure mingw-w64 libffi

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

  

configure:警告:使用不带主机三元组前缀的交叉工具   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。

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

2 个答案:

答案 0 :(得分:2)

  

查看Bootstrap GLIB with MinGW

的步骤

1。基本上需要首先下载源代码,构建并安装[System.Runtime.InteropServices.DllImport("User32.dll")] static extern bool MoveWindow(IntPtr h, int x, int y, int width, int height, bool redraw); private void toolTip1_Draw(object sender, DrawToolTipEventArgs e) { e.DrawBackground(); e.DrawBorder(); e.DrawText(); var t = (ToolTip)sender; var h = t.GetType().GetProperty("Handle", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); var handle = (IntPtr)h.GetValue(t); var c = e.AssociatedControl; var location = c.Parent.PointToScreen(new Point(c.Right - e.Bounds.Width, c.Bottom)); MoveWindow(handle, location.X, location.Y, e.Bounds.Width, e.Bounds.Height, false); }

libffi

2。 ...然后在没有cd /path/to/libffi/source mkdir bld cd bld ../configure --prefix=/mingw make && make install

的情况下构建glib
PKG_CONFIG

3。随后,可以构建并安装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

4。然后 pkg_config可以正常重建,如下所示:

glib

答案 1 :(得分: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"

这为我解决了。

我希望对您有所帮助。