Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Do not use values from RbConfig if we are not building a C extension #2774
Do not use values from RbConfig if we are not building a C extension #2774
Changes from all commits
96fbbe6
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
SOEXT
CC
&CFLAGS
&CPPFLAGS
, probablyAR
&ARFLAGS
tooMAKEDIRS
,RMALL
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.
I just moved that code around, I didn't change any logic for CRuby (just trying to clarify the comments a bit), so I would like to not change that in this PR.
FWIW reusing the same CC for building the extension and libprism.a seems best, so I think it makes sense to keep it there.
RbConfig::CONFIG["CC"]
not existing seems very weird, how can any gem install of a gem with C extension work? Does mkmf have a fallback ifRbConfig::CONFIG["CC"]
does not exist?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 possible that people are using all pre-compiled gems + a Ruby that was built on a different 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.
Ah right, so in that case Prism happens to be the one to fail because it's the first C extension built from source on that target system? And so any other C extension built from source would fail too (because mkmf would use
RbConfig::CONFIG["CC"]
).It seems it's a user error in that case, they should not expect to be able to install native extensions from source without a native toolchain or with RbConfig pointing at a non-existing toolchain.
But, this PR changes nothing about that, I just wondered why the workaround is there.
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.
Is it time for us to start shipping prebuilt gems as well?
I previously thought about that too.
To resolve #2716. Perhaps @kddnewton just wanted to make the customer happy ASAP.
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 this was just to get a release out.
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.
One last thought about this is while this code might help with
make build/libprism.a
I don't see how it could help for mkmf and building the C extension, and sogem install prism
should still fail. That's a mystery.Unless mkmf check for the existance of
RbConfig::CONFIG["AR"]
but I don't see anything about that in https://github.com/ruby/ruby/blob/v3_3_0/lib/mkmf.rb (CC_WRAPPER is checked but not CC/AR).I think maybe in #2716
RbConfig::CONFIG["CC"]
exists butRbConfig::CONFIG["AR"]
does not. And then this workaround would help, since the root Makefile will usear
instead and C extensions very rarely useAR
.