Closed asmeikal closed 3 years ago
Tests pass on my side, but I'm also running terminal w/ rosetta and haven't rebuilt my entire ecosystem... it just works.
If I try to run with the system ruby (which I don't recommend in general), I get:
TestInline::TestC#test_build_good:
CompilationError: error executing "xcrun clang -dynamic -bundle -arch x86_64 -arch arm64e -undefined dynamic_lookup -multiply_defined suppress -g -Os -pipe -DHAVE_GCC_ATOMIC_BUILTINS -DUSE_FFI_CLOSURE_ALLOC -L. -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.Internal.sdk/usr/local/lib -I /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0 -I /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin20 -I /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include -L/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib -o \"/var/folders/9s/yqskfj712zgdhlmkb0jcq5_h0000gn/T/test_inline.55095/.ruby_inline/ruby-2.6.0/Inline_DumbTest1_98893fda94dfa71685362eb0e9a9b609.bundle\" \"/var/folders/9s/yqskfj712zgdhlmkb0jcq5_h0000gn/T/test_inline.55095/.ruby_inline/ruby-2.6.0/Inline_DumbTest1_98893fda94dfa71685362eb0e9a9b609.c\" 2> /dev/null": pid 55105 exit 1
Renamed /var/folders/9s/yqskfj712zgdhlmkb0jcq5_h0000gn/T/test_inline.55095/.ruby_inline/ruby-2.6.0/Inline_DumbTest1_98893fda94dfa71685362eb0e9a9b609.c to /var/folders/9s/yqskfj712zgdhlmkb0jcq5_h0000gn/T/test_inline.55095/.ruby_inline/ruby-2.6.0/Inline_DumbTest1_98893fda94dfa71685362eb0e9a9b609.c.bad
Looking further:
2414 % /usr/bin/ruby -d -Ilib:test:.:../../ZenTest/dev/lib:lib -w -e 'require "minitest/autorun"; require "test/test_inline.rb"' -- -n /test_build_good/
RubyInline v 3.12.5
Run options: -n /test_build_good/ --seed 458
# Running:
...
Building /var/folders/9s/yqskfj712zgdhlmkb0jcq5_h0000gn/T/test_inline.56022/.ruby_inline/ruby-2.6.0/Inline_DumbTest1_98893fda94dfa71685362eb0e9a9b609.bundle with 'xcrun clang -dynamic -bundle -arch x86_64 -arch arm64e -undefined dynamic_lookup -multiply_defined suppress -g -Os -pipe -DHAVE_GCC_ATOMIC_BUILTINS -DUSE_FFI_CLOSURE_ALLOC -L. -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.Internal.sdk/usr/local/lib -I /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0 -I /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin20 -I /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include -L/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib -o "/var/folders/9s/yqskfj712zgdhlmkb0jcq5_h0000gn/T/test_inline.56022/.ruby_inline/ruby-2.6.0/Inline_DumbTest1_98893fda94dfa71685362eb0e9a9b609.bundle" "/var/folders/9s/yqskfj712zgdhlmkb0jcq5_h0000gn/T/test_inline.56022/.ruby_inline/ruby-2.6.0/Inline_DumbTest1_98893fda94dfa71685362eb0e9a9b609.c" '
In file included from /var/folders/9s/yqskfj712zgdhlmkb0jcq5_h0000gn/T/test_inline.56022/.ruby_inline/ruby-2.6.0/Inline_DumbTest1_98893fda94dfa71685362eb0e9a9b609.c:1:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby.h:33:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby/ruby.h:24:10: fatal error:
'ruby/config.h' file not found
#include "ruby/config.h"
^~~~~~~~~~~~~~~
1 error generated.
lol... so, yeah, this is why I don't recommend running system ruby. They apparently didn't include a header they should have. Build your own ruby and try again?
Thansk @zenspider! Installing ruby with rbenv worked!
Running
rake test
on an M1 mac with systemruby
reports 6 tests failure, all with the same cause:I'm extremely new to ruby, but from my understanding the problem is that
RbConfig::CONFIG['DLDFLAGS']
contains-arch arm64e
, which is an architecture that cannot be used by non-system applications/services at the moment (see here).Adding
-arch arm64
to thecmd
insidebuild
fixes the tests. Being a ruby newb, I'm not sure what is the correct way to detect if running on M1. Something likeif /arm64/ =~ `arch`
should work, but I'm not sure what are the best practices.