TaKO8Ki / frum

A little bit fast and modern Ruby version manager written in Rust
MIT License
628 stars 15 forks source link

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

Open chikoski opened 2 years ago

chikoski commented 2 years ago

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:

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.

TaKO8Ki commented 2 years ago

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?

chikoski commented 2 years ago

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

TaKO8Ki commented 2 years ago

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

chikoski commented 2 years ago

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 commented 2 years ago

Let me share y environment:

TaKO8Ki commented 2 years ago

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

yerke commented 2 years ago

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 2 years ago

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

This worked for me with frum!

a-r-db commented 2 years ago
export optflags="-Wno-error=implicit-function-declaration"
frum install 2.7.0
p19ky commented 1 year ago

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

stellorior commented 1 year ago

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

jwoyame commented 1 year ago

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