使用非标准路径编译glib

Oz1*_*123 16 linux linker gcc

我正在尝试编译glib-2.32.1,因此我安装libffi-3.0.1到以下路径:

~/localroot/lib/
Run Code Online (Sandbox Code Playgroud)

并且头文件位于:

~/localroot/lib/libffi-3.0.11/include/
Run Code Online (Sandbox Code Playgroud)

但是,当我配置时:

~/tmp/build_alot/glib-2.32.1 $ ./configure --prefix=~/localroot
Run Code Online (Sandbox Code Playgroud)

我看到以下错误:

checking whether to cache iconv descriptors... no
checking for ZLIB... yes
checking for LIBFFI... no
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.
Run Code Online (Sandbox Code Playgroud)

我需要设置哪些正确的值 LIBFFI_LIBS以及LIBFFI_CFLAGS成功编译glib?

一小部分额外信息:

当我编译libffi时,我得到以下有用信息:

库已安装在:/ home/nahum/localroot/lib中

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
    ----------------------------------------------------------------------
test -z "/home/user/localroot/share/info" || /bin/mkdir -p "/home/user/localroot/share/info"
 /usr/bin/install -c -m 644 ../doc/libffi.info '/home/nahum/localroot/share/info'
 install-info --info-dir='/home/user/localroot/share/info' '/home/user/localroot/share/info/libffi.info'
test -z "/home/user/localroot/lib/pkgconfig" || /bin/mkdir -p "/home/user/localroot/lib/pkgconfig"
 /usr/bin/install -c -m 644 libffi.pc '/home/user/localroot/lib/pkgconfig'
make[3]: Leaving directory `/home/user/tmp/build_alot/libffi-3.0.11/x86_64-unknown-linux-gnu'
make[2]: Leaving directory `/home/user/tmp/build_alot/libffi-3.0.11/x86_64-unknown-linux-gnu'
make[1]: Leaving directory `/home/user/tmp/build_alot/libffi-3.0.11/x86_64-unknown-linux-gnu'
Run Code Online (Sandbox Code Playgroud)

设置PKG_CONFIG_PATH/home/user/localroot/lib/pkgconfig仍然没有带来成功.

Oz1*_*123 38

在通往启蒙的道路上......

我设法编译glib:

export LIBFFI_CFLAGS=-I/home/user/localroot/lib/libffi-3.0.11/include
export LIBFFI_LIBS="-L/home/user/localroot/lib -lffi"
Run Code Online (Sandbox Code Playgroud)

现在,我必须看看未来的依赖关系是否对编译它的方式感到满意.

  • 就我而言,我使用了sudo ./configure LIBFFI_CFLAGS = -I/usr/local/lib/libffi-3.0.13/include LIBFFI_LIBS =" - L/usr/local/lib -lffi" (2认同)