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

Native extension ABI version check failing for some gems #2382

Closed
tomstuart opened this issue Jun 22, 2021 · 8 comments
Closed

Native extension ABI version check failing for some gems #2382

tomstuart opened this issue Jun 22, 2021 · 8 comments
Assignees
Milestone

Comments

@tomstuart
Copy link
Contributor

tomstuart commented Jun 22, 2021

As discussed, the native extension ABI version check in d497bae is causing failures when loading some gems on Linux (Ubuntu 20.04.2 LTS).

My current example is the semian gem:

LoadError: The native extension at truffleruby/2.7.3.4/gems/semian-0.11.4/lib/semian/semian.so has a different ABI version: "TRUFFLERUBY_ABI_VERSION" than the running TruffleRuby: "2.7.3.4"

@nirvdrum reported a similar problem with the google-protobuf gem. I’ll add more examples as I find them.

tomstuart referenced this issue Jun 22, 2021
…n loading a native extension

PullRequest: truffleruby/2735
@eregon
Copy link
Member

eregon commented Jun 22, 2021

google-protobuf is a different case, I already have a PR to fix that (it showed nil due the the symbol being hidden).

What happens here most likely is that TRUFFLERUBY_ABI_VERSION is not defined somehow, and in that case STRINGIZE(TRUFFLERUBY_ABI_VERSION); is replaced by "TRUFFLERUBY_ABI_VERSION" (unexpectedly).
Probably best to make it a compile/preprocessor-time error if TRUFFLERUBY_ABI_VERSION is not defined for clarity.

@eregon
Copy link
Member

eregon commented Jun 22, 2021

https://github.com/Shopify/semian/blob/6ff4b8292038fe3f6fc785884129039d5cf3e05f/ext/semian/extconf.rb#L26 is most likely what overrides the CFLAGS and causes the error.

@tomstuart
Copy link
Contributor Author

Makes sense. Is the suggestion that this must be fixed in the gem? Do we have no way of supporting what it’s currently doing?

@eregon
Copy link
Member

eregon commented Jun 22, 2021

I'll try to find a way that's more reliably to pass the define, but overriding $CFLAGS seems problematic in general and might be worth fixing in the gem anyway (appending to $CFLAGS is fine, replacing much less).

@eregon
Copy link
Member

eregon commented Jun 22, 2021

I found a way, I moved the define from debugflags (part of CFLAGS), to DEFS, part of CPPFLAGS (= C preprocessor flags, CPPFLAGS="cppflags_hardcoded $(DEFS) $(cppflags)") which seems better suited.
Here is to hoping nobody overrides cppflags or $CPPFLAGS.

@eregon eregon added this to the 21.3.0 milestone Jun 22, 2021
@tomstuart
Copy link
Contributor Author

FWIW I couldn’t find any other gems with this specific problem. All of the other failures I saw were the nil case like google-protobuf.

@eregon
Copy link
Member

eregon commented Jun 22, 2021

FWIW RubyInline includes CFLAGS but not CPPFLAGS when it compiles, but that's probably a bug of RubyInline (there are other known bugs with it), so doesn't matter too much.

@eregon eregon self-assigned this Jun 22, 2021
@eregon
Copy link
Member

eregon commented Jun 22, 2021

Fixed by 3252693

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

No branches or pull requests

2 participants