From: "k0kubun (Takashi Kokubun) via ruby-core" <ruby-core@...> Date: 2024-07-29T03:02:46+00:00 Subject: [ruby-core:118719] [Ruby master Bug#20088] Ruby 3.3.0 does not cross-complie on arm64-darwin Issue #20088 has been updated by k0kubun (Takashi Kokubun). Thanks, I cherry-picked the revision to `ruby_3_3`. Since this ticket wasn't flagged as a backport request, I also added @mdalessio and @stanhu to the "Ruby master" project as "Contributor" so that you can update the "Backport" field yourself to request a backport next time https://github.com/ruby/ruby/wiki/How-To-Request-Backport. You may also file a pull request to `ruby_3_3` branch on GitHub, which would be more helpful in case there's any conflict. ---------------------------------------- Bug #20088: Ruby 3.3.0 does not cross-complie on arm64-darwin https://bugs.ruby-lang.org/issues/20088#change-109254 * Author: stanhu (Stan Hu) * Status: Closed * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: DONE ---------------------------------------- To reproduce: ```shell docker run -it ghcr.io/rake-compiler/rake-compiler-dock-image:1.4.0.rc2-mri-arm64-darwin bash cd /tmp export CPPFLAGS='' export CFLAGS='-O1 -fno-omit-frame-pointer -fno-fast-math -fstack-protector-strong ' export LDFLAGS='-pipe ' export CC=aarch64-apple-darwin-clang export MAKE='make V=1' rake-compiler cross-ruby VERSION=3.3.0 HOST=aarch64-apple-darwin ``` This errors out with: ```shell aarch64-apple-darwin-clang -O1 -fno-omit-frame-pointer -fno-fast-math -fstack-protector-strong -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wmisleading-indentation -Wundef -pipe -march=arm64 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT -fPIE -I. -I.ext/include/arm64-darwin -I/usr/local/rake-compiler/sources/ruby-3.3.0/include -I/usr/local/rake-compiler/sources/ruby-3.3.0 -I/usr/local/rake-compiler/sources/ruby-3.3.0/prism -I/usr/local/rake-compiler/sources/ruby-3.3.0/e nc/unicode/15.0.0 -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -o main.o -c /usr/local/rake-compiler/sources/ruby-3.3.0/main.c clang: error: the clang compiler does not support '-march=arm64' make: *** [uncommon.mk:1291: main.o] Error 1 ``` This appears to be a regression due to https://github.com/ruby/ruby/pull/9250. `RUBY_DEFAULT_ARCH("$target_cpu")` is called, and this `case` statement is hit: ```ac AS_CASE([$build_os], [darwin*], [ARCH_FLAG="-arch "$1], [ARCH_FLAG=-march=$1] ``` I'm not sure this test is correct, since `$build_os` appears to be `linux-gnu`. This results in `-march=arm64` being used, which is not a valid option even in `clang` 15.0.0. Should `$target_cpu` and `$target_os` be considered instead? The `configure` output shows: ``` Configuration summary for ruby version 3.3.0 * Installation prefix: /usr/local/rake-compiler/ruby/aarch64-apple-darwin/ruby-3.3.0 * exec prefix: ${prefix} * arch: arm64-darwin * site arch: ${arch} * RUBY_BASE_NAME: ruby * enable shared: no * ruby lib prefix: ${libdir}/${RUBY_BASE_NAME} * site libraries path: ${rubylibprefix}/${sitearch} * vendor path: ${rubylibprefix}/vendor_ruby * target OS: darwin * compiler: aarch64-apple-darwin-clang * with thread: pthread * with coroutine: arm64 * enable shared libs: no * dynamic library ext: bundle * CFLAGS: -fdeclspec ${optflags} ${debugflags} ${warnflags} * LDFLAGS: -L. -pipe -fstack-protector-strong * DLDFLAGS: -pipe -Wl,-multiply_defined,suppress -Wl,-undefined,dynamic_lookup * optflags: -O3 -fno-fast-math * debugflags: -ggdb3 * warnflags: -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition \ -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter \ -Wno-unused-value -Wunused-variable -Wmisleading-indentation -Wundef * strip command: aarch64-apple-darwin-strip -A -n * install doc: no * YJIT support: no * RJIT support: no * man page type: man * BASERUBY -v: ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x86_64-linux] ``` The `configure` statement for reference: ``` ./configure --host=aarch64-apple-darwin --target=aarch64-apple-darwin --build=x86_64-pc-linux-gnu --enable-install-static-library --disable-jit-support --disable-install-doc --with-ext= --enable-static --disable-shared --prefix=/usr/local/rake-compiler/ruby/aarch64-apple-darwin/ruby-3.3.0 ``` This was first reported in a CI failure in https://github.com/rake-compiler/rake-compiler-dock/pull/112#issuecomment-1869367367. -- 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/lists/ruby-core.ml.ruby-lang.org/