-
Notifications
You must be signed in to change notification settings - Fork 993
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
[question] How to cross build to the same os/arch combination when using autotools. #14947
Comments
Hi @CMelanie Thanks for your question. The template for ConanCenter autotools contains a lot of things, including some backwards compatibility for the case when not using 2 profiles (which is very recommended for cross-building). I suspect that the main issue is the |
Hello @memsharded , thank you for your answer. I'm using two profiles, indeed. A standard Linux one as build profile, and a host profile which is setting the environment with a different compiler and such, and defines the os along the lines of:
Indeed, the template contains a lot (they're very handy, though, great starting point!), but I trimmed down what I thought wasn't needed (hopefully I didn't trim down too much). # [...]
def configure(self):
# Plain C library.
self.settings.rm_safe("compiler.libcxx")
self.settings.rm_safe("compiler.cppstd")
def generate(self):
autotools_toolchain = AutotoolsToolchain(self)
autotools_toolchain.fpic = True
autotools_toolchain.configure_args.extend( <a bunch of package specific settings>)
autotools_toolchain.generate()
def build(self):
autotools = Autotools(self)
autotools.autoreconf()
autotools.configure()
autotools.make()
# [...] it builds correctly if the host arch is different from the build arch. However, if the arch is the same, it fails due to mixing up glibc. |
Hi @CMelanie, I believe this could be caused by Conan computing the triplet based on only os/arch - so it has no way of defining a different one in this case. However, you could try defining the You can define it in the command line with |
Hello @jcar87 , thank you for the suggestion. I've tried adding this:
to the host profile (using powerpc for the sake of experiment). However, I keep having the same error where it's using the wrong glibc. |
Hi @CMelanie , I think something that could work for that (given the limitations of that def generate(self):
autotools_toolchain = AutotoolsToolchain(self)
autotools_toolchain.fpic = True
autotools_toolchain.configure_args.extend( [
<a bunch of package specific settings>,
])
# Update any `configure_arg` introduced by Conan:
autotools_toolchain.update_configure_args.extend( {
"--host": "your_triplet",
"--build": "your_build_triplet",
})
# Also, these flags will be appended to the default Conan ones in build time
autotools_toolchain.extra_cxxflags.append("--flagxxx")
autotools_toolchain.extra_cflags.append("--flagxxx")
autotools_toolchain.extra_ldflags.append("--flagxxx")
autotools_toolchain.extra_defines.append("-Ddef")
# build scope by default. Otherwise, use autotools_toolchain.generate(env="host") instead
autotools_toolchain.generate() Could this help to solve the issue? |
Hello @franramirez688 , That works if I use a fake triplet (powerpc-linux-gnu instead of x86_64) for the --build option. Great! Thank you very much for your help, all! |
So glad to hear that @CMelanie 👏 |
What is your question?
Using Conan 1.60.0, I'm working on a cross build from Linux to a different Linux system (so same settings.os and settings.arch, but different glibc, etc.). To differentiate between these builds, some extra subsettings to settings.os were added. Building works fine this way for cmake in combination with a custom toolchain.
However, using the template from the conan center for autotools builds, it doesn't work correctly. Looking at the cross_building check, I see it only takes os and arch into account, and not the extra subsettings, so I'm guessing this is not the way to do it.
So I'm wondering, what would be the right approach to cross build to the same os/arch combination when using the autotools toolchain?
Have you read the CONTRIBUTING guide?
The text was updated successfully, but these errors were encountered: