Here is the log from my bundle install
Fetching mysql2 0.5.2
Installing mysql2 0.5.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
...
...
...
Cannot find mysql_config at /usr/local/opt/mysql#5.6/bin/mysql_config
--with-ldflags=-L/usr/local/opt/openssl/lib
--with-cppflags=-I/usr/local/opt/openssl/include
-----
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/admin/.asdf/installs/ruby/2.6.3/bin/$(RUBY_BASE_NAME)
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
--with-mysql-config
To see why this extension failed to compile, please check the mkmf.log which can be found
here:
/Users/admin/development/locari/vendor/bundle/ruby/2.6.0/extensions/x86_64-darwin-18/2.6.0-static/mysql2-0.5.2/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in
/Users/admin/development/locari/vendor/bundle/ruby/2.6.0/gems/mysql2-0.5.2 for
inspection.
Results logged to
/Users/admin/development/locari/vendor/bundle/ruby/2.6.0/extensions/x86_64-darwin-18/2.6.0-static/mysql2-0.5.2/gem_make.out
An error occurred while installing mysql2 (0.5.2), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.5.2' --source 'https://rubygems.org/'` succeeds
before bundling.
So I do what it says, and run sudo gem install mysql2 -v '0.5.2' --source
$ sudo gem install mysql2 -v '0.5.2' --source 'https://rubygems.org/'
Building native extensions. This could take a while...
Successfully installed mysql2-0.5.2
Parsing documentation for mysql2-0.5.2
Done installing documentation for mysql2 after 0 seconds
1 gem installed
And it installs fine! But when I run bundle install again, I get the same error. I've tried uninstalling, unlinking, and reinstalling mysql in brew.
What can I try next??
Run these commands first:
bundle config --local build.mysql2 "--with-cppflags=-I/usr/local/opt/openssl/include --with-ldflags=-L/usr/local/opt/openssl/lib"
Then run bundle install it works.
Installation on M1 macs
This method helped me on ruby v2.7.2 and macOS Big Sur 11.4.
Install dependencies
brew install mysql zstd openssl
Install the gem
gem install mysql2 -- --with-ldflags="-L $(brew --cellar zstd)/1.5.0/lib -L $(brew --prefix openssl)/lib" --with-ldlibs="-lzstd -lssl" --with-cppflags="-I $(brew --prefix openssl)/include"
As an alternative, you can modify bundler config:
bundle config --local build.mysql2 --with-ldflags="-L $(brew --cellar zstd)/1.5.0/lib -L $(brew --prefix openssl)/lib" --with-ldlibs="-lzstd -lssl" --with-cppflags="-I $(brew --prefix openssl)/include"
and run bundle install.
Use build options with bundler.
Try running this in your application directory:
bundle config --local build.mysql2 "--with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include"
This sets it just for your application, which can be handy for checking into your repo if others need a similar configuration. But you can also make it a global configuration on your computer by replacing --local with --global and it will apply to all your bundle install commands on your User account.
Update
This actually didn't end up working for me but I'll leave it here because it should have worked. I basically just had to run:
gem install mysql2 -v '0.5.3' -- --with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include
Instead of using bundler, even though setting this build config should have done this.
Related
I'm getting tired of error when trying to bundle install and install therubyracer.
I've tried everything from around the net and nothing helps.
Already installed libv8 and x-code setup.
Appreciate your help!
After command sudo gem install therubyracer -v '0.12.3', I'm receivin error:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.6.0/gems/therubyracer-0.12.3/ext/v8
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20191219-41979-115mu26.rb extconf.rb
checking for -lpthread... yes
checking for -lobjc... yes
checking for v8.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/$(RUBY_BASE_NAME)
--with-pthreadlib
--without-pthreadlib
--with-objclib
--without-objclib
--enable-debug
--disable-debug
--with-v8-dir
--without-v8-dir
--with-v8-include
--without-v8-include=${v8-dir}/include
--with-v8-lib
--without-v8-lib=${v8-dir}/lib
/Library/Ruby/Gems/2.6.0/gems/libv8-3.16.14.19/ext/libv8/location.rb:50:in `configure': By using --with-system-v8, you have chosen to use the version (Libv8::Location::System::NotFoundError)
of V8 found on your system and *not* the one that is bundled with
the libv8 rubygem.
However, your system version of v8 could not be located.
Please make sure your system version of v8 that is compatible
with 3.16.14.19 installed. You may need to use the
--with-v8-dir option if it is installed in a non-standard location
from /Library/Ruby/Gems/2.6.0/gems/libv8-3.16.14.19/lib/libv8.rb:7:in `configure_makefile'
from extconf.rb:32:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/therubyracer-0.12.3/mkmf.log
extconf failed, exit code 1 ```
I've found the solution for this error.
If you have a problem with bundle install check this:
gem list libv8 --remote --all
gem install libv8 -v 3.16.14.19 -- --with-system-v8
gem install therubyracer -- --with-v8-dir=/Users/YOUR_NAME/homebrew/opt/v8#3.15
It works for me, after few hours of fighting with every solution I can find.
Hope it'll help someone.
I was stuck on the same issue and got help from this gist.
brew install v8#3.15
gem install libv8 -v 'YOUR_VERSION' -- --with-system-v8
gem install therubyracer -v 'YOUR_VERSION' -- --with-v8-dir=/usr/local/opt/v8#3.15
bundle install
I am using macOS Catalina version 10.15.3 and ruby version 2.6.3. I hope it helps!
I have faced the same issue recently in Mac OS 10.15.7
brew install v8-315
gem install libv8 -v '3.16.14.19' -- --with-system-v
gem install therubyracer -v '0.12.3' -- --with-system-v8 --with-v8-dir=/usr/local/opt/v8#3.15
Note: while installing ruby race it installed only after putting both the options together --with-system-v8 and --with-v8-dir and pointing to that directory.
Please do verify if the folder exist in that path or not before installing.
Uninstalling v8 and install v8#3.15 on a fresh Catalina install worked for me.
$ brew uninstall v8
$ brew install v8#3.15
I try to clone this repo and run bundle install. The bundle process failed and throw this error:
...
Installing nokogiri 1.6.2.1 with native extensions
Building nokogiri using packaged libraries.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/zulhilmizainudin/.rvm/rubies/ruby-2.2.0/bin/ruby -r ./siteconf20151130-43880-pntnc6.rb extconf.rb
Building nokogiri using packaged libraries.
-----
libiconv is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/zulhilmizainudin/.rvm/rubies/ruby-2.2.0/bin/$(RUBY_BASE_NAME)
--help
--clean
--use-system-libraries
--enable-static
--disable-static
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--enable-cross-build
--disable-cross-build
extconf failed, exit code 1
Gem files will remain installed in /Users/zulhilmizainudin/.rvm/gems/ruby-2.2.0/gems/nokogiri-1.6.2.1 for inspection.
Results logged to /Users/zulhilmizainudin/.rvm/gems/ruby-2.2.0/extensions/x86_64-darwin-14/2.2.0-static/nokogiri-1.6.2.1/gem_make.out
An error occurred while installing nokogiri (1.6.2.1), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.2.1'` succeeds before bundling.
Then I try to run this:
gem install nokogiri -v '1.6.2.1'
And now I get this error:
Building native extensions. This could take a while...
Building nokogiri using packaged libraries.
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/zulhilmizainudin/.rvm/rubies/ruby-2.2.0/bin/ruby -r ./siteconf20151130-43942-1axq4sj.rb extconf.rb
Building nokogiri using packaged libraries.
-----
libiconv is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/zulhilmizainudin/.rvm/rubies/ruby-2.2.0/bin/$(RUBY_BASE_NAME)
--help
--clean
--use-system-libraries
--enable-static
--disable-static
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--enable-cross-build
--disable-cross-build
extconf failed, exit code 1
Gem files will remain installed in /Users/zulhilmizainudin/.rvm/gems/ruby-2.2.0/gems/nokogiri-1.6.2.1 for inspection.
Results logged to /Users/zulhilmizainudin/.rvm/gems/ruby-2.2.0/extensions/x86_64-darwin-14/2.2.0-static/nokogiri-1.6.2.1/gem_make.out
I tried to follow this answer but I still get the same error above.
I also try to uninstall and install my brew again (based on this answer) and it's still same.
Also, I try this solution but still get the error.
What should I do now to make sure this nokogiri gem installed successfully?
Note: I'm using OSX 10.11.1 El Capitan.
Run these commands:
gem uninstall nokogiri
xcode-select --install
gem install nokogiri
source: http://www.nokogiri.org/tutorials/installing_nokogiri.html#mac_os_x
sometimes mac updates can break xcode CLI so reinstalling can fix the issue:
https://github.com/sparklemotion/nokogiri/issues/1445
What worked for me (on macOS Sierra) was a combination of Sam's answer and the following:
gem install nokogiri -- --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2 --use-system-libraries
I had a similar issue with 1.6.7.2 when bundle installing on codeship with ruby 2.3.
What worked for me was adding:
bundle config build.nokogiri --use-system-libraries
before
bundle install
If you're using bundle:
brew install libxml2
# If using Bundle
bundle config build.nokogiri --use-system-libraries \
--with-xml2-include=$(brew --prefix libxml2)/include/libxml2
bundle install
from http://www.nokogiri.org/tutorials/installing_nokogiri.html
Try this
sudo apt-get install build-essential patch ruby-dev zlib1g-dev liblzma-dev
And then install Nokogiri
sudo gem install nokogiri
I did everything in the other answers, but had to do one more thing:
Open Xcode
Click "Agree"
Wait a bit, close Xcode
Rejoice
Seems like this is due to nokogiri 1.6.2.1 specific problem.
I add this inside my Gemfile:
gem 'nokogiri', '~> 1.6', '>= 1.6.7'
And run bundle update nokogiri and then bundle. Everything now working fine.
It may also be an issue with the anaconda version of some of the libs.
$ conda deactivate
$ gem uninstall nokogiri
$ gem install nokogiri
$ conda activate base
worked for me.
I had the similar issue. The reason was outdated xcode.
If you run brew doctor you might see it. Just open AppStore, got to updates tab and update your xcode.
If nothing above works,
Try deleting Gemfile.lock, and do reinstalling of gems.
Spencer's answer worked for me, but I also needed to use the -n parameter to overcome the permission issue documented here.
So in the end, the command that worked for me was:
gem install -n /usr/local/bin nokogiri -- --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/libxml2 --use-system-libraries
Deleting nokogiri in rbenv gem folder and reinstalling solved it for me.
This helped me fix this
I reinstalled Xcode and directed xcode-select to its path
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
ref:
https://stackoverflow.com/a/17980786/3861525
I had the same issue while updating to xcode 10. I resolved it with the following steps :
xcode-select --install
bundle install --deployment
gem install nokogiri
Github Answer
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
bundle install
Following this tutorial [link] to install gitlab on a dedicated server. I need to :
sudo -u git -H bundle install --deployment --without development test postgres aws
But an error occurred while installing rugged :
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for cmake... no
ERROR: CMake is required to build Rugged.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/bin/ruby
Gem files will remain installed in /home/git/gitlab/vendor/bundle/ruby/2.0.0/gems/rugged-0.21.2 for inspection.
Results logged to /home/git/gitlab/vendor/bundle/ruby/2.0.0/gems/rugged-0.21.2/ext/rugged/gem_make.out
An error occurred while installing rugged (0.21.2), and Bundler cannot continue.
Make sure that `gem install rugged -v '0.21.2'` succeeds before bundling.
So I installed rugged -> I installed CMake & config-pkg :
/home/git/gitlab$ sudo gem install rugged
Building native extensions. This could take a while...
Successfully installed rugged-0.21.2
Parsing documentation for rugged-0.21.2
unable to convert "\xC0" from ASCII-8BIT to UTF-8 for lib/rugged/rugged.so, skipping
1 gem installed
But it doesnt change anything :
Errno::EACCES: Permission denied - /home/git/gitlab/vendor/bundle/ruby/2.0.0/gems/rugged-0.21.2/LICENSE
An error occurred while installing rugged (0.21.2), and Bundler cannot continue.
Make sure that `gem install rugged -v '0.21.2'` succeeds before bundling.
Any idea ?
For OSX if you're using homebrew:
brew install cmake
bundle install
First, try installing cmake:
sudo apt-get install cmake
Then, repeat the command:
sudo -u git -H bundle install --deployment --without development test postgres aws
For me, gem was complaining about pkg-config missing dependence, so I did:
sudo apt-get install pkg-config
and then
sudo gem install rugged -v '0.22.2'
after that, I revert to my older version of gitlab and re-run the script for the upgrade.
My older version of gitlab was 6.9.2 and the upgraded version 8.0.5
Can fix this problem only that way:
download from https://cmake.org/download/. Extract the downloaded tar file and then:
cd $CMAKE_DOWNLOAD_PATH
./configure
make
make install
And after this steps I could successfully run:
gem install rugged -v '0.26.0'
Note: The above mentioned solutions did not work for me.
Here is the error log I got
checking for gmake... no
checking for make... yes
Building Rugged using system libraries.
libgit2 version is not compatible, expected ~> 0.99.0
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
It was mainly saying libgit2 version is not compatible, expected ~> 0.99.0
and I tried gem install rugged -v '0.99.0' and then bundle install.
then the problem is solved.
Mac OSX 10.6 or later please refer to this url:
http://www.cmake.org/download/
For me it was Openssl problem in a WSL ubuntu 20.04 env
Run
apt install cmake libssl-dev
might also help to run
apt install ruby-dev pkg-config
i tried installing the gem separately and v8 file also. I'm lost on what to do as I've exhausted all possible options
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/giowong/.rbenv/versions/2.1.3/bin/ruby extconf.rb
checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
checking for v8.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/giowong/.rbenv/versions/2.1.3/bin/ruby
--with-pthreadlib
--without-pthreadlib
--with-objclib
--without-objclib
--enable-debug
--disable-debug
--with-v8-dir
--without-v8-dir
--with-v8-include
--without-v8-include=${v8-dir}/include
--with-v8-lib
--without-v8-lib=${v8-dir}/lib
/Users/giowong/rails_project/doctible_pre_treatment/vendor/bundle/ruby/2.1.0/gems/libv8-3.16.14.3/ext/libv8/location.rb:50:in `configure': You have chosen to use the version of V8 found on your system (Libv8::Location::System::NotFoundError)
and *not* the one that is bundle with the libv8 rubygem. However,
it could not be located. please make sure you have a version of
v8 that is compatible with 3.16.14.3 installed. You may
need to special --with-v8-dir options if it is in a non-standard
location
thanks,
The Mgmt
from /Users/giowong/rails_project/doctible_pre_treatment/vendor/bundle/ruby/2.1.0/gems/libv8-3.16.14.3/lib/libv8.rb:7:in `configure_makefile'
from extconf.rb:32:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/giowong/rails_project/doctible_pre_treatment/vendor/bundle/ruby/2.1.0/gems/therubyracer-0.12.1 for inspection.
Results logged to /Users/giowong/rails_project/doctible_pre_treatment/vendor/bundle/ruby/2.1.0/extensions/x86_64-darwin-14/2.1.0-static/therubyracer-0.12.1/gem_make.out
An error occurred while installing therubyracer (0.12.1), and Bundler cannot
continue.
Make sure that `gem install therubyracer -v '0.12.1'` succeeds before bundling.
I'm using brew to install ruby and rails using this setup guide
https://gorails.com/setup/osx/10.10-yosemite
Help please, upgrading to Yosemite has totally messed with my dev environment
Perhaps this problem has to do with a recent update of XCode. After a XCode update you need to do the following steps:
Open Xcode and accept the license agreement
Reinstall the Command Line Tools.
The second step seems to depend on your OS versions. If xcode-select --install does not work try to start the Install Command Line Developer Tools app in /System/Library/CoreServices.
After reinstalling the Command Line Tools try to rerun bundle install.
Try this worked for me:
gem install libv8 -- --with-system-v8
gem install therubyracer -v '0.12.1'
if that didn't work try to run:
brew update
and try again the first two steps.
I resolved the same issue by changing the Gemfile
gem 'therubyracer'
was replaced by
gem 'therubyracer', platforms: :ruby
Could you try this?
This worked for Catalina
brew install v8#3.15
gem install libv8 -v 3.16.14.19 -- --with-system-v8
gem install therubyracer -- --with-v8-dir=/usr/local/opt/v8#3.15
Source
I am getting the following Error While installing ruby debugger
In gemfile i added
gem 'ruby-debug19', :require => 'ruby-debug'
and run
bundle install
Installing linecache19 (0.5.12) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for vm_core.h... no
checking for vm_core.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/bin/ruby
--with-ruby-dir
--without-ruby-dir
--with-ruby-include
--without-ruby-include=${ruby-dir}/include
--with-ruby-lib
--without-ruby-lib=${ruby-dir}/lib
What is the reason for the error
how to install thre debugger..???
You have to first set the path of DevKit in your environmental variable
Then run
gem install linecache19
gem install ruby-debug-base19
gem install ruby-debug-ide
through command prompt
May this work
From the RVM website:
If you have trouble installing ruby-debug19 try installing with the following command:
$ rvm reinstall 1.9.3 --patch debug --force-autoconf
$ gem install ruby-debug19 -- --with-ruby-include="${MY_RUBY_HOME/rubies/src}"
"On Ubuntu, the native compilation step downloads the ruby 1.9.2 source and tries to unpack it into a directory that your current user probably does not have write access to." - Darren (Reference: http://isitruby19.com/linecache19)
In this case, try sudo bundle install.
If the problem is that it cannot resolve the vm_core.h file dependency, you can run the installs with specific versions and the path to the ruby source:
sudo -E gem install linecache19 -v=0.5.11 -- --with-ruby-include=path_to/ruby-1.9.1-p378/
sudo -E gem install ruby-debug-base19 -v=0.11.23 -- --with-ruby-include=path_to/ruby-1.9.1-p378/
sudo -E gem install ruby-debug-ide -v=0.4.9 -- --with-ruby-include=path_to/ruby-1.9.1-p378/
Reference: http://isitruby19.com/linecache19
Note, replace path_to/ruby-1.9.1-p378/, with the path to where you installed ruby.
To find out where you installed ruby, try running:
which ruby