When I try to install cocoapods on my mac using sudo cmd, i.e "sudo gem install cocoapods".
It shows Failed to build gem native extension.
How to install cocoapods on mac,
xxx-MacMini1 ~ % sudo gem install cocoapods
Password:
Building native extensions. This could take a while...
ERROR: Error installing cocoapods:
ERROR: Failed to build gem native extension.
current directory: /usr/local/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c
/usr/local/opt/ruby#2.7/bin/ruby -I /usr/local/Cellar/ruby#2.7/2.7.5/lib/ruby/2.7.0 -r ./siteconf20220318-18160-1id5gxj.rb extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include,/usr/include/ffi,/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/ffi,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ffi... yes
checking for ffi_prep_closure_loc() in -lffi... yes
checking for ffi_prep_cif_var()... yes
checking for ffi_raw_call()... yes
checking for ffi_prep_raw_closure()... yes
checking for whether -pthread is accepted as LDFLAGS... yes
creating extconf.h
creating Makefile
current directory: /usr/local/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c
make DESTDIR\= clean
current directory: /usr/local/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c
make DESTDIR\=
compiling AbstractMemory.c
compiling ArrayType.c
compiling Buffer.c
compiling Call.c
compiling ClosurePool.c
compiling DynamicLibrary.c
compiling Function.c
Function.c:867:17: error: implicit declaration of function 'ffi_prep_closure_loc' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
ffiStatus = ffi_prep_closure_loc(closure->pcl, &fnInfo->ffi_cif, callback_invoke, closure, code);
^
Function.c:867:17: note: did you mean 'ffi_prep_closure'?
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/ffi/ffi.h:269:1: note: 'ffi_prep_closure' declared here
ffi_prep_closure(
^
1 error generated.
make: *** [Function.o] Error 1
make failed, exit code 2
Gem files will remain installed in /usr/local/lib/ruby/gems/2.7.0/gems/ffi-1.15.5 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.7.0/extensions/x86_64-darwin-19/2.7.0/ffi-1.15.5/gem_make.out
How do I fix this issue?
Looks like you have a Ruby issue. Try installing version 2.6.3 using:
sudo gem install cocoapods -v 2.6.3
and then try to run sudo gem install cocoapods. If this didn't work, try the following:
Open terminal and run
curl -L https://get.rvm.io | bash -s stable
Then
rvm install ruby-2.6
This would install the ruby for you if its not yet installed. After this just update ruby to the new version using
rvm use ruby-2.6.3
Make ruby 2.6.3 your default
rvm --default use 2.6.3
Then hopefully you can run
sudo gem install cocoapods
Related
Trying to deploy Rails app onUbuntu 20 is impossible to install pg, and any attempt to bundle will incur in errors
$ gem install pg
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
current directory: /home/user/.rvm/gems/ruby-2.6.1/gems/pg-1.2.3/ext
/home/user/.rvm/rubies/ruby-2.6.1/bin/ruby -I /home/user/.rvm/rubies/ruby-2.6.1/lib/ruby/site_ruby/2.6.0 -r ./siteconf20210417-119158-37ke72.rb extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... yes
checking for PQsetSingleRowMode()... yes
checking for PQconninfo()... yes
checking for PQsslAttribute()... yes
checking for PQresultVerboseErrorMessage()... yes
checking for PQencryptPasswordConn()... yes
checking for PQresultMemorySize()... yes
checking for timegm()... yes
checking for rb_gc_adjust_memory_usage()... yes
checking for unistd.h... yes
checking for inttypes.h... yes
checking for C99 variable length arrays... yes
creating extconf.h
creating Makefile
current directory: /home/user/.rvm/gems/ruby-2.6.1/gems/pg-1.2.3/ext
make "DESTDIR=" clean
current directory: /home/user/.rvm/gems/ruby-2.6.1/gems/pg-1.2.3/ext
make "DESTDIR="
compiling gvl_wrappers.c
compiling pg.c
compiling pg_binary_decoder.c
compiling pg_binary_encoder.c
compiling pg_coder.c
compiling pg_connection.c
compiling pg_copy_coder.c
compiling pg_errors.c
compiling pg_record_coder.c
compiling pg_result.c
compiling pg_text_decoder.c
compiling pg_text_encoder.c
compiling pg_tuple.c
compiling pg_type_map.c
compiling pg_type_map_all_strings.c
compiling pg_type_map_by_class.c
compiling pg_type_map_by_column.c
compiling pg_type_map_by_mri_type.c
compiling pg_type_map_by_oid.c
compiling pg_type_map_in_ruby.c
compiling pg_util.c
linking shared-object pg_ext.so
current directory: /home/user/.rvm/gems/ruby-2.6.1/gems/pg-1.2.3/ext
make "DESTDIR=" install
make: /usr/bin/mkdir: Command not found
make: *** [Makefile:201: .sitearchdir.time] Error 127
make install failed, exit code 2
Gem files will remain installed in /home/user/.rvm/gems/ruby-2.6.1/gems/pg-1.2.3 for inspection.
Results logged to /home/user/.rvm/gems/ruby-2.6.1/extensions/x86_64-linux/2.6.0/pg-1.2.3/gem_make.out
on bundle install nothing seem to work:
An error occurred while installing bcrypt (3.1.16), and Bundler cannot continue.
Make sure that gem install bcrypt -v '3.1.16' --source 'https://rubygems.org/' succeeds before bundling.
In Gemfile:
bcrypt
An error occurred while installing nio4r (2.5.7), and Bundler cannot continue.
Make sure that gem install nio4r -v '2.5.7' --source 'https://rubygems.org/' succeeds before bundling.
In Gemfile:
rails was resolved to 6.1.3.1, which depends on
actioncable was resolved to 6.1.3.1, which depends on
nio4r
An error occurred while installing racc (1.5.2), and Bundler cannot continue.
Make sure that gem install racc -v '1.5.2' --source 'https://rubygems.org/' succeeds before bundling.
Nothing seems to work and there is not useful information on how to solve problem
make: /usr/bin/mkdir: Command not found it's the reason.
Please write this command with sudo perm.
sudo ln -s $(which mkdir) /usr/bin/mkdir
And try again bundle.
This happens because you need install the following packages that the pg gem requires:
sudo apt install postgresql postgresql-contrib libpq-dev
Then configure postgres and verify is running.
My project has ruby 2.6.5, rails 6 and when i tried to run bundle install, bcrypt gem is not installing. I tried sudo apt-get install ruby-dev and sudo apt-get install build-essential commands to resolve the issue and they were not helpful.
Any one can help on this ?
Below is log for it.
Fetching bcrypt-3.1.11.gem
Building native extensions. This could take a while...
ERROR: Error installing bcrypt:
ERROR: Failed to build gem native extension.
current directory: /home/mahesh/.rvm/gems/ruby-2.6.5/gems/bcrypt-3.1.11/ext/mri
/home/mahesh/.rvm/rubies/ruby-2.6.5/bin/ruby -I /home/mahesh/.rvm/rubies/ruby-
2.6.5/lib/ruby/site_ruby/2.6.0 -r ./siteconf20210222-10360-1tmu5r0.rb extconf.rb
creating Makefile
current directory: /home/mahesh/.rvm/gems/ruby-2.6.5/gems/bcrypt-3.1.11/ext/mri
make "DESTDIR=" clean
current directory: /home/mahesh/.rvm/gems/ruby-2.6.5/gems/bcrypt-3.1.11/ext/mri
make "DESTDIR="
compiling bcrypt_ext.c
compiling crypt.c
compiling crypt_blowfish.c
compiling crypt_gensalt.c
compiling wrapper.c
linking shared-object bcrypt_ext.so
current directory: /home/mahesh/.rvm/gems/ruby-2.6.5/gems/bcrypt-3.1.11/ext/mri
make "DESTDIR=" install
make: /usr/bin/mkdir: Command not found
make: *** [Makefile:202: .sitearchdir.time] Error 127
make install failed, exit code 2
Gem files will remain installed in /home/mahesh/.rvm/gems/ruby-2.6.5/gems/bcrypt-3.1.11 for
inspection.
Results logged to /home/mahesh/.rvm/gems/ruby-2.6.5/extensions/x86_64-linux/2.6.0/bcrypt-
3.1.11/gem_make.out
The package looks for /usr/bin/mkdir but on a Debian based system the correct path is /bin/mkdir. Op solved the problem by creating a symlink. It would be better to fix the installer.
I am trying to run a bundler install on vscode for windows, but every time I do, I keep getting the same message:
Fetching gem metadata from https://rubygems.org/.......
Resolving dependencies...
Using bundler 2.1.4
Fetching byebug 11.1.3
Installing byebug 11.1.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3/ext/byebug
/home/chadcunn/.rbenv/versions/2.7.1/bin/ruby -I /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/2.7.0 -r ./siteconf20200718-7409-qq2a6i.rb extconf.rb
creating Makefile
current directory: /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3/ext/byebug
make "DESTDIR=" clean
current directory: /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3/ext/byebug
make "DESTDIR="
compiling breakpoint.c
compiling byebug.c
compiling context.c
compiling locker.c
compiling threads.c
linking shared-object byebug/byebug.so
current directory: /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3/ext/byebug
make "DESTDIR=" install
/usr/bin/install -c -m 0755 byebug.so ./.gem.20200718-7409-z7mdim/byebug
Permission denied # rb_file_s_rename - (./.gem.20200718-7409-z7mdim/byebug,
/home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/byebug-11.1.3/byebug)
Gem files will remain installed in /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3 for inspection.
Results logged to /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/byebug-11.1.3/gem_make.out
An error occurred while installing byebug (11.1.3), and Bundler cannot continue.
Make sure that `gem install byebug -v '11.1.3' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
byebug
And then when I try to see if gem install byebug succeeds i get this response:
Building native extensions. This could take a while...
ERROR: Error installing byebug:
ERROR: Failed to build gem native extension.
current directory: /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3/ext/byebug
/home/chadcunn/.rbenv/versions/2.7.1/bin/ruby -I /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/2.7.0 -r ./siteconf20200718-7520-jpov6j.rb extconf.rb
creating Makefile
current directory: /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3/ext/byebug
make "DESTDIR=" clean
current directory: /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3/ext/byebug
make "DESTDIR="
compiling breakpoint.c
compiling byebug.c
compiling context.c
compiling locker.c
compiling threads.c
linking shared-object byebug/byebug.so
current directory: /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3/ext/byebug
make "DESTDIR=" install
/usr/bin/install -c -m 0755 byebug.so ./.gem.20200718-7520-b4jxqm/byebug
Permission denied # rb_file_s_rename - (./.gem.20200718-7520-b4jxqm/byebug, /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/byebug-11.1.3/byebug)
Gem files will remain installed in /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3 for inspection.
Results logged to /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/byebug-11.1.3/gem_make.out
I am not very experienced with coding or computers, I am actually now just trying to learn how to work within these programs, but I have no clue how to fix this or what to do.
Can anyone help me?
Your system is missing native packages to compile byebug etc. You need to install this and try again. e.g
apt-get update && apt-get install -y build-essential
Your system might be missing some ruby dependencies. The way I fixed this error on my Ubuntu based system was installing the ruby-dev package like this:
sudo apt update && sudo apt install ruby-dev
I am not so sure about window's systems, but I think problem is the same: missing dependencies. This link might be useful if you need more help: https://www.ruby-lang.org/en/documentation/installation/
Make sure that gem install byebug -v '11.1.3' --source 'https://rubygems.org/' succeeds before bundling.
So run gem install byebug -v '11.1.3' if the problem persists, try gem install byebug without specifying a version. Doing so, gem will search for the newest one.
However, if the problem persists, your ruby version 2.7.1 may not have support for this byebug version yet. On this case, try a stable ruby version, for now 2.6.5, 2.6.6, that is, all 2.6.x are stables at this moment.
After you succeed well running gem install byebug, run bundle install againg.
What helps me a lot with ruby and rails was taking a look on the official ruby web page. On there you'll see many links to how to use the appropriated ruby version and rails versions according to your Operation System.
These things are not shown to much on tutorials.
I solved by using below comments
sudo curl -L https://get.rvm.io | bash -s stable --ruby
Close & Reopen Terminal then
rvm use ruby-3.1.1
rvm --default use 3.1.1
Finally,
sudo gem install cocoapods
I needed to set export BUNDLE_BUILD__SASSC=--disable-march-tune-native to workout around some compiling error in some SASS gem.
RUN
gem install bundler &&
gem install rake &&
wget -c https://github.com/wurmlab/sequenceserver/archive/1.1.0.beta12.tar.gz &&
tar xfvz 1.1.0.beta12.tar.gz &&
cd sequenceserver-1.1.0.beta12 &&
npm install -g
bundle install
I'm having troubles to do bundle install in one project I get to work on in Rails 4.2.10. When I bundle I receive the next error:
An error occurred while installing ffi (1.9.25), and Bundler cannot continue.
Make sure that gem install ffi -v '1.9.25' succeeds before bundling.
In Gemfile:
s3_direct_upload was resolved to 0.1.6, which depends on
sass-rails was resolved to 5.0.7, which depends on
sass was resolved to 3.6.0, which depends on
sass-listen was resolved to 4.0.0, which depends on
rb-inotify was resolved to 0.9.10, which depends on
ffi
When I run gem install ffi -v '1.9.25' also an error occurs:
Building native extensions. This could take a while...
ERROR: Error installing ffi:
ERROR: Failed to build gem native extension.
current directory: /xxx/xxx/.rvm/gems/ruby-2.5.3/gems/ffi-1.9.25/ext/ffi_c
/xxx/xxx/.rvm/rubies/ruby-2.5.3/bin/ruby -r ./siteconf20190110-6923-1jimorr.rb extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include,/usr/include/ffi... yes
checking for ffi_call() in -lffi... yes
checking for ffi_closure_alloc()... no
checking for ffi_raw_call()... no
checking for shlwapi.h... no
checking for ruby/thread.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_call_without_gvl()... yes
creating extconf.h
creating Makefile
current directory: /xxx/xxx/.rvm/gems/ruby-2.5.3/gems/ffi-1.9.25/ext/ffi_c
make "DESTDIR=" clean
current directory: /xxx/xxx/.rvm/gems/ruby-2.5.3/gems/ffi-1.9.25/ext/ffi_c
make "DESTDIR="
Configuring libffi
clang: error: unsupported option '-print-multi-os-directory'
clang: error: no input files
cd "/xxx/xxx/.rvm/gems/ruby-2.5.3/gems/ffi-1.9.25/ext/ffi_c/libffi-x86_64-darwin18" && /Volumes/Macintosh HD/Applications/Xcode.app/Contents/Developer/usr/bin/make
/bin/sh: /Volumes/Macintosh: No such file or directory
make: *** ["/xxx/xxx/.rvm/gems/ruby-2.5.3/gems/ffi-1.9.25/ext/ffi_c/libffi-x86_64-darwin18"/.libs/libffi_convenience.a] Error 127
make failed, exit code 2
Gem files will remain installed in /xxx/xxx/.rvm/gems/ruby-2.5.3/gems/ffi-1.9.25 for inspection.
Results logged to /xxx/xxx/.rvm/gems/ruby-2.5.3/extensions/x86_64-darwin-18/2.5.0/ffi-1.9.25/gem_make.out
I've been trying many solutions online but cannot resolve this issue.
Seems the issue is with my system as I'm new to the team and the other developers were unable to help me as they do not have this kind of issue.
I was able to successfully install ffi with the following command:
LDFLAGS="-L/usr/local/opt/libffi/lib" PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig" gem install ffi -v '1.9.25'
Found on some japanese board
According to the libffi README, only GCC is a tested compiler on macOS. You are using Clang, which doesn't support the command line option -print-multi-os-directory.
You need to either patch libffi to work with Clang, or use GCC.
Your error is the following Configuring libffi
clang: error: unsupported option '-print-multi-os-directory'
clang: error: no input files because Clang (wich is the C compiler you are using) doesn't support the option '-print-multi-os-directory'.
Could you check that X-Code command line tools are perfectly installed by executing the following command? xcode-select --install
Also would you mind to try brew install automake autoconf libtool libffi to install required dependencies?
I installed rvm and ruby 2.0.0 on my ubuntu 13.04 and everything was fine, but the last step went wrong when I install rails 4.0.0
The following is what happened after I run: " gem install rails -v 4.0.0 ":
**Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/home/adolph/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb
creating Makefile
make
compiling atomic_reference.c
linking shared-object atomic_reference.so
make install
/usr/bin/install -c -m 0755 atomic_reference.so /home/adolph/.rvm/gems/ruby-2.0.0-p247/gems/atomic-1.1.14/lib/home/adolph/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/x86_64-linux
/usr/bin/install: cannot create regular file ‘/home/adolph/.rvm/gems/ruby-2.0.0-p247/gems/atomic-1.1.14/lib/home/adolph/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/x86_64-linux’: No such file or directory
make: *** [install-so] Error 1
Gem files will remain installed in /home/adolph/.rvm/gems/ruby-2.0.0-p247/gems/atomic-1.1.14 for inspection.
Results logged to /home/adolph/.rvm/gems/ruby-2.0.0-p247/gems/atomic-1.1.14/ext/gem_make.out**
It looks like the *‘/home/adolph/.rvm/gems/ruby-2.0.0-p247/gems/atomic-1.1.14/lib/home/adolph/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/x86_64-linux’* doesn't exist.
Please help me!
You can try with this
sudo apt-get install build-essential
and after it
sudo gem install rails