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

An error occurred while installing ffi (1.16.3) #1058

Open
g-liu-pp opened this issue Oct 4, 2023 · 9 comments
Open

An error occurred while installing ffi (1.16.3) #1058

g-liu-pp opened this issue Oct 4, 2023 · 9 comments

Comments

@g-liu-pp
Copy link

g-liu-pp commented Oct 4, 2023

An error occurred while installing ffi (1.16.3), and Bundler cannot
continue.
Make sure that `gem install ffi -v '1.16.3' --source 'https://rubygems.org/'`
succeeds before bundling.
@g-liu-pp
Copy link
Author

g-liu-pp commented Oct 4, 2023

Building native extensions. This could take a while...
ERROR:  Error installing ffi:
	ERROR: Failed to build gem native extension.

    current directory: /Users/geoff/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/ffi-1.16.3/ext/ffi_c
/Users/geoff/.rbenv/versions/2.6.6/bin/ruby -I /Users/geoff/.rbenv/versions/2.6.6/lib/ruby/2.6.0 -r ./siteconf20231004-11876-ievau9.rb extconf.rb
checking for ffi_prep_closure_loc() in -lffi... no
checking for ffi_prep_closure_loc() in -llibffi... no
checking for ffi_prep_closure_loc() in -llibffi-8... no
checking for whether -Wl,--exclude-libs,ALL is accepted as LDFLAGS... no
checking for rb_gc_mark_movable()... no
checking for whether -pthread is accepted as LDFLAGS... yes
creating extconf.h
creating Makefile

current directory: /Users/geoff/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/ffi-1.16.3/ext/ffi_c
make "DESTDIR=" clean

current directory: /Users/geoff/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/ffi-1.16.3/ext/ffi_c
make "DESTDIR="
Configuring libffi
clang: error: unsupported option '-print-multi-os-directory'
clang: error: no input files
cd "/Users/geoff/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/ffi-1.16.3/ext/ffi_c/libffi--darwin21" && /Applications/Xcode 14.2.app/Contents/Developer/usr/bin/make
/bin/sh: /Applications/Xcode: No such file or directory
make: *** ["/Users/geoff/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/ffi-1.16.3/ext/ffi_c/libffi--darwin21"/.libs/libffi_convenience.a] Error 127

make failed, exit code 2

Gem files will remain installed in /Users/geoff/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/ffi-1.16.3 for inspection.
Results logged to /Users/geoff/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/extensions/-darwin-21/2.6.0/ffi-1.16.3/gem_make.out

@samdeane
Copy link

samdeane commented Oct 5, 2023

I had a similar problem. In my case the native extension wouldn't build, seemingly because it couldn't find ffi.h and/or had the wrong SDK path.

I was using XCode 15.0 at the time - switching back to Xcode 14.3.1 solved it. Not ideal as a long-term fix, but might help you out of a hole...

@kerrmarin-lvmh
Copy link

Make sure you have Xcode installed in /Applications/Xcode and haven't renamed it to something else (common if you have 2 Xcodes for a while...)

@Bruce-7
Copy link

Bruce-7 commented Nov 1, 2023

Building native extensions. This could take a while...
ERROR:  Error installing ffi:
	ERROR: Failed to build gem native extension.

    current directory: /Users/geoff/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/ffi-1.16.3/ext/ffi_c
/Users/geoff/.rbenv/versions/2.6.6/bin/ruby -I /Users/geoff/.rbenv/versions/2.6.6/lib/ruby/2.6.0 -r ./siteconf20231004-11876-ievau9.rb extconf.rb
checking for ffi_prep_closure_loc() in -lffi... no
checking for ffi_prep_closure_loc() in -llibffi... no
checking for ffi_prep_closure_loc() in -llibffi-8... no
checking for whether -Wl,--exclude-libs,ALL is accepted as LDFLAGS... no
checking for rb_gc_mark_movable()... no
checking for whether -pthread is accepted as LDFLAGS... yes
creating extconf.h
creating Makefile

current directory: /Users/geoff/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/ffi-1.16.3/ext/ffi_c
make "DESTDIR=" clean

current directory: /Users/geoff/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/ffi-1.16.3/ext/ffi_c
make "DESTDIR="
Configuring libffi
clang: error: unsupported option '-print-multi-os-directory'
clang: error: no input files
cd "/Users/geoff/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/ffi-1.16.3/ext/ffi_c/libffi--darwin21" && /Applications/Xcode 14.2.app/Contents/Developer/usr/bin/make
/bin/sh: /Applications/Xcode: No such file or directory
make: *** ["/Users/geoff/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/ffi-1.16.3/ext/ffi_c/libffi--darwin21"/.libs/libffi_convenience.a] Error 127

make failed, exit code 2

Gem files will remain installed in /Users/geoff/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/ffi-1.16.3 for inspection.
Results logged to /Users/geoff/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/extensions/-darwin-21/2.6.0/ffi-1.16.3/gem_make.out

solution:

brew uninstall --ignore-dependencies pkg-config
brew install pkg-config

sudo gem install ffi

@ppamorim
Copy link

ppamorim commented Nov 8, 2023

Building native extensions. This could take a while...
ERROR:  Error installing ffi:
	ERROR: Failed to build gem native extension.

    current directory: /Users/geoff/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/ffi-1.16.3/ext/ffi_c
/Users/geoff/.rbenv/versions/2.6.6/bin/ruby -I /Users/geoff/.rbenv/versions/2.6.6/lib/ruby/2.6.0 -r ./siteconf20231004-11876-ievau9.rb extconf.rb
checking for ffi_prep_closure_loc() in -lffi... no
checking for ffi_prep_closure_loc() in -llibffi... no
checking for ffi_prep_closure_loc() in -llibffi-8... no
checking for whether -Wl,--exclude-libs,ALL is accepted as LDFLAGS... no
checking for rb_gc_mark_movable()... no
checking for whether -pthread is accepted as LDFLAGS... yes
creating extconf.h
creating Makefile

current directory: /Users/geoff/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/ffi-1.16.3/ext/ffi_c
make "DESTDIR=" clean

current directory: /Users/geoff/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/ffi-1.16.3/ext/ffi_c
make "DESTDIR="
Configuring libffi
clang: error: unsupported option '-print-multi-os-directory'
clang: error: no input files
cd "/Users/geoff/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/ffi-1.16.3/ext/ffi_c/libffi--darwin21" && /Applications/Xcode 14.2.app/Contents/Developer/usr/bin/make
/bin/sh: /Applications/Xcode: No such file or directory
make: *** ["/Users/geoff/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/ffi-1.16.3/ext/ffi_c/libffi--darwin21"/.libs/libffi_convenience.a] Error 127

make failed, exit code 2

Gem files will remain installed in /Users/geoff/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/ffi-1.16.3 for inspection.
Results logged to /Users/geoff/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/extensions/-darwin-21/2.6.0/ffi-1.16.3/gem_make.out

solution:

brew uninstall --ignore-dependencies pkg-config
brew install pkg-config

sudo gem install ffi

This is unfortunately not working for me. The issue persists.

@kerrmarin-lvmh
Copy link

kerrmarin-lvmh commented Dec 9, 2023

Building native extensions. This could take a while...
ERROR:  Error installing ffi:
	ERROR: Failed to build gem native extension.

    current directory: /Users/geoff/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/ffi-1.16.3/ext/ffi_c
/Users/geoff/.rbenv/versions/2.6.6/bin/ruby -I /Users/geoff/.rbenv/versions/2.6.6/lib/ruby/2.6.0 -r ./siteconf20231004-11876-ievau9.rb extconf.rb
checking for ffi_prep_closure_loc() in -lffi... no
checking for ffi_prep_closure_loc() in -llibffi... no
checking for ffi_prep_closure_loc() in -llibffi-8... no
checking for whether -Wl,--exclude-libs,ALL is accepted as LDFLAGS... no
checking for rb_gc_mark_movable()... no
checking for whether -pthread is accepted as LDFLAGS... yes
creating extconf.h
creating Makefile

current directory: /Users/geoff/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/ffi-1.16.3/ext/ffi_c
make "DESTDIR=" clean

current directory: /Users/geoff/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/ffi-1.16.3/ext/ffi_c
make "DESTDIR="
Configuring libffi
clang: error: unsupported option '-print-multi-os-directory'
clang: error: no input files
cd "/Users/geoff/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/ffi-1.16.3/ext/ffi_c/libffi--darwin21" && /Applications/Xcode 14.2.app/Contents/Developer/usr/bin/make
/bin/sh: /Applications/Xcode: No such file or directory
make: *** ["/Users/geoff/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/ffi-1.16.3/ext/ffi_c/libffi--darwin21"/.libs/libffi_convenience.a] Error 127

make failed, exit code 2

Gem files will remain installed in /Users/geoff/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/ffi-1.16.3 for inspection.
Results logged to /Users/geoff/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/extensions/-darwin-21/2.6.0/ffi-1.16.3/gem_make.out

solution:

brew uninstall --ignore-dependencies pkg-config
brew install pkg-config

sudo gem install ffi

This is unfortunately not working for me. The issue persists.

Your problem: /bin/sh: /Applications/Xcode: No such file or directory - make sure Xcode is installed and is in that directory.

@samdeane
Copy link

Your problem: /bin/sh: /Applications/Xcode: No such file or directory - make sure Xcode is installed and is in that directory.

Is there a separate ticket to fix this? Assuming that Xcode is at /Applications/Xcode.app is not a legitimate or reliable thing to do.

@brettcurtis
Copy link

In case anyone stumbles onto this issue like I did, in my case, I was installing this on the Terraform docker image based on Alpine Linux. I had to add libffi-dev package.

@krisleech
Copy link

on linux (alpine) after installing libffi-dev I get a different error: fatal error: linux/limits.h: No such file or directory 55 | #include <linux/limits.h> 🤔

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

7 participants