Commit c286dcb0 authored by Samuel Dionne-Riel's avatar Samuel Dionne-Riel
Browse files

ruby: Fix cross-compilation with yjit



Otherwise it will produce `yjit.a` with the default target for the
`rustc` compiler, which in turn turns out to be the build platform?

It could be configured using the `RUST` environment variable, and
since it's used without quoting it would expand the arguments added
to it.

Using `RUST = "rust --target ..."` I think would be  undesirable for
cross-compiling (and native), since it will save those arguments in
`lib/ruby/*/*/rbconfig.rb`. Though that might be fine too. I guess.

Note that 3.2 breaks differently. I haven't investigated it, since it's
not the default anymore, and will eventually be dropped.

Signed-off-by: default avatarSamuel Dionne-Riel <samuel@dionne-riel.com>
(cherry picked from commit 75d6216956bfb72a2a1082da7237f74dddf8e123)
parent 504ad0ac
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -177,6 +177,13 @@ let
          ];
          propagatedBuildInputs = op jemallocSupport jemalloc;

          env = lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform && yjitSupport) {
            # The ruby build system will use a bare `rust` command by default for its rust.
            # We can use the Nixpkgs rust wrapper to work around the fact that our Rust builds
            # for cross-compilation output for the build target by default.
            NIX_RUSTFLAGS = "--target ${stdenv.hostPlatform.rust.rustcTargetSpec}";
          };

          enableParallelBuilding = true;
          # /build/ruby-2.7.7/lib/fileutils.rb:882:in `chmod':
          #   No such file or directory @ apply2files - ...-ruby-2.7.7-devdoc/share/ri/2.7.0/system/ARGF/inspect-i.ri (Errno::ENOENT)