TaKO8Ki/frum

Ruby 2.6.4 and Ruby 2.7.0 build failure on M1 Mac cases two test failures

chikoski opened this issue ยท 12 comments

Summary:

Ruby 2.6.4 and Ruby 2.7.0 can not be build on M1 Mac. These build failures make the following two tests failed:

  • commands::install::tests::test_install_default_version
  • commands::install::tests::test_install_second_version

Steps reproduce:

  1. Try to install each version, i.e. 2.6.4 and 2.7.0, and confirm that build failure happens on both versions.
  2. Run cargo test commands::install::tests::test_install_default_version
  3. Run cargo test commands::install::tests::test_install_second_version

Note: I confirmed build failure happens with rvm command

Expected result:

Pass the both test cases.

Actual result:

The both test cases fail.

Thank you for opening the issue! If you have time, could you run either or both frum install 2.6.4 and frum install 2.7.0 in your M1 Mac and add the error you get to the issue?

Yes. I tried both commands on my M1 Mac, and found build failures happened.

Additionally, did you try building Ruby with rbenv in your M1 Mac? If so, did you succeed in it?

I could not build the both version with rbenv, either.
Note: I could install 3.0.2 with frum, rvm, and rbenv.

Found the following error in the log file for 2.6.4 as well as 2.7.0:

closure.c:264:14: error: implicit declaration of function 'ffi_prep_closure' is invalid in C99 [-Werror,-Wimplicit-func
    result = ffi_prep_closure(pcl, cif, callback, (void *)self);

Let me share y environment:

  • MacBook Air (M1, 2020)
  • Apple M1
  • Memory 8G
  • macOS Big Sur version 11.5.2

I'll fix it when I have a time.
ref: ffi/ffi#869

yerke commented

I was running into a potentially similar issue today when installing Ruby 2.5.0 on M1 with rvm.
In the end it was fixed with:

export optflags="-Wno-error=implicit-function-declaration"
rvm install 2.5.0

I took it from https://stackoverflow.com/questions/65325136/problem-when-installing-ruby-2-2-9-on-mac-big-sur-m1

I hope it helps in some way.

synth commented

export optflags="-Wno-error=implicit-function-declaration"

This worked for me with frum!

export optflags="-Wno-error=implicit-function-declaration"
frum install 2.7.0
p19ky commented

frum install 2.6.4 is also failing on m1 pro macos ventura 13.0.1 :(((

same issue here, Mac OS Ventura 13.1, Macbook Pro with M1 Pro chip.

frum install 3.1.0
==> Downloading https://cache.ruby-lang.org/pub/ruby/3.1/ruby-3.1.0.tar.xz
==> Extracting ruby-3.1.0.tar.xz
==> Building Ruby 3.1.0
error: Can't build Ruby: make failed: . ./vm_opts.h
libffi_version: 3.4.0
Undefined symbols for architecture arm64:
"_rb_enc_set_base", referenced from:
_Init_encdb in encdb.o
"_rb_enc_set_dummy", referenced from:
_Init_encdb in encdb.o
"_rb_encdb_alias", referenced from:
_Init_encdb in encdb.o
"_rb_encdb_declare", referenced from:
_Init_encdb in encdb.o
"_rb_encdb_dummy", referenced from:
_Init_encdb in encdb.o
"_rb_encdb_replicate", referenced from:
_Init_encdb in encdb.o
"_rb_encdb_set_unicode", referenced from:
_Init_encdb in encdb.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [.ext/arm64-darwin22/enc/encdb.bundle] Error 1
make: *** [enc] Error 2
make: *** Waiting for unfinished jobs....
Undefined symbols for architecture arm64:
"_rb_declare_transcoder", referenced from:
_Init_transdb in transdb.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [.ext/arm64-darwin22/enc/trans/transdb.bundle] Error 1
make: *** [trans] Error 2

I had the same issue as @stellorior with macOS Ventura.

I was able to install by adding the --enable-shared flag:

frum install 2.7.6 --enable-shared

See also: https://bugs.ruby-lang.org/issues/19422