Project

General

Profile

Actions

Bug #18912

open

Build failure with macOS 13 (Ventura) Beta

Added by hsbt (Hiroshi SHIBATA) 25 days ago. Updated 3 days ago.

Status:
Assigned
Priority:
Normal
Target version:
-
[ruby-core:109201]

Description

Today, I tried to build ruby master with macOS 13 (Ventura) Beta. It breaks the build status caused by Xcode 14 beta changes.

TL;DR: We should add --without=+,bigdecimal --enable-shared to the configure option.

  1. Build failed without --enable-shared.

I build ruby master without --enable-shared option. I got the following error.

(snip)
linking shared-object -test-/arith_seq/extract.bundle
Undefined symbols for architecture arm64:
  "_rb_arithmetic_sequence_extract", referenced from:
      _arith_seq_s_extract in extract.o
  "_rb_ary_new_capa", referenced from:
      _arith_seq_s_extract in extract.o
  "_rb_ary_store", referenced from:
      _arith_seq_s_extract in extract.o
  "_rb_define_singleton_method", referenced from:
      _Init_extract in extract.o
  "_rb_path2class", referenced from:
      _Init_extract in extract.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

@katei (Yuta Saito) says this error affects with -undefined dynamic_lookup flags.

  1. Build error with bigdecimal

With --enabled-shared resolved the first error. But I got the another build failure.

compiling bigdecimal.c
In file included from bigdecimal.c:13:
In file included from ./bigdecimal.h:14:
./missing.h:127:1: error: static declaration of 'rb_rational_num' follows non-static declaration
rb_rational_num(VALUE rat)
^
../.././include/ruby/internal/intern/rational.h:128:7: note: previous declaration is here
VALUE rb_rational_num(VALUE rat);
      ^
In file included from bigdecimal.c:13:
In file included from ./bigdecimal.h:14:
(snip)

It's affected with static inline declaration in missing.h of bigdecimal.

  1. test failure with mjit

I could build with --with-out-ext=+,bigdecimal --enable-share option. But I also got the test failure with mjit.

[215/402] TestMJIT#test_lambda_longjmp = 0.19 s
192) Failure:
TestMJIT#test_lambda_longjmp [/Users/hsbt/Documents/github.com/ruby/ruby/test/ruby/test_mjit.rb:1045]:
Expected 1 times of JIT success, but succeeded 0 times.

script:
"""

fib = lambda do |x|
  return x if x == 0 || x == 1
  fib.call(x-1) + fib.call(x-2)
end
print fib.call(5)

"""


stderr:
"""
Undefined symbols for architecture arm64:
  "_mjit_call_p", referenced from:
      __mjit0 in _ruby_mjit_p39885u0-643ab5.o
      _vm_sendish in _ruby_mjit_p39885u0-643ab5.o

I already shared this to @k0kubun (Takashi Kokubun) .

macOS 13 beta is still development status. I will track this until the official release date.

Updated by alanwu (Alan Wu) 19 days ago

Can you build with bigdecimal included and post
cat ext/bigdecimal/mkmf.log from the build directory?
I ran into similar errors when building on illumos and
it was due to bigdecimal not configuring properly.

Updated by katei (Yuta Saito) 10 days ago

I've made a patch to address the linking failure issue by replacing -undefined dynamic_lookup with -bundle_loader.
https://github.com/ruby/ruby/pull/6193

The patch has been tested with Xcode 14 beta2 toolchain on macOS 12.4 Monterey, but not tested on the actual Ventura yet.

Updated by hsbt (Hiroshi SHIBATA) 10 days ago

@katei (Yuta Saito) Thanks! I will test your patch when it's complete.

FYI: Xcode 14 beta 3 with macOS 13.0 public beta is still same results.

Updated by alanwu (Alan Wu) 10 days ago

@hsbt (Hiroshi SHIBATA) Thanks for the logs. Some symbols are
indeed not found due to link errors. For example,
rb_complex_real() is provided but not found.

The linker error contradicts itself:

have_func: checking for rb_complex_real() in ruby.h... -------------------- no
...
ld: warning: ignoring file ../../libruby.3.2-static.a, building for macOS-arm64 but attempting to link with file built for macOS-arm64

So the error message could be better, at least.
Maybe the linker is not printing out the full
architecture stamp that it's comparing. You could
try checking otool -hv libruby.3.2-static.a and
comparing that with otool -hv bigdecimal.o.
The cpusubtype column might be different.
Also, maybe bigdecimal and libruby are built with
different toolchains due the way the XCode beta is
setup? I should find some time to install the beta...

Updated by hsbt (Hiroshi SHIBATA) 7 days ago

I tried https://github.com/ruby/ruby/pull/6193 .

The first try is failed. Because my environment mixed the homebrew binutils built by macOS 12.0(monterey).

I could build ruby after removing GNU binutils from PATH. and it could build bigdecimal and pass with tests related MJIT.

Updated by hsbt (Hiroshi SHIBATA) 7 days ago

  • Assignee set to hsbt (Hiroshi SHIBATA)
  • Status changed from Open to Assigned

Updated by hsbt (Hiroshi SHIBATA) 3 days ago

After merging https://github.com/ruby/ruby/pull/6193. We could build Ruby.

But We have still failing tests:

TestProcess#test_daemon_nocloseobjc[10525]: +[NSPlaceholderMutableString initialize] may have been in progress in another thread when fork() was called.
objc[10525]: +[NSPlaceholderMutableString initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
 = 0.00 s
  1) Failure:
TestProcess#test_daemon_noclose [/Users/hsbt/Documents/github.com/ruby/ruby/test/ruby/test_process.rb:1846]:
<"ok\n" + "/\n"> expected but was
<"">.

and spec/ruby/core/process/daemon_spec.rb is also failed.

Actions

Also available in: Atom PDF