Never was, and here again.
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
Bundler version 1.16.2
Archlinux updated 4.17.4-1 x86_64
Pure ruby project
I can install nokogiri with gem install nokogiri --no-rdoc --no-ri
When I run bundle install --path=vendor inside my ruby project I need to add options to bundler before -- bundle config build.nokogiri --use-system-libraries --with-xml2-include=/usr/include/libxml2 for that installing have success. Without those options he can't.
It fails when I run Dockefile. I need hints where to look more.
FROM archlinux/base
ENV HOME="/srv"
ENV LANG=ru_RU.UTF-8
ENV APP_ENV=production
ENV LANG=ru_RU.UTF-8
ENV PATH=$HOME/sbin:$HOME/bin:$HOME/.gem/ruby/2.5.0/bin:/usr/lib/ruby/gems/2.5.0/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
RUN pacman -Syu --noconfirm pkgconf procps-ng iproute2 iputils supervisor ruby make gcc grep postgresql-libs awk && \
gem install bundler --no-ri --no-rdoc --no-document --no-user-install && \
pacman -Scc --noconfirm
COPY ./ /srv/
RUN cd /srv && rm -rf vendor && \
bundle config build.nokogiri --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xslt-include=/usr/include/libxslt --with-exslt-include=/usr/include/libexslt --with-xml2-lib=/usr/lib/libxml2.so && \
bundle install --path=vendor --jobs=4 --binstubs
...
$ docker build -t mprj:1.2.0 -f ./info/Dockerfile .
Sending build context to Docker daemon 2.931MB
Step 1/12 : FROM archlinux/base
---> 4702f86ec64f
Step 2/12 : ENV HOME="/srv"
---> Using cache
---> 25d2416a2261
Step 3/12 : ENV LANG=ru_RU.UTF-8
---> Using cache
---> a5f2bb965b81
Step 4/12 : ENV APP_ENV=production
---> Using cache
---> 0ea44026fe0a
Step 5/12 : ENV PATH=$HOME/sbin:$HOME/bin:$HOME/.gem/ruby/2.5.0/bin:/usr/lib/ruby/gems/2.5.0/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
---> Running in e4fecc392bb2
Removing intermediate container e4fecc392bb2
---> d26d4a07b769
Step 6/12 : RUN pacman -Syu --noconfirm pkgconf procps-ng iproute2 iputils supervisor ruby make gcc grep postgresql-libs awk && gem install bundler --no-ri --no-rdoc --no-document --no-user-install && pacman -Scc --noconfirm
---> Running in b18a1c4585ee
:: Synchronizing package databases...
downloading core.db...
downloading extra.db...
downloading community.db...
:: Starting full system upgrade...
resolving dependencies...
looking for conflicting packages...
warning: dependency cycle detected:
warning: rubygems will be installed before its ruby dependency
Packages (36) binutils-2.30-5 gc-7.6.6-1 gdbm-1.16-1 guile-2.2.4-1 libatomic_ops-7.6.4-1 libmpc-1.1.0-1 libnsl-1.2.0-1 libsasl-2.1.26-13 libsystemd-239.0-2 libtool-2.4.6+40+g6ca5e224-7 libyaml-0.1.7-1 mpfr-4.0.1-1 perl-5.26.2-2 python2-2.7.15-2 python2-appdirs-1.4.3-1 python2-meld3-1.0.2-1 python2-packaging-17.1-1 python2-pyparsing-2.2.0-1 python2-setuptools-1:39.2.0-2 python2-six-1.11.0-1 rubygems-2.7.7-1 sysfsutils-2.1.0-10 systemd-239.0-2 tar-1.30-1 texinfo-6.5-1 gawk-4.2.1-1 gcc-8.1.1+20180531-1 grep-3.1-1 iproute2-4.17.0-1 iputils-20161105.1f2bb12-2 make-4.2.1-2 pkgconf-1.5.1-1 postgresql-libs-10.4-3 procps-ng-3.3.15-1 ruby-2.5.1-2 supervisor-3.3.4-1
Total Download Size: 83.64 MiB
Total Installed Size: 401.21 MiB
Net Upgrade Size: 327.94 MiB
:: Proceed with installation? [Y/n]
:: Retrieving packages...
downloading pkgconf-1.5.1-1-x86_64.pkg.tar.xz...
downloading libsystemd-239.0-2-x86_64.pkg.tar.xz...
downloading procps-ng-3.3.15-1-x86_64.pkg.tar.xz...
downloading iproute2-4.17.0-1-x86_64.pkg.tar.xz...
downloading sysfsutils-2.1.0-10-x86_64.pkg.tar.xz...
downloading gdbm-1.16-1-x86_64.pkg.tar.xz...
downloading perl-5.26.2-2-x86_64.pkg.tar.xz...
downloading iputils-20161105.1f2bb12-2-x86_64.pkg.tar.xz...
downloading libsasl-2.1.26-13-x86_64.pkg.tar.xz...
downloading libnsl-1.2.0-1-x86_64.pkg.tar.xz...
downloading tar-1.30-1-x86_64.pkg.tar.xz...
downloading libtool-2.4.6+40+g6ca5e224-7-x86_64.pkg.tar.xz...
downloading texinfo-6.5-1-x86_64.pkg.tar.xz...
downloading make-4.2.1-2-x86_64.pkg.tar.xz...
downloading binutils-2.30-5-x86_64.pkg.tar.xz...
downloading mpfr-4.0.1-1-x86_64.pkg.tar.xz...
downloading libmpc-1.1.0-1-x86_64.pkg.tar.xz...
downloading gcc-8.1.1+20180531-1-x86_64.pkg.tar.xz...
downloading grep-3.1-1-x86_64.pkg.tar.xz...
downloading gawk-4.2.1-1-x86_64.pkg.tar.xz...
downloading systemd-239.0-2-x86_64.pkg.tar.xz...
downloading python2-2.7.15-2-x86_64.pkg.tar.xz...
downloading python2-appdirs-1.4.3-1-any.pkg.tar.xz...
downloading python2-pyparsing-2.2.0-1-any.pkg.tar.xz...
downloading python2-six-1.11.0-1-any.pkg.tar.xz...
downloading python2-packaging-17.1-1-any.pkg.tar.xz...
downloading python2-setuptools-1:39.2.0-2-any.pkg.tar.xz...
downloading libyaml-0.1.7-1-x86_64.pkg.tar.xz...
downloading rubygems-2.7.7-1-any.pkg.tar.xz...
downloading ruby-2.5.1-2-x86_64.pkg.tar.xz...
downloading libatomic_ops-7.6.4-1-x86_64.pkg.tar.xz...
downloading gc-7.6.6-1-x86_64.pkg.tar.xz...
downloading guile-2.2.4-1-x86_64.pkg.tar.xz...
downloading postgresql-libs-10.4-3-x86_64.pkg.tar.xz...
downloading python2-meld3-1.0.2-1-any.pkg.tar.xz...
downloading supervisor-3.3.4-1-any.pkg.tar.xz...
checking keyring...
checking package integrity...
loading package files...
checking for file conflicts...
checking available disk space...
:: Processing package changes...
installing pkgconf...
upgrading libsystemd...
installing procps-ng...
installing iproute2...
Optional dependencies for iproute2
linux-atm: ATM support
installing sysfsutils...
upgrading gdbm...
upgrading perl...
installing iputils...
Optional dependencies for iputils
xinetd: for tftpd
upgrading libsasl...
installing libnsl...
installing python2...
Optional dependencies for python2
tk: for IDLE
python2-setuptools [pending]
python2-pip
installing python2-meld3...
installing python2-appdirs...
installing python2-pyparsing...
installing python2-six...
installing python2-packaging...
installing python2-setuptools...
installing supervisor...
installing libyaml...
installing rubygems...
installing ruby...
Optional dependencies for ruby
ruby-docs: Ruby documentation
tk: for Ruby/TK
installing tar...
installing libtool...
installing texinfo...
installing libatomic_ops...
installing gc...
installing guile...
installing make...
installing binutils...
installing mpfr...
installing libmpc...
installing gcc...
Optional dependencies for gcc
lib32-gcc-libs: for generating code for 32-bit ABI
installing grep...
installing postgresql-libs...
installing gawk...
upgrading systemd...
:: Running post-transaction hooks...
( 1/11) Warn about old perl modules
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "ru_RU.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
( 2/11) Cleaning up package cache...
( 3/11) Updating journal message catalog...
( 4/11) Reloading system manager configuration...
Skipped: Current root is not booted.
( 5/11) Updating udev hardware database...
( 6/11) Applying kernel sysctl settings...
Skipped: Current root is not booted.
( 7/11) Creating system user accounts...
( 8/11) Creating temporary files...
[/usr/lib/tmpfiles.d/journal-nocow.conf:26] Failed to resolve specifier: uninitialized /etc detected, skipping
All rules containing unresolvable specifiers will be skipped.
( 9/11) Reloading device manager configuration...
Skipped: Device manager is not running.
(10/11) Arming ConditionNeedsUpdate...
(11/11) Updating the info directory file...
Successfully installed bundler-1.16.2
1 gem installed
Cache directory: /var/cache/pacman/pkg/
:: Do you want to remove ALL files from cache? [y/N]
Database directory: /var/lib/pacman/
:: Do you want to remove unused repositories? [Y/n]
removing unused sync repositories...
Removing intermediate container b18a1c4585ee
---> f6937487ce2c
Step 7/12 : COPY ./ /srv/
---> 6bb96498a4b5
Step 8/12 : RUN cd /srv && rm -rf vendor && bundle config build.nokogiri --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xslt-include=/usr/include/libxslt --with-exslt-include=/usr/include/libexslt --with-xml2-lib=/usr/lib/libxml2.so && bundle install --path=vendor --jobs=1 --binstubs
---> Running in 187980e45717
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Fetching gem metadata from https://rubygems.org/.........
Fetching rake 12.3.1
Installing rake 12.3.1
Fetching public_suffix 3.0.2
Installing public_suffix 3.0.2
Fetching addressable 2.5.2
Installing addressable 2.5.2
Fetching amq-protocol 2.3.0
Installing amq-protocol 2.3.0
Fetching builder 3.2.3
Installing builder 3.2.3
Using bundler 1.16.2
Fetching bunny 2.11.0
Installing bunny 2.11.0
Fetching byebug 10.0.2
Installing byebug 10.0.2 with native extensions
Fetching coderay 1.1.2
Installing coderay 1.1.2
Fetching colored 1.2
Installing colored 1.2
Fetching command_line_reporter 4.0.0
Installing command_line_reporter 4.0.0
Fetching concurrent-ruby 1.0.5
Installing concurrent-ruby 1.0.5
Fetching connection_pool 2.2.2
Installing connection_pool 2.2.2
Fetching safe_yaml 1.0.4
Installing safe_yaml 1.0.4
Fetching crack 0.4.3
Installing crack 0.4.3
Fetching daemons 1.2.6
Installing daemons 1.2.6
Fetching diff-lcs 1.3
Installing diff-lcs 1.3
Fetching dotenv 2.5.0
Installing dotenv 2.5.0
Fetching eventmachine 1.2.7
Installing eventmachine 1.2.7 with native extensions
Fetching multipart-post 2.0.0
Installing multipart-post 2.0.0
Fetching faraday 0.15.2
Installing faraday 0.15.2
Fetching ffi 1.9.25
Installing ffi 1.9.25 with native extensions
Fetching gyoku 1.3.1
Installing gyoku 1.3.1
Fetching hashdiff 0.3.7
Installing hashdiff 0.3.7
Fetching hashie 3.5.7
Installing hashie 3.5.7
Fetching jwt 2.1.0
Installing jwt 2.1.0
Fetching memory_profiler 0.9.10
Installing memory_profiler 0.9.10
Fetching method_source 0.9.0
Installing method_source 0.9.0
Fetching mini_portile2 2.3.0
Installing mini_portile2 2.3.0
Fetching mustermann 1.0.2
Installing mustermann 1.0.2
Fetching nokogiri 1.8.4
Installing nokogiri 1.8.4 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /srv/vendor/ruby/2.5.0/gems/nokogiri-1.8.4/ext/nokogiri
/usr/bin/ruby -r ./siteconf20180709-1-199bolx.rb extconf.rb
--use-system-libraries --with-xml2-include=/usr/include/libxml2
--with-xslt-include=/usr/include/libxslt
--with-exslt-include=/usr/include/libexslt --with-xml2-lib=/usr/lib/libxml2.so
checking if the C compiler accepts ... yes
Building nokogiri using system libraries.
ERROR: cannot discover where libxml2 is located on your system. please make sure
`pkg-config` is installed.
*** 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/bin/$(RUBY_BASE_NAME)
--help
--clean
--use-system-libraries
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--with-xml2-dir
--without-xml2-dir
--with-xml2-include=${xml2-dir}/include
--with-xml2-lib=${xml2-dir}/lib
--with-xslt-dir
--without-xslt-dir
--with-xslt-include=${xslt-dir}/include
--with-xslt-lib
--without-xslt-lib=${xslt-dir}/lib
--with-exslt-dir
--without-exslt-dir
--with-exslt-include=${exslt-dir}/include
--with-exslt-lib
--without-exslt-lib=${exslt-dir}/lib
To see why this extension failed to compile, please check the mkmf.log which can
be found here:
/srv/vendor/ruby/2.5.0/extensions/x86_64-linux/2.5.0/nokogiri-1.8.4/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /srv/vendor/ruby/2.5.0/gems/nokogiri-1.8.4
for inspection.
Results logged to
/srv/vendor/ruby/2.5.0/extensions/x86_64-linux/2.5.0/nokogiri-1.8.4/gem_make.out
An error occurred while installing nokogiri (1.8.4), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.8.4' --source
'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
nokogiri
The command '/bin/sh -c cd /srv && rm -rf vendor && bundle config build.nokogiri --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xslt-include=/usr/include/libxslt --with-exslt-include=/usr/include/libexslt --with-xml2-lib=/usr/lib/libxml2.so && bundle install --path=vendor --jobs=1 --binstubs' returned a non-zero code: 5
Here is a Dockerfile based on your example which have installed nokogiri from Gemfile.
Dockerfile:
FROM archlinux/base
ENV HOME="/srv"
ENV LANG=ru_RU.UTF-8
ENV APP_ENV=production
ENV LANG=ru_RU.UTF-8
ENV PATH=$HOME/sbin:$HOME/bin:$HOME/.gem/ruby/2.5.0/bin:/usr/lib/ruby/gems/2.5.0/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
RUN pacman -Syu --noconfirm libxml2 libxslt pkg-config pkgconf procps-ng iproute2 iputils supervisor ruby make gcc grep postgresql-libs awk && \
gem install bundler --no-ri --no-rdoc --no-document --no-user-install && \
pacman -Scc --noconfirm
COPY Gemfile /srv/
RUN cd /srv && rm -rf vendor && bundle config build.nokogiri --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xslt-include=/usr/include/libxslt && bundle install --path=vendor --jobs=4 --binstubs
Gemfile
source 'https://rubygems.org'
gem 'nokogiri'
Feel free to use it.
So, I decided to start from scratch and removed all options from bundler rm -f $HOME/.bundle/config. Then I started to build docker over and recevied the next message from nokogiri team, where the hint was found: Failed to complete patch task; patch(1) or git(1) is required.
So adding patch and git to pacman options was fired the goal.
...
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /srv/vendor/ruby/2.5.0/gems/nokogiri-1.8.4/ext/nokogiri
/usr/bin/ruby -r ./siteconf20180709-1-dxdiny.rb extconf.rb
checking if the C compiler accepts ... yes
Building nokogiri using packaged libraries.
Using mini_portile version 2.3.0
checking for gzdopen() in -lz... yes
checking for iconv... yes
************************************************************************
IMPORTANT NOTICE:
Building Nokogiri with a packaged version of libxml2-2.9.8
with the following patches applied:
- 0001-Revert-Do-not-URI-escape-in-server-side-includes.patch
Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process and
reinstall nokogiri as follows:
gem install nokogiri -- --use-system-libraries
[--with-xml2-config=/path/to/xml2-config]
[--with-xslt-config=/path/to/xslt-config]
If you are using Bundler, tell it to use the option:
bundle config build.nokogiri --use-system-libraries
bundle install
Note, however, that nokogiri is not fully compatible with arbitrary
versions of libxml2 provided by OS/package vendors.
************************************************************************
Extracting libxml2-2.9.8.tar.gz into
tmp/x86_64-pc-linux-gnu/ports/libxml2/2.9.8... OK
*** 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/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
/srv/vendor/ruby/2.5.0/gems/mini_portile2-2.3.0/lib/mini_portile2/mini_portile.rb:84:in
`apply_patch': Failed to complete patch task; patch(1) or git(1) is required.
(RuntimeError)
from
/srv/vendor/ruby/2.5.0/gems/mini_portile2-2.3.0/lib/mini_portile2/mini_portile.rb:92:in
`block in patch'
from
/srv/vendor/ruby/2.5.0/gems/mini_portile2-2.3.0/lib/mini_portile2/mini_portile.rb:90:in
`each'
from
/srv/vendor/ruby/2.5.0/gems/mini_portile2-2.3.0/lib/mini_portile2/mini_portile.rb:90:in
`patch'
from
/srv/vendor/ruby/2.5.0/gems/mini_portile2-2.3.0/lib/mini_portile2/mini_portile.rb:152:in
`cook'
from extconf.rb:365:in `block (2 levels) in process_recipe'
from extconf.rb:257:in `block in chdir_for_build'
from extconf.rb:256:in `chdir'
from extconf.rb:256:in `chdir_for_build'
from extconf.rb:364:in `block in process_recipe'
from extconf.rb:262:in `tap'
from extconf.rb:262:in `process_recipe'
from extconf.rb:551:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can
be found here:
/srv/vendor/ruby/2.5.0/extensions/x86_64-linux/2.5.0/nokogiri-1.8.4/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /srv/vendor/ruby/2.5.0/gems/nokogiri-1.8.4
for inspection.
Results logged to
/srv/vendor/ruby/2.5.0/extensions/x86_64-linux/2.5.0/nokogiri-1.8.4/gem_make.out
An error occurred while installing nokogiri (1.8.4), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.8.4' --source
'https://rubygems.org/'` succeeds before bundling.
Related
I am trying to run Jekyll and I have the following contents in the Gemfile
source "https://rubygems.org"
gem 'jekyll-auth'
gem 'redcarpet'
gem 'jekyll-lunr-js-search'
gem 'rouge'
gem 'jekyll-sitemap'
I am running bundle install for installing the dependencies specified. Everything works fine until it tries to install a gem called therubyracer. Then the process is stopped by throwing the following error:
Installing nokogiri 1.11.3 (x86_64-darwin)
Fetching libv8 3.16.14.19
Installing libv8 3.16.14.19 with native extensions
Fetching ref 2.0.0
Installing ref 2.0.0
Fetching therubyracer 0.12.3
Installing therubyracer 0.12.3 with native extensions
Gem::Ext::BuildError: 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
./siteconf20210430-34242-1i9kf2u.rb extconf.rb --with-v8-dir\=/usr/local/opt/v8#3.15
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
--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-20/2.6.0/therubyracer-0.12.3/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/therubyracer-0.12.3 for inspection.
Results logged to
/Library/Ruby/Gems/2.6.0/extensions/universal-darwin-20/2.6.0/therubyracer-0.12.3/gem_make.out
An error occurred while installing therubyracer (0.12.3), and Bundler cannot continue.
Make sure that `gem install therubyracer -v '0.12.3' --source 'https://rubygems.org/'` succeeds
before bundling.
In Gemfile:
jekyll-lunr-js-search was resolved to 3.3.0, which depends on
therubyracer
Now for fixing this error, I have tried the following commands as specified in some of the posts
brew install v8-315
gem install libv8 -v '3.16.14.13' -- --with-system-v8
gem install therubyracer -- --with-v8-dir=/usr/local/opt/v8-315
But this is again giving the same error. I have tried
bundle config build.libv8 --with-system-v8
bundle config build.therubyracer --with-v8-dir=$(brew --prefix v8#3.15)
But there is no luck. I tried by specifying the brew based path for v8, in the command as follows:
sudo gem install therubyracer -- --with-v8-dir= /usr/local/Cellar/v8#3.15
Even after doing all these, I am stuck with the same error which says our system version of v8 could not be located.
I am trying this on a Mac machine with BigSur 11.2.3 is installed and the Ruby version is ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20] and gem is of version 3.0.3.
It will be of great help if someone can tell me how this error can be fixed and I can install and run Jekyll successfully.
I encountered same problem two years ago. I found that libv8 3.16.14.19 is not compatible with therubyracer 0.12.3 and wrote a post to record my solution.
Try the following steps:
Clean up your system
gem uninstall -a libv8
gem uninstall -a therubyracer
Install libv8 with specific version before installing therubyracer
gem install libv8 -v '3.16.14.15'
Install therubyracer
gem install therubyracer -v '0.12.3'
Update libv8 to the version specified in your gemfile
bundle
There may still have problem in macOS BigSur 11.2.
If it raises fatal error: 'climits' file not found in Step 2, try this:
gem install libv8 -v '3.16.14.15' -- --with-system-v8
If it raises errors in Step 3, try this:
brew install v8-315
gem install therubyracer -v '0.12.3' -- --with-v8-dir=/usr/local/opt/v8#3.15
I am in a coding bootcamp and I have encountered an error in which I am having a hard time fixing. I currently in an exercise where I am learning how to create dynamic routes. Every time I run my server I am getting errors when I go to my routes and it states that:
Could not find nokogiri-1.8.2 in any of the sources
Run `bundle install` to install missing gems.
I tried to bundle install after adding nokogiri to my gemfile but all I get is this error below. I need some help cause I don't know what is going on and I am a total noob in regards to this stuff.
Ignoring unf_ext-0.0.7.5 because its extensions are not built. Try: gem pristine unf_ext --version 0.0.7.5
Ignoring websocket-driver-0.7.0 because its extensions are not built. Try: gem pristine websocket-driver --version 0.7.0
Fetching gem metadata from http://rubygems.org/........
Using rake 12.3.0
Using concurrent-ruby 1.0.5
Using i18n 0.9.5
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 5.1.5
Using activemodel 5.1.5
Using arel 8.0.0
Using activerecord 5.1.5
Using public_suffix 3.0.2
Using addressable 2.5.2
Using bundler 1.16.6
Using mini_mime 1.0.0
Using mini_portile2 2.3.0
Fetching nokogiri 1.8.2
Installing nokogiri 1.8.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/Users/kenkuts/.rvm/gems/ruby-2.5.0/gems/nokogiri-1.8.2/ext/nokogiri
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r
./siteconf20181215-54662-1izm05e.rb extconf.rb --use-system-libraries
Ignoring unf_ext-0.0.7.5 because its extensions are not built. Try: gem pristine
unf_ext --version 0.0.7.5
Ignoring websocket-driver-0.7.0 because its extensions are not built. Try: gem
pristine websocket-driver --version 0.7.0
checking if the C compiler accepts ... *** 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.3/usr/bin/$(RUBY_BASE_NAME)
--help
--clean
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:456:in
`try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:571:in
`block in try_compile'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:522:in
`with_werror'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:571:in
`try_compile'
from extconf.rb:138:in `nokogiri_try_compile'
from extconf.rb:162:in `block in add_cflags'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:629:in
`with_cflags'
from extconf.rb:161:in `add_cflags'
from extconf.rb:410:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can
be found here:
/Users/kenkuts/.rvm/gems/ruby-2.5.0/extensions/universal-darwin-18/2.3.0/nokogiri-1.8.2/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in
/Users/kenkuts/.rvm/gems/ruby-2.5.0/gems/nokogiri-1.8.2 for inspection.
Results logged to
/Users/kenkuts/.rvm/gems/ruby-2.5.0/extensions/universal-darwin-18/2.3.0/nokogiri-1.8.2/gem_make.out
An error occurred while installing nokogiri (1.8.2), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.8.2' --source 'http://rubygems.org/'`
succeeds before bundling.
In Gemfile:
capybara was resolved to 2.18.0, which depends on
xpath was resolved to 3.0.0, which depends on
nokogiri
You may need to download Xcode from the App Store, and run the commands
xcode-select --install
sudo xcodebuild -license`
The nokogiri install instructions mention this:
https://www.nokogiri.org/tutorials/installing_nokogiri.html#install_with_included_libraries__recommended_
This isn't an "answer" as much as a set of (hopefully) helpful things too long for a comment.
Sandbox your gems
I always run bundler in the following way now, so that one project's dependencies have no impact on the gems I use system wide or on other projects:
bundle install --binstubs --path=vendor.noindex
That will put all executables in PROJECT_DIR/bin and all gems in PROJECT_DIR/vendor.noindex. The "noindex" bit stops Spotlight from indexing the gems. To run rspec would now be:
bin/rspec
To start from a clean slate I run:
rm -rf .bundle bin Gemfile.lock vendor.noindex
Note: Always be careful using an rm -rf!!!!
Installing and finding dependencies
The last time I installed Nokogiri using the gem install command it looked like this:
gem install nokogiri -- \
--use-system-libraries \
--with-xml2-include=/opt/pkg/include/libxml2 \
--with-xml2-lib=/opt/pkg/lib \
--with-xslt-include=/opt/pkg/include/libxslt \
--with-xslt-lib=/opt/pkg/lib
As other commenters have noticed, this shows that you need XCode installed (always worth checking for updates) and that I've used libraries installed by another package manager (I've used pkgrsc above though you could use Macports or Homebrew and maybe some others).
To find the libs you need to link to try running:
find `/usr` -name libxml2 -type d 2> >(grep -v 'Permission denied' >&2)
Or change the /usr to /opt if you're installing there via pkgsrc/Macports/Fink etc. You may need to put a sudo in front depending on the permissions.
There's also the locate command, e.g.
locate libxml2
Which will bring up lots of stuff.
I am installing one app and I was in this step that I should run bundle install and I get this error
enter code here➜ mavatar git:(master) ✗ bundle install
Fetching gem metadata from http://rubygems.org/
Fetching version metadata from http://rubygems.org/
Fetching dependency metadata from http://rubygems.org/
Using rake 0.9.2
Using multi_json 1.8.2
Using bcrypt-ruby 3.0.1
Using builder 3.0.4
Using i18n 0.6.5
Using erubis 2.7.0
Using rack 1.3.6
Using hike 1.2.1
Using tilt 1.3.3
Installing nokogiri 1.5.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/farbodi/.rvm/gems/ruby-2.3.0-
dev/gems/nokogiri-1.5.0/ext/nokogiri
/home/farbodi/.rvm/rubies/ruby-2.3.0-dev/bin/ruby -r
./siteconf20160806-31805-mdcnrl.rb extconf.rb
*** 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=/home/farbodi/.rvm/rubies/ruby-2.3.0-dev/bin/$(RUBY_BASE_NAME)
extconf.rb:10:in `<main>': uninitialized constant Config (NameError)
Did you mean? RbConfig
CONFIG
extconf failed, exit code 1
Gem files will remain installed in /home/farbodi/.rvm/gems/ruby-
2.3.0-dev/gems/nokogiri-1.5.0 for inspection.
Results logged to /home/farbodi/.rvm/gems/ruby-2.3.0-
dev/extensions/x86_64-linux/2.3.0/nokogiri-1.5.0/gem_make.out
Your Gemfile.lock is corrupt. The following gems are missing from the
DEPENDENCIES section: 'archive-tar-minitar' 'hoe' 'rcov'
So I tried to run this : gem update
gem install hoe
gem install rcov
gem install archive-tar-minitar
gem install nokogiri -v 1.5.0 which gives me ERROR: Failed to build gem native extension. error
I also installed bundle older version, I can pass this step but I get same problem in somewhere else.
I also used rvm and my ruby version is ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux] , And Bundler version 1.12.5
I am new to ruby and gem and bundle I am all confused and I don't know how to start to learn what is going on and how to solve the errors.
You need to install some system packages.
If you are using redhat based, install libxml2 and libxslt and zlib-devel
and if you are using debian based, install zlib1g-dev and liblzma-dev packages
I ran into a problem installing libvirt plugin at vagrant version 1.8.1 using the following command:
vagrant plugin install --verbose vagrant-libvirt
This is the output I get:
Installing the 'vagrant-libvirt' plugin. This can take a few
minutes... Warning: this Gemfile contains multiple primary sources.
Using source more tha n once without a block is a security risk, and
may result in installing unexpect ed gems. To resolve this warning,
use a block to indicate which gems should come from the secondary
source. To upgrade this warning to an error, run bundle con fig
disable_multisource true. Fetching source index from
http://gems.hashicorp.com/ Fetching gem metadata from
https://rubygems.org/.......... Fetching version metadata from
https://rubygems.org/...... Fetching version metadata from
https://rubygems.org/.. Resolving dependencies....... Using builder
3.2.2 Using bundler 1.10.6 Using ffi 1.9.10 Using childprocess 0.5.9 Using erubis 2.7.0 Using excon 0.45.4 Using formatador 0.2.5 Using
fog-core 1.36.0 Using multi_json 1.11.2 Using fog-json 1.0.2 Using
mini_portile 0.6.0 Using nokogiri 1.6.3.1 Using fog-xml 0.1.2 Using
json 1.8.3 Installing ruby-libvirt 0.6.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
C:/HashiCorp/Vagrant/embedded/bin/ruby.exe -r ./siteconf20160225-6712-1ph8sm p.rb extconf.rb
* 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=C:/HashiCorp/Vagrant/embedded/bin/$(RUBY_BASE_NAME)
--with-libvirt-include
--without-libvirt-include
--with-libvirt-lib
--without-libvirt-lib
--with-libvirt-config
--without-libvirt-config
--with-pkg-config
--without-pkg-config extconf.rb:73:in `': libvirt library not found in default locations (Runti meError)
extconf failed, exit code 1
Gem files will remain installed in
C:/Users/Z003H1ZT/.vagrant.d/gems/gems/ruby-l ibvirt-0.6.0 for
inspection. Results logged to
C:/Users/Z003H1ZT/.vagrant.d/gems/extensions/x86-mingw32/2.2.0
/ruby-libvirt-0.6.0/gem_make.out Bundler, the underlying system
Vagrant uses to install plugins, reported an error. The error is shown
below. These errors are usually caused by misconfigured plugin
installations or transient network issues. The error from Bundler is:
An error occurred while installing ruby-libvirt (0.6.0), and Bundler
cannot cont inue. Make sure that gem install ruby-libvirt -v '0.6.0'
succeeds before bundling.
Other people having issues installing libvirt plugin on newly updated vagrant here.
As a second approach I tried to install the plugin offline with a downloaded vagrant-libvirt gem file using
vagrant plugin install vagrant-libvirt-0.0.32.gem
But there also appears an error:
Installing the 'vagrant-libvirt-0.0.32.gem' plugin. This can take a
few minutes. ..
C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/rubygems/resolver.rb:439:in
resolv e_for_zero': Unable to resolve dependency: 'vagrant-libvirt (=
0.0.32)' requires 'fog-libvirt (~> 0.0.1)' (Gem::UnsatisfiableDependencyError)
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/rubygems/resolver.rb:3
50:inresolve_for'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/rubygems/resolver.rb:1
96:in resolve'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/rubygems/request_set.r
b:358:inresolve'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/rubygems/dependency_in
staller.rb:473:in resolve_dependencies'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/rubygems/dependency_in
staller.rb:373:ininstall'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/b
undler.rb:129:in block in install_local'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/b
undler.rb:284:inblock in with_isolated_gem'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/rubygems/user_interact
ion.rb:45:in use_ui'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/b
undler.rb:283:inwith_isolated_gem'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/b
undler.rb:126:in install_local'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/p
lugin/manager.rb:47:ininstall_plugin'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/plugins/comma
nds/plugin/action/install_gem.rb:37:in call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/a
ction/warden.rb:34:incall'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/a
ction/builder.rb:116:in call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/a
ction/runner.rb:66:inblock in run'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/u
til/busy.rb:19:in busy'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/a
ction/runner.rb:66:inrun'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/plugins/comma
nds/plugin/command/base.rb:14:in action'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/plugins/comma
nds/plugin/command/install.rb:32:inblock in execute'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/plugins/comma
nds/plugin/command/install.rb:31:in each'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/plugins/comma
nds/plugin/command/install.rb:31:inexecute'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/plugins/comma
nds/plugin/command/root.rb:56:in execute'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/c
li.rb:42:inexecute'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/e
nvironment.rb:302:in cli'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/bin/vagrant:1
74:in'
Are there some suggestion what I am doing wrong or a different approach?
After update to OS X 10.10 Yosemite I can't install nokogiri (1.6.3.1)
> bundle
Building nokogiri using packaged libraries.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/ju/.rvm/rubies/ruby-2.1.2/bin/ruby 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/ju/.rvm/rubies/ruby-2.1.2/bin/ruby
--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/ju/.rvm/gems/ruby-2.1.2#sumup/gems/nokogiri-1.6.3.1 for inspection.
Results logged to /Users/ju/.rvm/gems/ruby-2.1.2#sumup/extensions/x86_64-darwin-13/2.1.0-static/nokogiri-1.6.3.1/gem_make.out
An error occurred while installing nokogiri (1.6.3.1), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.3.1'` succeeds before bundling.
> brew update
> brew install libxml2 libxslt libiconv
> brew --prefix libxml2
/usr/local/opt/libxml2
> brew --prefix libxslt
/usr/local/opt/libxslt
> brew --prefix libiconv
/usr/local/opt/libiconv
> gem uninstall nokogiri
> gem install nokogiri -v 1.6.3.1 -- --with-xslt-dir=/usr/local/opt/libxslt --with-iconv-dir=/usr/local/opt/libiconv --with-xml2-config=/usr/local/opt/libxml2/bin/xml2-config --with-xslt-config=/usr/local/opt/libxslt/bin/xslt-config
Based on: Mac fix 1 - Install the Nokogiri gem on Mac OS 10.9 Mavericks
Other solution:
> gem install nokogiri -v 1.6.3.1 -- --use-system-libraries --with-xml2-include=/usr/local/opt/libxml2/include/libxml2/
Another solution from comments:
> xcode-select --install gem install nokogiri
The following worked for me on Yosemite 10.10.3:
sudo gem install nokogiri -- --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/libxml2 --use-system-libraries
It was taken from the Nokogiri issues tracker.
brew update
brew install libxml2 libxslt libiconv
brew --prefix libxml2
/usr/local/opt/libxml2
brew --prefix libxslt
/usr/local/opt/libxslt
brew --prefix libiconv
/usr/local/opt/libiconv
gem uninstall nokogiri
gem install nokogiri -v 1.6.3.1 -- --with-xslt-dir=/usr/local/opt/libxslt --with-iconv-dir=/usr/local/opt/libiconv --with-xml2-config=/usr/local/opt/libxml2/bin/xml2-config --with-xslt-config=/usr/local/opt/libxslt/bin/xslt-config
In case you are using bundle install --path vendor/bundle to install gems into local folder and get error
Building nokogiri using packaged libraries.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
Then, you need to do following to use
bundle config build.nokogiri --use-system-libraries
bundle install --path vendor/bundle
Then install will pass with
Fetching nokogiri 1.6.3.1
Installing nokogiri 1.6.3.1 with native extensions
Building nokogiri using system libraries.