Actions
Bug #18019
closed3.0.X fails to link on Mac OS X 10.15.7 due to linker error related to _coroutine_transfer
Description
I'm struggling with building ruby 3.0.X on my Mac Catalina (Intel based). Please note all 2.X versions are compiling correctly.
I've already tried to use gnugcc but getting same error:
▶ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
▶ g++ --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Linker command fails on (full log attached):
+ clang -fdeclspec -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -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 -Wextra-tokens -std=gnu99 -pipe -L. -fstack-protector-strong -L/usr/local/lib -fstack-protector-strong -Wl,-pie -framework Security -framework Foundation main.o dmydln.o miniinit.o dmyext.o array.o ast.o bignum.o class.o compar.o compile.o complex.o cont.o debug.o debug_counter.o dir.o dln_find.o encoding.o enum.o enumerator.o error.o eval.o file.o gc.o hash.o inits.o io.o iseq.o load.o marshal.o math.o memory_view.o mjit.o mjit_compile.o node.o numeric.o object.o pack.o parse.o proc.o process.o ractor.o random.o range.o rational.o re.o regcomp.o regenc.o regerror.o regexec.o regparse.o regsyntax.o ruby.o scheduler.o signal.o sprintf.o st.o strftime.o string.o struct.o symbol.o thread.o time.o transcode.o transient_heap.o util.o variable.o version.o vm.o vm_backtrace.o vm_dump.o vm_sync.o vm_trace.o coroutine/amd64/Context.o enc/ascii.o enc/us_ascii.o enc/unicode.o enc/utf_8.o enc/trans/newline.o explicit_bzero.o setproctitle.o addr2line.o -lpthread -lgmp -ldl -lobjc -o miniruby
Undefined symbols for architecture x86_64:
"_coroutine_transfer", referenced from:
_fiber_setcontext in cont.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [miniruby] Error 1
Some people reported the same issue with Catalina and Big Sur: https://github.com/rbenv/ruby-build/issues/1723#issuecomment-872548168
Command Line Tools SDKs:
▶ ls /Library/Developer/CommandLineTools/SDKs/
14 13 Feb 13:12 MacOSX.sdk -> MacOSX11.1.sdk
9 Jul 2020 MacOSX10.15.sdk
30 Nov 2020 MacOSX11.1.sdk
I have very basic understanding of C and I'm suspecting that removal of this macro can be causing this behaviour: https://git.ruby-lang.org/ruby.git/commit/?id=e0f0ab959e , but I'm more than happy to be proven wrong
Files
Actions
Like0
Like0Like0Like0Like0Like0Like0