Skip to content
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

cmake: Fix cross-compiling detection on OpenBSD #300

Closed
wants to merge 1 commit into from

Conversation

hebasto
Copy link
Owner

@hebasto hebasto commented Aug 4, 2024

To detect cross-compiling, the host and build platforms are compared. The build variable is always an output of config.sub, but the host is not. This can lead to false results. For example, on OpenBSD:

  • host=amd64-unknown-openbsd7.5
  • build=x86_64-unknown-openbsd7.5

This change replaces the host variable with canonical_host, which is also always an output of config.sub. Thus, canonical_host and build are always properly comparable.


There are a few same/similar cases in the master branch. So I'm going to investigate them further. and submit a PR.

To detect cross-compiling, the host and build platforms are compared.
The `build` variable is always an output of `config.sub`, but the `host`
is not. This can lead to false results. For example, on OpenBSD:
 - host=amd64-unknown-openbsd7.5
 - build=x86_64-unknown-openbsd7.5

This change replaces the `host` variable with `canonical_host`, which is
also always an output of `config.sub`. Thus, `canonical_host` and
`build` are always properly comparable.
@hebasto
Copy link
Owner Author

hebasto commented Aug 4, 2024

Friendly ping @theStack who reported this bug offline.

@hebasto hebasto marked this pull request as draft August 4, 2024 21:47
@hebasto
Copy link
Owner Author

hebasto commented Aug 4, 2024

Drafted as this PR breaks cross-compiling convention for Guix builds:

  • the staging branch:
$ make print-crosscompiling HOST=x86_64-linux-gnu
crosscompiling=TRUE
  • this PR:
$ make print-crosscompiling HOST=x86_64-linux-gnu
crosscompiling=FALSE

@hebasto
Copy link
Owner Author

hebasto commented Aug 4, 2024

More correct change is here: bitcoin#30584.

@hebasto hebasto closed this Aug 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant