gpt4 book ai didi

cross-compiling - pkg-config 无法在 sysroot 目录下找到包

转载 作者:行者123 更新时间:2023-12-03 22:52:37 28 4
gpt4 key购买 nike

谁能告诉我为什么这可能会失败:

afeder@ubuntu:~/android/toolchain/sysroot$ ls $PKG_CONFIG_SYSROOT_DIR/usr/local/lib/pkgconfig/mozjs185.pc
/home/afeder/android/toolchain/sysroot/usr/local/lib/pkgconfig/mozjs185.pc

afeder@ubuntu:~/android/toolchain/sysroot$ pkg-config mozjs185 --cflags
Package mozjs185 was not found in the pkg-config search path.
Perhaps you should add the directory containing `mozjs185.pc'
to the PKG_CONFIG_PATH environment variable
No package 'mozjs185' found

据人 pkg-config(1) , /usr/local/lib/pkgconfig应该是默认搜索路径之一。

最佳答案

我在这里找到了答案:http://www.flameeyes.eu/autotools-mythbuster/pkgconfig/cross-compiling.html

The wrapper script should not only set the PKG_CONFIG_SYSROOT_DIR variable: when cross-compiling you want to ignore the packages installed in the system, and instead rely only on those installed in the cross-compiled environment. This is achieved by resetting PKG_CONFIG_DIR (which lists additional search paths), and at the same time setting PKG_CONFIG_LIBDIR to override the default base search paths.



生成的 CMake 文件将是这样的:
set(CMAKE_SYSROOT "/path/to/sysroot")

set(ENV{PKG_CONFIG_DIR} "")
set(ENV{PKG_CONFIG_LIBDIR} "${CMAKE_SYSROOT}/usr/lib/pkgconfig:${CMAKE_SYSROOT}/usr/share/pkgconfig")
set(ENV{PKG_CONFIG_SYSROOT_DIR} ${CMAKE_SYSROOT})

免责声明:我使用了 CMAKE_SYSROOT当您想传递 -sysroot 时很有用的变量至 g++ .如果你不想要这个,你应该以不同的方式命名你的变量。

关于cross-compiling - pkg-config 无法在 sysroot 目录下找到包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9221236/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com