Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Builds incompatible code on MacOS M1 / arm64 architecture #231

Open
tilo opened this issue Dec 18, 2023 · 25 comments
Open

Builds incompatible code on MacOS M1 / arm64 architecture #231

tilo opened this issue Dec 18, 2023 · 25 comments

Comments

@tilo
Copy link

tilo commented Dec 18, 2023

when building the C-extension, it builds x86_64 code on a arm64 CPU, which results in this error:

 require 'my_gem.bundle'
 LoadError: .... (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')

Is the CPU type is not correctly detected?

Is there a way to force the rake-compiler to only build code that exactly matches the CPU architecture?

@kou
Copy link
Member

kou commented Dec 18, 2023

Could you share a sample project that reproduces this?

@tilo
Copy link
Author

tilo commented Dec 18, 2023

https://github.com/tilo/smarter_csv
when using Ruby 3.1.4 or Ruby 3.2.2 as arm64 executables, it breaks

$ file `which ruby `
    .rvm/rubies/ruby-3.1.4/bin/ruby: Mach-O 64-bit executable arm64

whereas when the Ruby executable is x86_64 it is not an issue:

$ file `which ruby `
     .rvm/rubies/ruby-3.0.0/bin/ruby: Mach-O 64-bit executable x86_64

Is there a way to tell the compiler to use uname -m as the target architecture,
or to match the architecture of the Ruby executable?

This does not seem to work:

$ find . -type f -name smarter_csv.bundle -exec rm {} \;
$ export ARCHFLAGS='-arch arm64'
$ rake compile
$ file ./lib/smarter_csv/smarter_csv.bundle
./lib/smarter_csv/smarter_csv.bundle: Mach-O 64-bit bundle x86_64

@kou
Copy link
Member

kou commented Dec 18, 2023

I couldn't reproduce this with Homebrew's Ruby:

$ PATH=$(brew --prefix ruby)/bin:$PATH ruby -v
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin22]
$ PATH=$(brew --prefix ruby)/bin:$PATH ruby -S rake compile
mkdir -p tmp/arm64-darwin22/smarter_csv/3.2.2
cd tmp/arm64-darwin22/smarter_csv/3.2.2
/opt/homebrew/opt/ruby/bin/ruby -I. ../../../../ext/smarter_csv/extconf.rb
creating Makefile
cd -
cd tmp/arm64-darwin22/smarter_csv/3.2.2
/usr/bin/make
compiling ../../../../ext/smarter_csv/smarter_csv.c
../../../../ext/smarter_csv/smarter_csv.c:42:8: warning: variable 'prev_char' set but not used [-Wunused-but-set-variable]
  char prev_char = '\0'; // Store the previous character for comparison against an escape character
       ^
1 warning generated.
linking shared-object smarter_csv/smarter_csv.bundle
ld: warning: -multiply_defined is obsolete
ld: warning: ignoring duplicate libraries: '-lruby.3.2'
cd -
mkdir -p tmp/arm64-darwin22/stage/lib/smarter_csv
/usr/bin/make install sitearchdir=../../../../lib/smarter_csv sitelibdir=../../../../lib/smarter_csv target_prefix=
/usr/bin/install -c -m 0755 smarter_csv.bundle ../../../../lib/smarter_csv
cp tmp/arm64-darwin22/smarter_csv/3.2.2/smarter_csv.bundle tmp/arm64-darwin22/stage/lib/smarter_csv/smarter_csv.bundle
$ file tmp/arm64-darwin22/smarter_csv/3.2.2/smarter_csv.bundle
tmp/arm64-darwin22/smarter_csv/3.2.2/smarter_csv.bundle: Mach-O 64-bit bundle arm64

Could you show full command line outputs like the above on your environment?

@tilo
Copy link
Author

tilo commented Dec 18, 2023

  • I installed Ruby via RVM
lapcat:smarter_csv tilo$ PATH=$(brew --prefix ruby)/bin:$PATH ruby -v
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin23]
lapcat:smarter_csv tilo$  PATH=$(brew --prefix ruby)/bin:$PATH ruby -S rake compile
/usr/local/bin/gmake install sitearchdir=../../../../lib/smarter_csv sitelibdir=../../../../lib/smarter_csv target_prefix=
/opt/homebrew/opt/coreutils/bin/ginstall -c -m 0755 smarter_csv.bundle ../../../../lib/smarter_csv
cp tmp/arm64-darwin23/smarter_csv/3.2.2/smarter_csv.bundle tmp/arm64-darwin23/stage/lib/smarter_csv/smarter_csv.bundle

 file tmp/arm64-darwin23/stage/lib/smarter_csv/smarter_csv.bundle
tmp/arm64-darwin23/stage/lib/smarter_csv/smarter_csv.bundle: Mach-O 64-bit bundle x86_64 😭 

-------
but I'm not using Ruby from homebrew, but RVM:

lapcat:smarter_csv tilo$ which ruby
/Users/tilo/.rvm/rubies/ruby-3.2.2/bin/ruby
lapcat:smarter_csv tilo$ file /Users/tilo/.rvm/rubies/ruby-3.2.2/bin/ruby
/Users/tilo/.rvm/rubies/ruby-3.2.2/bin/ruby: Mach-O 64-bit executable arm64
lapcat:smarter_csv tilo$ ruby -S rake compile
/usr/local/bin/gmake install sitearchdir=../../../../lib/smarter_csv sitelibdir=../../../../lib/smarter_csv target_prefix=
/opt/homebrew/opt/coreutils/bin/ginstall -c -m 0755 smarter_csv.bundle ../../../../lib/smarter_csv
cp tmp/arm64-darwin23/smarter_csv/3.2.2/smarter_csv.bundle tmp/arm64-darwin23/stage/lib/smarter_csv/smarter_csv.bundle
lapcat:smarter_csv tilo$ file tmp/arm64-darwin23/smarter_csv/3.2.2/smarter_csv.bundle
tmp/arm64-darwin23/smarter_csv/3.2.2/smarter_csv.bundle: Mach-O 64-bit bundle x86_64

------

lapcat:smarter_csv tilo$ mkdir -p tmp/arm64-darwin22/smarter_csv/3.2.2
lapcat:smarter_csv tilo$ cd tmp/arm64-darwin22/smarter_csv/3.2.2

lapcat:3.2.2 tilo$ which ruby
/Users/tilo/.rvm/rubies/ruby-3.2.2/bin/ruby
lapcat:3.2.2 tilo$ ruby -I. ../../../../ext/smarter_csv/extconf.rb
creating Makefile

-> this Makefile has `arch = arm64-darwin23` in it

cd -
cd tmp/arm64-darwin22/smarter_csv/3.2.2
lapcat:3.2.2 tilo$ /usr/bin/make
compiling ../../../../ext/smarter_csv/smarter_csv.c
../../../../ext/smarter_csv/smarter_csv.c:42:8: warning: variable 'prev_char' set but not used [-Wunused-but-set-variable]
  char prev_char = '\0'; // Store the previous character for comparison against an escape character
       ^
1 warning generated.
linking shared-object smarter_csv/smarter_csv.bundle
ld: warning: ignoring duplicate libraries: '-lruby.3.2'

$ file smarter_csv.bundle
smarter_csv.bundle: Mach-O 64-bit bundle arm64 🎉 

cd -
mkdir -p tmp/arm64-darwin22/stage/lib/smarter_csv

lapcat:smarter_csv tilo$ file  tmp/arm64-darwin22/smarter_csv/3.2.2/smarter_csv.o
tmp/arm64-darwin22/smarter_csv/3.2.2/smarter_csv.o: Mach-O 64-bit object arm64
lapcat:smarter_csv tilo$ file  tmp/arm64-darwin22/smarter_csv/3.2.2/smarter_csv.bundle
tmp/arm64-darwin22/smarter_csv/3.2.2/smarter_csv.bundle: Mach-O 64-bit bundle arm64

/usr/bin/make install sitearchdir=../../../../lib/smarter_csv sitelibdir=../../../../lib/smarter_csv target_prefix=
/usr/bin/install -c -m 0755 smarter_csv.bundle ../../../../lib/smarter_csv
invalid option -- c

$ /usr/bin/make install sitearchdir=../../../../lib/smarter_csv sitelibdir=../../../../lib/smarter_csv target_prefix=/usr/bin/install  -m 0755 smarter_csv.bundle ../../../../lib/smarter_csv
make: *** No rule to make target `install'.  Stop.



lapcat:smarter_csv tilo$ cp tmp/arm64-darwin22/smarter_csv/3.2.2/smarter_csv.bundle  tmp/arm64-darwin22/stage/lib/smarter_csv/smarter_csv.bundle
lapcat:smarter_csv tilo$ file tmp/arm64-darwin22/smarter_csv/3.2.2/smarter_csv.bundle
tmp/arm64-darwin22/smarter_csv/3.2.2/smarter_csv.bundle: Mach-O 64-bit bundle arm64

$ grep rake-compiler Gemfile.lock
    rake-compiler (1.2.5)

@kou
Copy link
Member

kou commented Dec 18, 2023

Is this a RVM problem?

@tilo
Copy link
Author

tilo commented Dec 18, 2023

I'm not sure how.. this is what I get from the RVM Ruby:

lapcat:smarter_csv tilo$ which ruby
/Users/tilo/.rvm/rubies/ruby-3.2.2/bin/ruby
lapcat:smarter_csv tilo$ file /Users/tilo/.rvm/rubies/ruby-3.2.2/bin/ruby
/Users/tilo/.rvm/rubies/ruby-3.2.2/bin/ruby: Mach-O 64-bit executable arm64
lapcat:smarter_csv tilo$ ruby -S rake compile
/usr/local/bin/gmake install sitearchdir=../../../../lib/smarter_csv sitelibdir=../../../../lib/smarter_csv target_prefix=
/opt/homebrew/opt/coreutils/bin/ginstall -c -m 0755 smarter_csv.bundle ../../../../lib/smarter_csv
cp tmp/arm64-darwin23/smarter_csv/3.2.2/smarter_csv.bundle tmp/arm64-darwin23/stage/lib/smarter_csv/smarter_csv.bundle
lapcat:smarter_csv tilo$ file tmp/arm64-darwin23/smarter_csv/3.2.2/smarter_csv.bundle
tmp/arm64-darwin23/smarter_csv/3.2.2/smarter_csv.bundle: Mach-O 64-bit bundle x86_64

@kou
Copy link
Member

kou commented Dec 18, 2023

Could you run ruby -S rake clean before ruby -S rake compile?

@tilo
Copy link
Author

tilo commented Dec 18, 2023

same

lapcat:smarter_csv tilo$ ruby -S rake clean
lapcat:smarter_csv tilo$ ruby -S rake compile
mkdir -p tmp/arm64-darwin23/smarter_csv/3.2.2
cd tmp/arm64-darwin23/smarter_csv/3.2.2
/Users/tilo/.rvm/rubies/ruby-3.2.2/bin/ruby -I. ../../../../ext/smarter_csv/extconf.rb
creating Makefile
cd -
cd tmp/arm64-darwin23/smarter_csv/3.2.2
/usr/local/bin/gmake
compiling ../../../../ext/smarter_csv/smarter_csv.c
../../../../ext/smarter_csv/smarter_csv.c:42:8: warning: variable 'prev_char' set but not used [-Wunused-but-set-variable]
  char prev_char = '\0'; // Store the previous character for comparison against an escape character
       ^
1 warning generated.
linking shared-object smarter_csv/smarter_csv.bundle
ld: warning: ignoring duplicate libraries: '-lruby.3.2'
ld: warning: ignoring file '/Users/tilo/.rvm/rubies/ruby-3.2.2/lib/libruby.3.2.dylib': found architecture 'arm64', required architecture 'x86_64'
cd -
mkdir -p tmp/arm64-darwin23/stage/lib/smarter_csv
/usr/local/bin/gmake install sitearchdir=../../../../lib/smarter_csv sitelibdir=../../../../lib/smarter_csv target_prefix=
/opt/homebrew/opt/coreutils/bin/ginstall -c -m 0755 smarter_csv.bundle ../../../../lib/smarter_csv
cp tmp/arm64-darwin23/smarter_csv/3.2.2/smarter_csv.bundle tmp/arm64-darwin23/stage/lib/smarter_csv/smarter_csv.bundle
lapcat:smarter_csv tilo$ file tmp/arm64-darwin23/smarter_csv/3.2.2/smarter_csv.bundle
tmp/arm64-darwin23/smarter_csv/3.2.2/smarter_csv.bundle: Mach-O 64-bit bundle x86_64

and after compilation:

lapcat:smarter_csv tilo$ find . -type f -name Makefile
./tmp/arm64-darwin23/smarter_csv/3.2.2/Makefile
lapcat:smarter_csv tilo$ grep arm64 ./tmp/arm64-darwin23/smarter_csv/3.2.2/Makefile
arch_hdrdir = /Users/tilo/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/arm64-darwin23
arch = arm64-darwin23

😮

but

$ file tmp/arm64-darwin23/stage/lib/smarter_csv/smarter_csv.bundle
tmp/arm64-darwin23/stage/lib/smarter_csv/smarter_csv.bundle: Mach-O 64-bit bundle x86_64

😮

@kou
Copy link
Member

kou commented Dec 18, 2023

Could you attach ./tmp/arm64-darwin23/smarter_csv/3.2.2/Makefile?

@tilo
Copy link
Author

tilo commented Dec 18, 2023

yes!
btw. the .o file is also x86_64

$ file tmp/arm64-darwin23/smarter_csv/3.2.2/smarter_csv.o
tmp/arm64-darwin23/smarter_csv/3.2.2/smarter_csv.o: Mach-O 64-bit object x86_64

lapcat:smarter_csv tilo$ file /usr/bin/gcc
/usr/bin/gcc: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64e:Mach-O 64-bit executable arm64e]
/usr/bin/gcc (for architecture x86_64): Mach-O 64-bit executable x86_64
/usr/bin/gcc (for architecture arm64e): Mach-O 64-bit executable arm64e
lapcat:smarter_csv tilo$ file `which ld`
/usr/bin/ld: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64e:Mach-O 64-bit executable arm64e]
/usr/bin/ld (for architecture x86_64):  Mach-O 64-bit executable x86_64
/usr/bin/ld (for architecture arm64e):  Mach-O 64-bit executable arm64e

@tilo
Copy link
Author

tilo commented Dec 18, 2023

Makefile.txt

@kou
Copy link
Member

kou commented Dec 18, 2023

Could you show gcc --version?

@tilo
Copy link
Author

tilo commented Dec 18, 2023

I was just looking at the same thing

$ gcc -v
Apple clang version 15.0.0 (clang-1500.1.0.2.5)
Target: arm64-apple-darwin23.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
lapcat:smarter_csv tilo$ clang -v
Apple clang version 15.0.0 (clang-1500.1.0.2.5)
Target: arm64-apple-darwin23.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

$ ld -v
@(#)PROGRAM:ld  PROJECT:dyld-1022.1
BUILD 13:21:42 Nov 10 2023
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h
will use ld-classic for: armv6 armv7 armv7s arm64_32 i386 armv6m armv7k armv7m armv7em
LTO support using: LLVM version 15.0.0 (static support for 29, runtime is 29)
TAPI support using: Apple TAPI version 15.0.0 (tapi-1500.0.12.8)
Library search paths:
Framework search paths:

@kou
Copy link
Member

kou commented Dec 18, 2023

ruby -r rbconfig -e 'pp RbConfig::CONFIG'

@tilo
Copy link
Author

tilo commented Dec 18, 2023

ruby_config.txt

@kou
Copy link
Member

kou commented Dec 18, 2023

Hmm... I don't know why...

Could you try echo 'int add(int x, int y) {return x + y;}' > a.c && gcc -shared -o a.bundle a.c && file a.bundle?

@tilo
Copy link
Author

tilo commented Dec 18, 2023

$ echo 'int add(int x, int y) {return x + y;}' > a.c && gcc -shared -o a.bundle a.c && file a.bundle
a.bundle: Mach-O 64-bit dynamically linked shared library arm64

bizarre... what would override the architecture?

@kou
Copy link
Member

kou commented Dec 18, 2023

$ cd tmp/arm64-darwin23/smarter_csv/3.2.2
$ /usr/local/bin/gmake clean
$ /usr/local/bin/gmake V=1

@tilo
Copy link
Author

tilo commented Dec 18, 2023

gcc -I. -I/Users/tilo/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/arm64-darwin23 -I/Users/tilo/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby/backward -I/Users/tilo/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0 -I../../../../ext/smarter_csv -I/opt/homebrew/Cellar/openssl@1.1/1.1.1m/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -fno-common -O3 -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl@1.1/include -fdeclspec -O3 -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -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 -Wundef -fno-common -pipe  -o smarter_csv.o -c ../../../../ext/smarter_csv/smarter_csv.c
../../../../ext/smarter_csv/smarter_csv.c:42:8: warning: variable 'prev_char' set but not used [-Wunused-but-set-variable]
  char prev_char = '\0'; // Store the previous character for comparison against an escape character
       ^
1 warning generated.
rm -f smarter_csv.bundle
gcc -dynamic -bundle -o smarter_csv.bundle smarter_csv.o -L. -L/Users/tilo/.rvm/rubies/ruby-3.2.2/lib -L. -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib -fstack-protector-strong -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib -Wl,-undefined,dynamic_lookup -lruby.3.2   -lruby.3.2  -lpthread
ld: warning: ignoring duplicate libraries: '-lruby.3.2'
ld: warning: ignoring file '/Users/tilo/.rvm/rubies/ruby-3.2.2/lib/libruby.3.2.dylib': found architecture 'arm64', required architecture 'x86_64'

😮

@tilo
Copy link
Author

tilo commented Dec 18, 2023

required architecture 'x86_64'

how did it decide that?

@kou
Copy link
Member

kou commented Dec 18, 2023

Could you try the following?

echo 'int add(int x, int y) {return x + y;}' > a.c && gcc -I. -I/Users/tilo/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/arm64-darwin23 -I/Users/tilo/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby/backward -I/Users/tilo/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0 -I/opt/homebrew/Cellar/openssl@1.1/1.1.1m/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fno-common -O3 -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl@1.1/include -fdeclspec -O3 -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -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 -Wundef -fno-common -pipe -o a.o -c a.c && file a.o

@tilo
Copy link
Author

tilo commented Dec 21, 2023

lapcat:smarter_csv tilo$ echo 'int add(int x, int y) {return x + y;}' > a.c && gcc -I. -I/Users/tilo/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/arm64-darwin23 -I/Users/tilo/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby/backward -I/Users/tilo/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0 -I/opt/homebrew/Cellar/openssl@1.1/1.1.1m/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fno-common -O3 -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl@1.1/include -fdeclspec -O3 -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -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 -Wundef -fno-common -pipe -o a.o -c a.c && file a.o
a.o: Mach-O 64-bit object arm64

@kou
Copy link
Member

kou commented Dec 21, 2023

Wow!

(echo '#include <ruby.h>'; echo 'int add(int x, int y) {return x + y;}') > a.c && gcc -I. -I/Users/tilo/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/arm64-darwin23 -I/Users/tilo/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby/backward -I/Users/tilo/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0 -I/opt/homebrew/Cellar/openssl@1.1/1.1.1m/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fno-common -O3 -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl@1.1/include -fdeclspec -O3 -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -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 -Wundef -fno-common -pipe -o a.o -c a.c && file a.o

@tilo
Copy link
Author

tilo commented Dec 21, 2023

$ (echo '#include <ruby.h>'; echo 'int add(int x, int y) {return x + y;}') > a.c && gcc -I. -I/Users/tilo/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/arm64-darwin23 -I/Users/tilo/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby/backward -I/Users/tilo/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0 -I/opt/homebrew/Cellar/openssl@1.1/1.1.1m/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -fno-common -O3 -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl@1.1/include -fdeclspec -O3 -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -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 -Wundef -fno-common -pipe  -o a.o -c a.c && file a.o
a.o: Mach-O 64-bit object arm64

@kou
Copy link
Member

kou commented Dec 22, 2023

Oh... It's a mystery...
I can't look into this without reproducible environment. Sorry...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants