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

RUBY_TARGET not set properly when using rb-sys-dock --platform x86_64-linux-gnu #510

Closed
stanhu opened this issue Jan 30, 2025 · 2 comments · Fixed by #511
Closed

RUBY_TARGET not set properly when using rb-sys-dock --platform x86_64-linux-gnu #510

stanhu opened this issue Jan 30, 2025 · 2 comments · Fixed by #511

Comments

@stanhu
Copy link
Contributor

stanhu commented Jan 30, 2025

In this CI job, the oxidize-rb/actions/cross-gem@v1 action runs:

 rb-sys-dock --platform x86_64-linux-gnu --directory . --ruby-versions 3.1,3.2,3.3,3.4 --build

This now correctly pulls down the image rbsys/x86_64-linux-gnu:0.9.109, which is an alias for rbsys/x86_64-linux:0.9.109.

However, the RUBY_TARGET is set here:

ENV RUBY_TARGET="x86_64-linux" \

This should actually be x86_64-linux-gnu, not x86_64-linux. As a result, the build ends in failure:

Don't know how to build task 'native:x86_64-linux' (See the list of available tasks with `rake --tasks`)
Did you mean?  native:x86_64-linux-gnu
/tmp/rb-sys-dock/bundle/ruby/3.4.0/gems/rake-13.2.1/exe/rake:27:in '<top (required)>'
/usr/local/rbenv/versions/3.4.1/bin/bundle:25:in 'Kernel#load'
/usr/local/rbenv/versions/3.4.1/bin/bundle:25:in '<main>'

This distinction is important because gems compiled with x86_64-linux can work both on GNU and musl systems, but x86_64-linux-gnu is intended for GNU systems.

This probably can be solved by:

  1. Changing RUBY_TARGET from an ENV to an ARG.
  2. Having rb-sys-dock pass in -e RUBY_TARGET.
@stanhu
Copy link
Contributor Author

stanhu commented Jan 30, 2025

Actually, it may be simpler just to set the RUBY_TARGET to x86_64-linux-gnu since that is what is expected from the image.

@stanhu
Copy link
Contributor Author

stanhu commented Jan 30, 2025

It seems that /etc/rubybashrc sets RUBY_TARGET, so it's not sufficient just to override the value with -e at runtime:

echo "export RUBY_TARGET=\"$RUBY_TARGET\"" >> "$OUTFILE"

stanhu added a commit to stanhu/rb-sys that referenced this issue Jan 30, 2025
rake-compiler-dock images now make a distinction between GNU and
musl builds. Add a `-gnu` extension to `RUBY_TARGET` to make
it possible to run:

```
rb-sys-dock --platform x86_64-linux-gnu --directory . --build
```

Closes oxidize-rb#510
@ianks ianks closed this as completed in 798fad1 Jan 30, 2025
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 a pull request may close this issue.

1 participant