-
Notifications
You must be signed in to change notification settings - Fork 38.7k
depends: Do not consider CC environment variable for detecting system
#29963
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: master
Are you sure you want to change the base?
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/29963. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsNo conflicts as of last run. |
A workaround for a bug fixed in bitcoin#29963
|
Where/why is this an issue? |
A workaround for a bug fixed in bitcoin#29963
I faced this issue during my work on the CMake staging branch when the The log shows no cross-compiling, but it is cross-compiling to |
|
Surely this isn't the only place env vars like this would cause issues? Feels like a cat-and-mouse game. |
Can you link to the exact lines in the log that show "no cross-compiling". |
https://github.com/hebasto/bitcoin/actions/runs/8822538616/job/24220973382#step:14:245: Please note that that was a PR branch from the CMake migration project. That branch detects cross-compiling basing on |
Yea, as-is this doesn't seem like a great fix, and may just break other things? A better diff might be something like: diff --git a/depends/Makefile b/depends/Makefile
index 005d9696fb..091511758d 100644
--- a/depends/Makefile
+++ b/depends/Makefile
@@ -51,7 +51,7 @@ FALLBACK_DOWNLOAD_PATH ?= https://bitcoincore.org/depends-sources
C_STANDARD ?= c11
CXX_STANDARD ?= c++20
-BUILD = $(shell ./config.guess)
+BUILD = $(shell CC_FOR_BUILD=$CC ./config.guess)
HOST ?= $(BUILD)
PATCHES_PATH = $(BASEDIR)/patches
BASEDIR = $(CURDIR)which would at least be using the option that is meant to be used for this. |
deb57e3 to
2f66415
Compare
I agree. Implemented. Thanks! |
CC environment variable for detecting systemCC_FOR_BUILD for config.guess
Arguably that's because this wasn't intended to be supported :) I suppose this fix is reasonable, though supporting env vars like this seems quite brittle. |
A workaround for a bug fixed in bitcoin#29963
A workaround for a bug fixed in bitcoin#29963
|
Is this still an issue given recent CMake changes? |
Yes. Tested with the master branch @ 80bdd4b. And this PR still fixes it. |
|
@hebasto can you rebase this? |
2f66415 to
707d65b
Compare
Rebased. |
Guix builds (on x86_64) [untrusted test-only build, possibly unsafe, not for production use] |
|
My Guix build: |
There are testing environments, such as OSS-Fuzz, that rely on a project's build system to support environment variables. |
707d65b to
38d13e6
Compare
|
Rebased to resolve the conflict with the merged #30584. |
|
My Guix build: |
|
I don't understand this change. It seems setting CC_FOR_BUILD to CC is exactly the opposite of what we want to do? @hebasto's original change makes more sense to me: That ignores what's set in CC when detecting the native platform, which seems like the correct behavior to me. What was your intention with this patch, @fanquake ? |
At this point I can't remember. |
Otherwise, the build system fails to detect cross-compiling mode properly in some cases when `CC` is set.
38d13e6 to
a8cdc58
Compare
Reverted to the initial variant. |
Guix builds (on x86_64) [untrusted test-only build, possibly unsafe, not for production use] |
CC_FOR_BUILD for config.guess CC environment variable for detecting system
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.
Code review ACK a8cdc58. Seems good to unset an environment variable intended for cross compilation that is a causing a bad result when calling a native tool.
|
My Guix build: |
|
Current version of this PR is ok but I do think fanquake's suggested change #29963 (comment) passing along the requested compiler to I think his change had a typo because it suggests using Lines 126 to 130 in 13891a8
|
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.
ACK a8cdc58
Edit:
ryanofsky's idea above (i.e. propagating build_CC seems like a good addition though.
On the master branch @ 3c88eac, consider the following commands in the
dependssubdirectory:The printed variable values are expected.
However, switching the
CCvariable context from Makefile to the shell environment breaks expectations:This PR fixes this issue.