From: "nobu (Nobuyoshi Nakada) via ruby-core" Date: 2022-12-16T03:30:14+00:00 Subject: [ruby-core:111319] [Ruby master Bug#19239] miniruby is not built by default when cross-compiling ruby 3.2.0-rc1 Issue #19239 has been updated by nobu (Nobuyoshi Nakada). Since it is macOS and disable_shared specific, I think the dependency can be in default/gmake.mk. ---------------------------------------- Bug #19239: miniruby is not built by default when cross-compiling ruby 3.2.0-rc1 https://bugs.ruby-lang.org/issues/19239#change-100689 * Author: mdalessio (Mike Dalessio) * Status: Open * Priority: Normal * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- When cross-compiling Ruby for darwin, the default make target doesn't build miniruby, even though it's needed for symbol resolution since https://github.com/ruby/ruby/commit/50d81bf A workaround is to run `make miniruby && make` but I'm opening this issue to discuss if something needs to be fixed. Here is a dockerfile that reproduces the issue: ```dockerfile FROM larskanis/rake-compiler-dock-mri-x86_64-darwin:1.2.2 RUN wget https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.0-rc1.tar.gz RUN tar -zxf ruby-3.2.0-rc1.tar.gz ENV DEBIAN_FRONTEND noninteractive RUN apt-get -y update && \ apt-get install -y curl git-core xz-utils build-essential zlib1g-dev libreadline-dev libssl-dev wget unzip sudo gnupg2 dirmngr cmake pkg-config autoconf libyaml-dev ENV CC x86_64-apple-darwin-clang RUN bash -c " \ rvm use 3.1.0 && \ cd ruby-3.2.0-rc1 && \ ./configure \ --host=x86_64-apple-darwin \ --target=x86_64-apple-darwin \ --build=x86_64-pc-linux-gnu \ --disable-jit-support \ " RUN bash -c " \ rvm use 3.1.0 && \ cd ruby-3.2.0-rc1 && \ make V=1 \ " ``` Failure emits errors like this: ``` x86_64-apple-darwin-clang -dynamic -bundle -o ../../../.ext/x86_64-darwin/-test-/RUBY_ALIGNOF.bundle c.o cpp.o -L. -L../../.. -L. -fstack-protector-strong -Wl,-multiply_defined,suppress -Wl,-undefined,dynamic_lookup -bundle_loader '../../../miniruby' -lpthread ld: file not found: ../../../miniruby clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: Leaving directory '/ruby-3.2.0-rc1/ext/-test-/RUBY_ALIGNOF' make[2]: *** [Makefile:271: ../../../.ext/x86_64-darwin/-test-/RUBY_ALIGNOF.bundle] Error 1 make[1]: Leaving directory '/ruby-3.2.0-rc1' make[1]: *** [exts.mk:100: ext/-test-/RUBY_ALIGNOF/all] Error 2 make: *** [uncommon.mk:330: build-ext] Error 2 ``` The error stems from the LD flag `-bundle_loader '$(BUILTRUBY)'` which points at `miniruby`, even though `miniruby` has not been built. Replacing the last command with this will successfully build Ruby: ```dockerfile RUN bash -c " \ rvm use 3.1.0 && \ cd ruby-3.2.0-rc1 && \ make miniruby V=1 && \ make V=1 \ " ``` This is also happening on master HEAD. cc @katei and @alanwu who seem to be familiar with the `bundle_loader` functionality. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/