Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.12.0 installation failure on FreeBSD 13/ruby 3.0.2 #2298

Closed
ghost opened this issue Aug 2, 2021 · 12 comments
Closed

v1.12.0 installation failure on FreeBSD 13/ruby 3.0.2 #2298

ghost opened this issue Aug 2, 2021 · 12 comments
Labels

Comments

@ghost
Copy link

ghost commented Aug 2, 2021

Have you read and followed the installation tutorial at http://www.nokogiri.org/tutorials/installing_nokogiri.html?

What is the complete output of gem install or bundle install?

stevewi@barney:~ $ gem install nokogiri
Fetching nokogiri-1.12.0.gem
Building native extensions. This could take a while...
ERROR:  Error installing nokogiri:
	ERROR: Failed to build gem native extension.

    current directory: /home/stevewi/.gems/gems/nokogiri-1.12.0/ext/nokogiri
/usr/local/bin/ruby -I /usr/local/lib/ruby/3.0.0 -r ./siteconf20210802-4071-papk4d.rb extconf.rb
checking for whether -g is accepted as CFLAGS... yes
checking for whether -Winline is accepted as CFLAGS... yes
checking for whether -Wmissing-noreturn is accepted as CFLAGS... yes
Building nokogiri using packaged libraries.
Static linking is enabled.
Cross build is disabled.
checking for gzdopen() in -lz... yes
Using mini_portile version 2.6.1
checking for iconv... yes
---------- IMPORTANT NOTICE ----------
Building Nokogiri with a packaged version of libxml2-2.9.12.
Configuration options: --host\=x86_64-unknown-freebsd13.0 --enable-static --disable-shared --libdir\=/usr/home/stevewi/.gems/gems/nokogiri-1.12.0/ports/x86_64-unknown-freebsd13.0/libxml2/2.9.12/lib --with-iconv\=yes --disable-dependency-tracking --without-python --without-readline --with-c14n --with-debug --with-threads --disable-shared --enable-static CFLAGS\=-O2\ -U_FORTIFY_SOURCE\ -g\ -fPIC
The following patches are being applied:
  - 0001-Remove-script-macro-support.patch
  - 0002-Update-entities-to-remove-handling-of-ssi.patch
  - 0003-libxml2.la-is-in-top_builddir.patch
  - 0004-use-glibc-strlen.patch
  - 0005-avoid-isnan-isinf.patch
  - 0006-update-automake-files-for-arm64.patch
  - 0007-Fix-XPath-recursion-limit.patch

The Nokogiri maintainers intend to provide timely security updates, but if
this is a concern for you and want to use your OS/distro system library
instead, then abort this installation process and install nokogiri as
instructed at:

  https://nokogiri.org/tutorials/installing_nokogiri.html#installing-using-standard-system-libraries

Note, however, that nokogiri cannot guarantee compatibility with every
version of libxml2 that may be provided by OS/package vendors.

Extracting libxml2-2.9.12.tar.gz into tmp/x86_64-unknown-freebsd13.0/ports/libxml2/2.9.12... OK
Running git apply with /usr/home/stevewi/.gems/gems/nokogiri-1.12.0/patches/libxml2/0001-Remove-script-macro-support.patch... OK
Running git apply with /usr/home/stevewi/.gems/gems/nokogiri-1.12.0/patches/libxml2/0002-Update-entities-to-remove-handling-of-ssi.patch... OK
Running git apply with /usr/home/stevewi/.gems/gems/nokogiri-1.12.0/patches/libxml2/0003-libxml2.la-is-in-top_builddir.patch... OK
Running git apply with /usr/home/stevewi/.gems/gems/nokogiri-1.12.0/patches/libxml2/0004-use-glibc-strlen.patch... OK
Running git apply with /usr/home/stevewi/.gems/gems/nokogiri-1.12.0/patches/libxml2/0005-avoid-isnan-isinf.patch... OK
Running git apply with /usr/home/stevewi/.gems/gems/nokogiri-1.12.0/patches/libxml2/0006-update-automake-files-for-arm64.patch... OK
Running git apply with /usr/home/stevewi/.gems/gems/nokogiri-1.12.0/patches/libxml2/0007-Fix-XPath-recursion-limit.patch... OK
Running 'configure' for libxml2 2.9.12... OK
Running 'compile' for libxml2 2.9.12... OK
Running 'install' for libxml2 2.9.12... OK
Activating libxml2 2.9.12 (from /usr/home/stevewi/.gems/gems/nokogiri-1.12.0/ports/x86_64-unknown-freebsd13.0/libxml2/2.9.12)...
Using mini_portile version 2.6.1
---------- IMPORTANT NOTICE ----------
Building Nokogiri with a packaged version of libxslt-1.1.34.
Configuration options: --host\=x86_64-unknown-freebsd13.0 --enable-static --disable-shared --libdir\=/usr/home/stevewi/.gems/gems/nokogiri-1.12.0/ports/x86_64-unknown-freebsd13.0/libxslt/1.1.34/lib --disable-dependency-tracking --without-python --without-crypto --with-debug --with-libxml-prefix\=/usr/home/stevewi/.gems/gems/nokogiri-1.12.0/ports/x86_64-unknown-freebsd13.0/libxml2/2.9.12 --disable-shared --enable-static CFLAGS\=-O2\ -U_FORTIFY_SOURCE\ -g\ -fPIC
The following patches are being applied:
  - 0001-update-automake-files-for-arm64.patch
  - 0002-Fix-xml2-config-check-in-configure-script.patch

The Nokogiri maintainers intend to provide timely security updates, but if
this is a concern for you and want to use your OS/distro system library
instead, then abort this installation process and install nokogiri as
instructed at:

  https://nokogiri.org/tutorials/installing_nokogiri.html#installing-using-standard-system-libraries

Extracting libxslt-1.1.34.tar.gz into tmp/x86_64-unknown-freebsd13.0/ports/libxslt/1.1.34... OK
Running git apply with /usr/home/stevewi/.gems/gems/nokogiri-1.12.0/patches/libxslt/0001-update-automake-files-for-arm64.patch... OK
Running git apply with /usr/home/stevewi/.gems/gems/nokogiri-1.12.0/patches/libxslt/0002-Fix-xml2-config-check-in-configure-script.patch... OK
Running 'configure' for libxslt 1.1.34... OK
Running 'compile' for libxslt 1.1.34... OK
Running 'install' for libxslt 1.1.34... OK
Activating libxslt 1.1.34 (from /usr/home/stevewi/.gems/gems/nokogiri-1.12.0/ports/x86_64-unknown-freebsd13.0/libxslt/1.1.34)...
checking for whether -DNOKOGIRI_PACKAGED_LIBRARIES is accepted as CPPFLAGS... yes
checking for whether -DNOKOGIRI_LIBXML2_PATCHES="\"0001-Remove-script-macro-support.patch 0002-Update-entities-to-remove-handling-of-ssi.patch 0003-libxml2.la-is-in-top_builddir.patch 0004-use-glibc-strlen.patch 0005-avoid-isnan-isinf.patch 0006-update-automake-files-for-arm64.patch 0007-Fix-XPath-recursion-limit.patch\"" is accepted as CPPFLAGS... yes
checking for -llzma... yes
checking for whether -DNOKOGIRI_LIBXSLT_PATCHES="\"0001-update-automake-files-for-arm64.patch 0002-Fix-xml2-config-check-in-configure-script.patch\"" is accepted as CPPFLAGS... yes
checking for xmlParseDoc() in libxml/parser.h... yes
checking for xsltParseStylesheetDoc() in libxslt/xslt.h... yes
checking for exsltFuncRegister() in libexslt/exslt.h... yes
Using mini_portile version 2.6.1
---------- IMPORTANT NOTICE ----------
Building Nokogiri with a packaged version of libgumbo-1.0.0-nokogiri.
Configuration options: --disable-shared --enable-static CFLAGS\=-fPIC
Copying gumbo-parser files into tmp/x86_64-unknown-freebsd13.0/ports/libgumbo/1.0.0-nokogiri/gumbo-parser...
Running 'compile' for libgumbo 1.0.0-nokogiri... ERROR, review '/usr/home/stevewi/.gems/gems/nokogiri-1.12.0/ext/nokogiri/tmp/x86_64-unknown-freebsd13.0/ports/libgumbo/1.0.0-nokogiri/compile.log' to see what happened. Last lines are:
========================================================================
make: "/usr/home/stevewi/.gems/gems/nokogiri-1.12.0/ext/nokogiri/tmp/x86_64-unknown-freebsd13.0/ports/libgumbo/1.0.0-nokogiri/gumbo-parser/Makefile" line 5: Need an operator
make: Fatal errors encountered -- cannot continue
make: stopped in /usr/home/stevewi/.gems/gems/nokogiri-1.12.0/ext/nokogiri/tmp/x86_64-unknown-freebsd13.0/ports/libgumbo/1.0.0-nokogiri/gumbo-parser
========================================================================
*** 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_BASE_NAME)
	--help
	--clean
	--prevent-strip
	--enable-system-libraries
	--disable-system-libraries
	--use-system-libraries
	--enable-system-libraries
	--disable-system-libraries
	--use-system-libraries
	--enable-static
	--disable-static
	--enable-cross-build
	--disable-cross-build
	--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-source-dir
	--with-xslt-source-dir
	--enable-cross-build
	--disable-cross-build
/usr/local/lib/ruby/gems/3.0.0/gems/mini_portile2-2.6.1/lib/mini_portile2/mini_portile.rb:443:in `block in execute': Failed to complete compile task (RuntimeError)
	from /usr/local/lib/ruby/gems/3.0.0/gems/mini_portile2-2.6.1/lib/mini_portile2/mini_portile.rb:409:in `chdir'
	from /usr/local/lib/ruby/gems/3.0.0/gems/mini_portile2-2.6.1/lib/mini_portile2/mini_portile.rb:409:in `execute'
	from extconf.rb:937:in `compile'
	from /usr/local/lib/ruby/gems/3.0.0/gems/mini_portile2-2.6.1/lib/mini_portile2/mini_portile.rb:180:in `cook'
	from extconf.rb:511:in `block (2 levels) in process_recipe'
	from extconf.rb:296:in `block in chdir_for_build'
	from extconf.rb:295:in `chdir'
	from extconf.rb:295:in `chdir_for_build'
	from extconf.rb:511:in `block in process_recipe'
	from <internal:kernel>:90:in `tap'
	from extconf.rb:415:in `process_recipe'
	from extconf.rb:896:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/stevewi/.gems/extensions/x86_64-freebsd-13/3.0.0-static/nokogiri-1.12.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/stevewi/.gems/gems/nokogiri-1.12.0 for inspection.
Results logged to /home/stevewi/.gems/extensions/x86_64-freebsd-13/3.0.0-static/nokogiri-1.12.0/gem_make.out

If installation completed but is broken, what is the complete output from nokogiri -v?

n/a

If installation failed during compilation, what are the complete contents of the mkmf.log file generated during the failed installation?

The mkmf.log file is attached.

Tell us about your system!

What is the output from ruby -v?

ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-freebsd13.0]

What is the output from gem -v?

stevewi@barney:~ $ gem -v
3.2.22

What is the output from gem env?

stevewi@barney:~ $ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 3.2.22
  - RUBY VERSION: 3.0.2 (2021-07-07 patchlevel 107) [x86_64-freebsd13.0]
  - INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/3.0.0
  - USER INSTALLATION DIRECTORY: /root/.local/share/gem/ruby/3.0.0
  - RUBY EXECUTABLE: /usr/local/bin/ruby
  - GIT EXECUTABLE: /usr/local/bin/git
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - SPEC CACHE DIRECTORY: /root/.local/share/gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /usr/local/etc
  - RUBYGEMS PLATFORMS:
     - ruby
     - x86_64-freebsd-13
  - GEM PATHS:
     - /usr/local/lib/ruby/gems/3.0.0
     - /root/.local/share/gem/ruby/3.0.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - .
     - /home/stevewi/bin
     - /home/stevewi/sbin
     - /sbin
     - /bin
     - /usr/sbin
     - /usr/bin
     - /usr/local/sbin
     - /usr/local/bin
     - /home/stevewi/bin

If you're using Bundler:

  • what is the output from bundle version?
stevewi@barney:~ $ bundle version
Bundler version 2.2.25 (2021-07-30 commit 7f0f257c7a)
  • what is the output from bundle config? (Take care to redact any credentials)
n/a

If Linux or a BSD variant, please note:

  • the distro you're using
FreeBSD 13
  • the output of uname -a
stevewi@barney:~ $ uname -a
FreeBSD barney.niteflyte.net 13.0-RELEASE-p3 FreeBSD 13.0-RELEASE-p3 #0: Sun Aug  1 21:08:49 PDT 2021     root@barney.niteflyte.net:/usr/obj/usr/src/amd64.amd64/sys/Barney  amd64
  • the contents of /etc/lsb-release.
n/a for FreeBSD
@ghost ghost added the topic/installation Installation difficulties label Aug 2, 2021
@ghost ghost changed the title [install] Install fails on FreeBSD 13/ruby 3.0.2 Aug 2, 2021
@ghost
Copy link
Author

ghost commented Aug 2, 2021

Hopefully, this is just a simple dependency issue but I installed all the dependencies listed. The version of Nokogiri in /usr/ports is for ruby 2.7.4.

@flavorjones
Copy link
Member

@caponecicero Thanks for reporting this. I need to spend a bit more time to try to reproduce this, but based on a quick scan, it looks like libgumbo is failing to compile, and so you can work around this by using Nokogiri v1.11.x (because libgumbo was introduced in v1.12.0).

@flavorjones flavorjones changed the title Install fails on FreeBSD 13/ruby 3.0.2 v1.12.0 installation failure on FreeBSD 13/ruby 3.0.2 Aug 2, 2021
@ghost
Copy link
Author

ghost commented Aug 2, 2021

you can work around this by using Nokogiri v1.11.x (because libgumbo was introduced in v1.12.0).

Thanks. That got me moving forward again.

@flavorjones
Copy link
Member

OK, key lines from the install log are here:

Running 'compile' for libgumbo 1.0.0-nokogiri... ERROR, review '/usr/home/stevewi/.gems/gems/nokogiri-1.12.0/ext/nokogiri/tmp/x86_64-unknown-freebsd13.0/ports/libgumbo/1.0.0-nokogiri/compile.log' to see what happened. Last lines are:
========================================================================
make: "/usr/home/stevewi/.gems/gems/nokogiri-1.12.0/ext/nokogiri/tmp/x86_64-unknown-freebsd13.0/ports/libgumbo/1.0.0-nokogiri/gumbo-parser/Makefile" line 5: Need an operator
make: Fatal errors encountered -- cannot continue
make: stopped in /usr/home/stevewi/.gems/gems/nokogiri-1.12.0/ext/nokogiri/tmp/x86_64-unknown-freebsd13.0/ports/libgumbo/1.0.0-nokogiri/gumbo-parser
========================================================================
*** extconf.rb failed ***

even more specifically:

libgumbo/1.0.0-nokogiri/gumbo-parser/Makefile" line 5: Need an operator

I just reproduced this in a VM, trying to diagnose now.

@stevecheckoway
Copy link
Contributor

Without looking, I'm going to guess that it's a difference between BSDMake and GNUMake.

@flavorjones
Copy link
Member

difference between BSDMake and GNUMake

Sigh, I concur. The line in question is

override CFLAGS += -std=c99 -Wall

which is very much a Gnu-ism.

@stevecheckoway
Copy link
Contributor

It's a shame BSDMake and GNUMake are essentially incompatible, but it's been that way forever (for an appropriate value of forever).

Is there a way to do this entirely via extconf.rb?

@flavorjones
Copy link
Member

@stevecheckoway Yup, I'm going to move this config into extconf.rb ... please hold.

@flavorjones
Copy link
Member

Actually, since 5c6f7c1 started passing CFLAGS as part of the environment (not on the command line), we no longer need the override and this should just work without it.

flavorjones added a commit that referenced this issue Aug 3, 2021
flavorjones added a commit that referenced this issue Aug 3, 2021
since 5c6f7c1 when we started passing CFLAGS, et al through
environment variables instead of through the make command line.

Although this wasn't doing any harm on gnu-based systems, `override`
is a gnu-ism and we need to support builds on bsd systems.

Related to #2298
flavorjones added a commit that referenced this issue Aug 3, 2021
The wildcard and patsubst functions, as well as $^, don't work in BSD
make. Let's just inline everything to make it simple and portable.

Related to #2298
@flavorjones
Copy link
Member

PR fix is #2299, currently going through CI.

flavorjones added a commit that referenced this issue Aug 3, 2021
since 5c6f7c1 when we started passing CFLAGS, et al through
environment variables instead of through the make command line.

Although this wasn't doing any harm on gnu-based systems, `override`
is a gnu-ism and we need to support builds on bsd systems.

Related to #2298
flavorjones added a commit that referenced this issue Aug 3, 2021
The wildcard and patsubst functions, as well as $^, don't work in BSD
make. Let's just inline everything to make it simple and portable.

Related to #2298
@flavorjones flavorjones added this to the v1.12.x patch releases milestone Aug 3, 2021
@flavorjones
Copy link
Member

Fix is merged, will cut a v1.12.1 release shortly.

@flavorjones
Copy link
Member

v1.12.1 has been released: https://github.com/sparklemotion/nokogiri/releases/tag/v1.12.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants