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.
Related
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
Ubuntu 20.04.2 LTS
Installing Rails 6.1.3.1
Ruby: 2.6.5
Installing rails:
gem install rails -v 6.1.3.1 --no-doc
Fails to install racc-1.5.2
Trying to manually install racc-1.5.2:
gem install racc -v '1.5.2' --source 'https://rubygems.org/' --no-doc
produces the same error.
The following is an 'edited' output of the error:
$ gem install rails -v 6.1.3.1 --no-doc
Fetching racc-1.5.2.gem
Fetching zeitwerk-2.4.2.gem
...
Successfully installed rack-2.2.3
Successfully installed rack-test-1.1.0
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
current directory: /home/user/.rvm/gems/ruby-2.6.5#gemset/gems/racc-1.5.2/ext/racc/cparse
/home/user/.rvm/rubies/ruby-2.6.5/bin/ruby -I /home/user/.rvm/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0 -r ./siteconf20210503-658786-pkp97m.rb extconf.rb
checking for rb_ary_subseq()... yes
creating Makefile
current directory: /home/user/.rvm/gems/ruby-2.6.5#gemset/gems/racc-1.5.2/ext/racc/cparse
make "DESTDIR=" clean
current directory: /home/user/.rvm/gems/ruby-2.6.5#gemset/gems/racc-1.5.2/ext/racc/cparse
make "DESTDIR="
compiling cparse.c
linking shared-object racc/cparse.so
current directory: /home/user/.rvm/gems/ruby-2.6.5#gemset/gems/racc-1.5.2/ext/racc/cparse
make "DESTDIR=" install
make: /usr/bin/mkdir: Command not found
make: *** [Makefile:202: .sitearchdir.-.racc.time] Error 127
make install failed, exit code 2
Gem files will remain installed in /home/user/.rvm/gems/ruby-2.6.5#gemset/gems/racc-1.5.2 for inspection.
Results logged to /home/user/.rvm/gems/ruby-2.6.5#gemset/extensions/x86_64-linux/2.6.0/racc-1.5.2/gem_make.out
The main problem here is that the command mkdir is being called at a specific location, and it's just not there:
make: /usr/bin/mkdir: Command not found
To fix this, you need to add a symbolic link to that location:
$ sudo ln -s /bin/mkdir /usr/bin/mkdir
Run gem install again on rails and all should be good!
Thanks to user dem1tris from brining up a related topic, and providing the answer: make: /usr/bin/mkdir: Command not found during `gem install nokogiri` in Ubuntu 20.04
some one in my team just updated some gem in the gemfile because of which gem json is resolved to version '1.8.6'. Which is not being installed. The error it throws is following:
anas:~$ sudo gem install json -v '1.8.6'
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/json-
1.8.6/ext/json/ext/generator
/usr/bin/ruby2.3 -r ./siteconf20171017-7274-1ea5ank.rb extconf.rb
creating Makefile
current directory: /var/lib/gems/2.3.0/gems/json-
1.8.6/ext/json/ext/generator
make "DESTDIR=" clean
current directory: /var/lib/gems/2.3.0/gems/json-
1.8.86/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
gcc: error: unrecognized command line option ‘-Wdate-time’
gcc: error: unrecognized command line option ‘-fstack-protector-
strong’
Makefile:239: recipe for target 'generator.o' failed
make: *** [generator.o] Error 1
make failed, exit code 2
Gem files will remain installed in /var/lib/gems/2.3.0/gems/json-1.8.6
for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-
linux/2.3.0/json-1.8.6/gem_make.out
My ruby is 2.3.1p112 and gcc version is 4.7.4. I have tried to find out which gcc version json -v 1.8.6 use but I did not find anything.
Thanks in advance
As pr my undarstanding the solution is to install libgmp3-dev.
sudo apt-get install libgmp3-dev
I typed 'gem install middleman' in my terminal and got the following error message:
Building native extensions. This could take a while...
ERROR: Error installing middleman:
ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.9.3-p429/bin/ruby extconf.rb
creating Makefile
make
compiling hitimes.c
make: gcc-4.2: No such file or directory
make: *** [hitimes.o] Error 1
Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p429/gems/hitimes-1.2.2 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p429/gems/hitimes-1.2.2/ext/hitimes/c/gem_make.out
Looks like you're missing gcc-4.2
Do you have any GCC installed (if you're on a Mac, you need to install Xcode)?
which gcc
If you already have a version of gcc, you can simply symlink to it
ln -s /usr/bin/gcc /usr/bin/gcc-4.2
I'm trying to install therubyracer on Amazon Linux AMI (~centOS).
[www#ip-10-0-0-125 root]$ gem install therubyracer
Fetching: libv8-3.16.14.3-x86_64-linux.gem (100%)
Successfully installed libv8-3.16.14.3-x86_64-linux
Building native extensions. This could take a while...
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
/home/www/.rvm/rubies/ruby-2.1.1/bin/ruby extconf.rb
checking for main() in -lpthread... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling handles.cc
make: execvp: g++: Permission denied
make: *** [handles.o] Error 127
Permission denied # dir_chdir - /root
Gem files will remain installed in /home/www/.rvm/gems/ruby-2.1.1/gems/therubyracer-0.12.1 for inspection.
Results logged to /home/www/.rvm/gems/ruby-2.1.1/extensions/x86_64-linux/2.1.0/therubyracer-0.12.1/gem_make.out
[www#ip-10-0-0-125 root]$
I am not sure what to try.. I'm installing it manually on the server with gem install therubyracer. I have tried doing libv8 first, many different versions and combinations of versions.
I'm running this under the www user in the ~ directory.
Thanks
You haven't installed g++ (the GNU C++ compiler) on your system... that makes it hard to compile things :-).
I don't have a copy of centos handy, but something like sudo yum install g++ will probably get you a compiler.