← Back to issue list

autotools: cross-compile using --host instead of env

View original Github issue

Metadata

Project
snapcraft
Number
#1654
Type
pull request
State
merged
Author
kyrofa
Labels
—
Created
Updated
Closed

Current evaluation

Merged #1654 in commit 19a616bf8, replacing autotools CC/CXX cross-compile overrides with the target GNU triplet passed via --host, enabling correct cross-tool detection such as strip.

Resolution: closed resolved

Reason: The approved PR was merged as commit 19a616bf8. It now maps the target architecture to the proper GNU triplet and passes it to configure with --host instead of forcing CC/CXX, fixing cross-toolchain detection.

Evaluated by: mr-cal-bot

No scores available.

Issue body

- [x] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)? - [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? - [x] If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on [bug reports](https://bugs.launchpad.net/snapcraft)? - [x] If this is a new feature. Have you discussed the design on the [forum](https://forum.snapcraft.io)? - [x] Have you successfully run `./runtests.sh static`? - [x] Have you successfully run `./runtests.sh unit`? ----- Take a look at the `configure` output for our autotools cross-compile integration test (I'm doing this by hand, running `snapcraft --target-arch=armhf`): ``` [...] ./configure --prefix= --host=armhf checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for armhf-strip... no checking for strip... strip [...] ``` Note that it's using the build system's `strip`, not the cross-toolchain's `strip`. What is `armhf-strip` anyway? Nothing, I tell you! We're setting --host to the deb arch instead of the triplet. Currently the autotools plugin uses the CC and CXX environment variables to force autotools to cross-compile. However, autotools will do this on its own if one sets the --host parameter correctly, and will actually do a better job (e.g. use the cross-toolchain's strip as well). Remove the environment variables, and set the --host to the target triplet if cross-compiling. More info on how to cross-compile using autotools (including details on --host) can be found [here](https://www.gnu.org/software/automake/manual/html_node/Cross_002dCompilation.html).

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged #1654 in commit 19a616bf8, replacing autotools CC/CXX cross-compile overrides with the target GNU triplet passed via --host, enabling correct cross-tool detection such as strip.
stealth/space-bunny-alpha — closed resolved Merged #1654 in commit 19a616bf8: Autotools cross-compilation now uses the target triplet via --host instead of CC/CXX environment variables, enabling correct cross-tool selection.
stealth/space-bunny-alpha — closed resolved Merged PR #1654 in commit 19a616bf8, replacing Autotools CC/CXX overrides with the target GNU triplet passed to configure via --host.
stealth/space-bunny-alpha — closed resolved Merged #1654 (commit 19a616bf8): autotools now uses the target --host triplet instead of CC/CXX environment variables, enabling correct cross-toolchain detection, including strip.
qwen/qwen3.6-35b-a3b — — Fixed autotools cross-compilation by replacing CC and CXX environment variables with proper --host triplet arguments. Merged after reviewer approval and passing CI checks, ensuring correct toolchain detection including cross-strip.
qwen3.6-35b-a3b-mtp-q6 — — Merged. Replaced CC/CXX environment variables with the correct --host triplet for autotools cross-compilation. This ensures proper use of cross-toolchain utilities like strip. Validated for armhf/arm64 builds and merged.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#1383 autotools: Enable cross-compilation support snapcraft merged Merged PR #1383 in commit b1cc6454e, adding Autotools cross-compilation by setting the C and C++ compiler environment variables.
76%
#3523 autotools v2 plugin: adding cross compilation support snapcraft closed PR #3523 was closed unmerged after concerns about build-environment compliance and non-gcc CC handling; the maintainer deferred further design discussion to the forum.
71%