cross compilation pkg-conf and path prefixing
See original GitHub issueDescribe the bug
I got a sysroot folder (an armv7 host) with some dependencies for pkg-conf to find. Eg x11.pc
. And I’ve got another folder with dependencies that are NOT inside the sysroot, eg. webrtc.pc
. So currently I got the following meson cross file:
[binaries]
cpp = 'clang++'
ar = 'llvm-ar'
strip = 'llvm-strip'
[built-in options]
cpp_args = [
'--sysroot', '<absolute>/sysroot',
'-target', 'arm-linux-gnueabihf',
]
cpp_link_args = [
'--sysroot', '<absolute>/sysroot',
'-Wl,-rpath=/usr/lib/arm-linux-gnueabihf',
'-Wl,-rpath=/lib/arm-linux-gnueabihf',
'-latomic',
'-target', 'arm-linux-gnueabihf',
]
[properties]
# sets PKG_CONFIG_SYSROOT_DIR
sys_root = '<absolute>/sysroot'
# sets PKG_CONFIG_LIBDIR
pkg_config_libdir = [
'<absolute>/sysroot/usr/share/pkgconfig',
'<absolute>/sysroot/usr/lib/arm-linux-gnueabihf/pkgconfig',
'<absolute>/sysroot/usr/lib/pkgconfig',
'<absolute>/dependencies' # <-- PROBLEM!!!!
]
[host_machine]
system = 'linux'
cpu_family = 'arm'
cpu = 'armv7'
endian = 'little'
Now the issues is, that pkgconf PREFIXES every path in the *.pc
files inside dependencies
with the sysroot defined in sys_root
.
However the paths defined pc files in the folder dependencies
MUST not be prefixed. Else the #include
and linking will fail.
However the prefixing is needed for the pc files found inside the sysroot.
How do I resolve this? Any tips or hints?
system parameters
- linux
meson --version
: 0.57.1
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
5. Supporting Cross-Compilation - pkg-config
This path needs to be prefixed to the paths added to the list of searched paths for headers and libraries, i.e., those that...
Read more >PKG_CONFIG_SYSROOT_DIR get also prepended to ...
I've got a problem when employing PKG_CONFIG_SYSROOT_DIR: Not all of my libraries are contained in the sysroot, but there are other ...
Read more >pkg-config vs. Cross Compile and Multi-arch - GNOME Blogs
Now when we cross compile libraries we put their .pc into the arm-linux pkgconfig directory and when we build something using pkg-config we ......
Read more >[CMake] pkgconfig and cross compiling - cmake@cmake.org
in use (and remove the prefix variable from all those files). Is there a way to tell pkgconfig to print the full path...
Read more >FindPkgConfig: translate pkg-config target paths to host when ...
@brad.king I would like to see CMAKE_SYSROOT handled by pkg_*_module as it causes me some headache with the with cross compilation in Yocto....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Right, as I said in https://todo.sr.ht/~kaniini/pkgconf/20, pkgconf and pkg-config both add sysroot prefix to -uninstalled.pc files too, which never make sense AFAIK.
Yeah, looks like it!
Okay, I’m gonna hack a solution by adding softlinks into the sysroot. So the prefix becomes valid. I’m gonna wait for #7650 and refactor afterwards.
No wonder cmake did the
<package>-config.cmake
stuff, combined with three variables on how to interpret these.Thx for your feedback and time.