【问题标题】:compiling glib with non-standard paths使用非标准路径编译 glib
【发布时间】:2012-09-11 17:22:55
【问题描述】:

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

~/localroot/lib/

头文件在:

~/localroot/lib/libffi-3.0.11/include/

但是,当我进行配置时:

~/tmp/build_alot/glib-2.32.1 $ ./configure --prefix=~/localroot

我看到以下错误:

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.

为了成功编译 glib,我需要为 LIBFFI_LIBS 和 LIBFFI_CFLAGS 设置哪些正确值?

一点额外的信息:

当我编译 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'

将PKG_CONFIG_PATH 设置为/home/user/localroot/lib/pkgconfig 仍然不会成功。

【问题讨论】:

    标签: linux gcc linker


    【解决方案1】:

    在启蒙的路上……

    我设法编译了 glib:

    export LIBFFI_CFLAGS=-I/home/user/localroot/lib/libffi-3.0.11/include
    export LIBFFI_LIBS="-L/home/user/localroot/lib -lffi"
    

    现在我必须看看未来的依赖项是否都对我的编译方式感到满意。

    【讨论】:

    • @L'angeCarasuelo,欢迎您!我想 SO 背后的人会笑着入睡,因为他们知道他们的服务器正在为一个好的事业而工作。
    • 就我而言,我使用了 sudo ./configure LIBFFI_CFLAGS=-I/usr/local/lib/libffi-3.0.13/include LIBFFI_LIBS="-L/usr/local/lib -lffi"
    • 始终检查 ./configure --help 以了解可用选项/环境变量
    【解决方案2】:

    对于像我这样想知道 -I 和 -L 和 -lffi 标志来自哪里的人(Oz123 的回答),我发现它们可以在以下位置找到:

    /home/user/local-software/libffi-3.1/lib/pkgconfig/libffi.pc
    

    阅读文件给出:

    ...
    ...
    Libs: -L${toolexeclibdir} -lffi
    Cflags: -I${includedir}
    

    使用Libs 和Cflags 位置分别设置LIBFFI_LIBS 和LIBFFI_CFLAGS 变量。现在,如果你运行./configure 然后运行make && make install,事情应该会奏效(至少他们为我做了)。

    【讨论】:

    • 这似乎不是对 OP 问题的回答。
    猜你喜欢
    • 2013-07-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-04
    • 1970-01-01
    • 2015-12-26
    • 2010-09-21
    相关资源
    最近更新 更多