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
fix: sysroot property #16011
base: develop2
Are you sure you want to change the base?
fix: sysroot property #16011
Conversation
self.properties["sys_root"] = sys_root | ||
self.c_args.append("--sysroot=" + sys_root) | ||
self.cpp_args.append("--sysroot=" + sys_root) | ||
self.c_link_args.append("--sysroot=" + sys_root) | ||
self.cpp_link_args.append("--sysroot=" + sys_root) |
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.
If sys_root
is a property, does it still need to be added as a flag? Wouldn't Meson take care of that automatically?
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.
Yeah, it looks weird. I'm going to figure out how Meson manages this attribute because I think that it should automatically inject that one.
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.
It's needed: https://mesonbuild.com/Cross-compilation.html#properties
Since 0.52.0 The sys_root property may point to the root of the host system path (the system that will run the compiled binaries). This is used internally by Meson to set the PKG_CONFIG_SYSROOT_DIR environment variable for pkg-config. If this is unset the host system is assumed to share a root with the build system.
The sys_root
property only configures the PKG_CONFIG_SYSROOT_DIR
, nothing more.
But how Meson users manage --sysroot
then?
They pass to c_flags
and cxx_flags
:
- https://github.com/mesonbuild/meson/blob/24a96a3c95ea935c169b038ed91bf6379184ad66/docs/markdown/Machine-files.md?plain=1#L67
- Suggestion: use defaults for sysroot handling in cross file in order to reduce copy paste mesonbuild/meson#7722
On the other hand, Conan users could have it defined in tools.build:cflags
and so on.
conan/tools/meson/toolchain.py
Outdated
# self.c_args.append("--sysroot=" + sys_root) | ||
# self.cpp_args.append("--sysroot=" + sys_root) | ||
# self.c_link_args.append("--sysroot=" + sys_root) | ||
# self.cpp_link_args.append("--sysroot=" + sys_root) |
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.
These are then unnecessary, and Meson will manage with the property? (recall to remove this code, you can put a comment like # property sys_root is enough, not necessary to define cxx flags
assert re.search(r"c_args =.+--sysroot=/my/new/sysroot/path.+", conan_meson) | ||
assert re.search(r"c_link_args =.+--sysroot=/my/new/sysroot/path.+", conan_meson) | ||
assert re.search(r"cpp_args =.+--sysroot=/my/new/sysroot/path.+", conan_meson) | ||
assert re.search(r"cpp_link_args =.+--sysroot=/my/new/sysroot/path.+", conan_meson) |
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.
Who is adding this to the file then?
Signed-off-by: Uilian Ries <uilianries@gmail.com>
Signed-off-by: Uilian Ries <uilianries@gmail.com>
Assigning this PR to @franramirez688 for Conan 2.4, otherwise it will slip |
Changelog: Fix: Handle
tools.build:sysroot
on Meson toolchainDocs: https://github.com/conan-io/docs/pull/XXXX
Close: #14987
I added the
sys_root
to the Meson properties and the--sysroot=sys_root
flag onc_args
,cpp_args
,c_link_args
andcpp_link_args
.