frum icon indicating copy to clipboard operation
frum copied to clipboard

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

Open chikoski opened this issue 2 years ago • 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.

chikoski avatar Aug 29 '21 01:08 chikoski

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?

TaKO8Ki avatar Aug 29 '21 03:08 TaKO8Ki

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

chikoski avatar Aug 29 '21 03:08 chikoski

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

TaKO8Ki avatar Aug 29 '21 03:08 TaKO8Ki

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);

chikoski avatar Aug 29 '21 05:08 chikoski

Let me share y environment:

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

chikoski avatar Aug 29 '21 05:08 chikoski

I'll fix it when I have a time. ref: https://github.com/ffi/ffi/issues/869

TaKO8Ki avatar Sep 02 '21 11:09 TaKO8Ki

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.

yerke avatar Jan 27 '22 07:01 yerke

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

This worked for me with frum!

synth avatar Mar 26 '22 02:03 synth

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

a-r-db avatar Aug 05 '22 13:08 a-r-db

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

p19ky avatar Nov 29 '22 22:11 p19ky

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

stellorior avatar Jan 28 '23 14:01 stellorior

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

jwoyame avatar Feb 24 '23 01:02 jwoyame