-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Meson: fix pkgconf sysroot prefix to conan paths when cross-compiling #19303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop2
Are you sure you want to change the base?
Meson: fix pkgconf sysroot prefix to conan paths when cross-compiling #19303
Conversation
… packages (that are outside the toolchain sysroot).
fce1420 to
9b759be
Compare
|
The current commit in this PR doesn't work, the environment variable PKG_CONFIG_FDO_SYSROOT_RULES is not set when the Meson configure step runs. I am reading the Conan documentation how to add a variable to the build environment but haven't found the solution yet. Help is appreciated. |
memsharded
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution @wdobbe
It is generally better to start with a test that fails without the fix, then apply the fix to get a green test. That helps a lot understanding the original issue.
| if is_cross_build: | ||
| #Do not let pkgconf prefix sysroot path in front of paths to Conan packages (that are | ||
| #outside the toolchain sysroot). | ||
| os.environ['PKG_CONFIG_FDO_SYSROOT_RULES'] = "1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting an environment variable this way is not correct, it will leave the environment dirty for other packages, etc. If anything, the approach would be in the MesonToolchain generator, to generate a Environment script with the necessary env-vars
|
As of Conan 2.23, which was released yesterday (#19229) Conan no longer passes the sysroot to meson as a variable - it caused pkg-config to unconditionally prefix the paths in a way that did not work. Please note that the environment variable referenced in this PR only applies to the
It is very important to get this right, because otherwise incorrect use may cause the different tools to pass So when working with a sysroot, it's really important to "override" the internals and ensure that pkg-config reflects the layout of the sysroot, while still giving higher priority to Conan dependencies - There are a number of issues reported for pkgconf:
All with subtle differences, depending on the specific version, and bearing in mind that they may not apply to the older My recommendation would be a wrapper script like the following: |
Currently when a package uses the Meson build helper classes sometimes the include and library paths to other Conan packages in the cache are prefixed with the toolchain sysroot path. This will cause the build to fail because the Conan packages are located outside the toolchain sysroot. See issue #16468.
This happens when the include and/or lib path are retrieved with pkgconf. If a sysroot path is passed to pkgconf it will prefix all -I and -L paths with the sysroot path. To prevent this you can set environment variable PKG_CONFIG_FDO_SYSROOT_RULES, which is what this PR does.
Examples of CCI packages that currently fail when cross-compiling are:
Fixes #16468.
Changelog: (Fix): Meson: do not prefix toolchain sysroot path to include and lib paths to Conan packages when cross-compiling.
developbranch, documenting this one.