bundle install fails on nokogumbo
With gitlabhq-10.8.5 and gitlabhq-11.0.2 I get this error during bundle install:
Installing nokogumbo 1.5.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/var/tmp/portage/www-apps/gitlabhq-10.8.5/image/opt/gitlabhq-10.8/vendor/bundle/ruby/2.3.0/gems/nokogumbo-1.5.0/ext/nokogumboc
/usr/bin/ruby23 -r ./siteconf20180628-9281-1lkrmph.rb extconf.rb
checking for xmlNewDoc() in -lxml2... yes
checking for nokogiri.h in
/var/tmp/portage/www-apps/gitlabhq-10.8.5/image/opt/gitlabhq-10.8/vendor/bundle/ruby/2.3.0/gems/nokogiri-1.8.2/ext/nokogiri...
yes
checking for nokogiri.h in
/var/tmp/portage/www-apps/gitlabhq-10.8.5/image/opt/gitlabhq-10.8/vendor/bundle/ruby/2.3.0/gems/nokogiri-1.8.2/ext/nokogiri...
yes
checking for gumbo_parse() in -lgumbo... no
checking for GumboErrorType with error.h... not found
checking for GumboInsertionMode with insertion_mode.h... not found
checking for GumboParser with parser.h... not found
checking for GumboStringBuffer with string_buffer.h... not found
checking for GumboTokenType with token_type.h... not found
creating Makefile
current directory:
/var/tmp/portage/www-apps/gitlabhq-10.8.5/image/opt/gitlabhq-10.8/vendor/bundle/ruby/2.3.0/gems/nokogumbo-1.5.0/ext/nokogumboc
make "DESTDIR=" clean
current directory:
/var/tmp/portage/www-apps/gitlabhq-10.8.5/image/opt/gitlabhq-10.8/vendor/bundle/ruby/2.3.0/gems/nokogumbo-1.5.0/ext/nokogumboc
make "DESTDIR="
compiling attribute.c
compiling char_ref.c
compiling error.c
compiling nokogumbo.c
In file included from nokogumbo.c:31:0:
/var/tmp/portage/www-apps/gitlabhq-10.8.5/image/opt/gitlabhq-10.8/vendor/bundle/ruby/2.3.0/gems/nokogiri-1.8.2/ext/nokogiri/nokogiri.h:13:0:
warning: "_GNU_SOURCE" redefined
#define _GNU_SOURCE
In file included from /usr/include/ruby-2.3.0/ruby/ruby.h:24:0,
from /usr/include/ruby-2.3.0/ruby.h:33,
from nokogumbo.c:21:
/usr/include/ruby-2.3.0/x86_64-linux/ruby/config.h:17:0: note: this is the location of the previous
definition
#define _GNU_SOURCE 1
compiling parser.c
compiling string_buffer.c
compiling string_piece.c
compiling tag.c
compiling tokenizer.c
compiling utf8.c
compiling util.c
compiling vector.c
linking shared-object nokogumboc.so
nokogumbo.o: In function `parse':
nokogumbo.c:(.text+0x44b): undefined reference to `Nokogiri_wrap_xml_document'
collect2: error: ld returned 1 exit status
make: *** [Makefile:256: nokogumboc.so] Error 1
make failed, exit code 2
Gem files will remain installed in
/var/tmp/portage/www-apps/gitlabhq-10.8.5/image/opt/gitlabhq-10.8/vendor/bundle/ruby/2.3.0/gems/nokogumbo-1.5.0
for inspection.
Results logged to
/var/tmp/portage/www-apps/gitlabhq-10.8.5/image/opt/gitlabhq-10.8/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/nokogumbo-1.5.0/gem_make.out
An error occurred while installing nokogumbo (1.5.0), and Bundler cannot continue.
Make sure that `gem install nokogumbo -v '1.5.0' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
gitlab-gollum-lib was resolved to 4.2.7.5, which depends on
sanitize was resolved to 4.6.5, which depends on
nokogumbo
* ERROR: www-apps/gitlabhq-10.8.5::gitlab failed (install phase):
* bundler failed
*
* Call stack:
* ebuild.sh, line 124: Called src_install
* environment, line 6976: Called ruby-ng_src_install
* environment, line 6764: Called _ruby_each_implementation 'each_ruby_install'
* environment, line 750: Called _ruby_invoke_environment 'ruby23' 'each_ruby_install'
* environment, line 875: Called each_ruby_install
* environment, line 1254: Called die
* The specific snippet of code:
* ${BUNDLE} install ${bundle_args} || die "bundler failed";
*
Inspired by this line
$ grep no-undefined /usr/portage/dev-ruby/nokogumbo/nokogumbo-1.5.0.ebuild
sed -i -e 's:-Wl,--no-undefined::' ext/nokogumboc/Makefile || die
of the nokogumbo ebuild I searched for the current ldflags of the failed nokogumbo install:
$ grep no-undefined /var/tmp/portage/www-apps/gitlabhq-10.8.5/image/opt/gitlabhq-10.8/vendor/bundle/ruby/2.3.0/gems/nokogumbo-1.5.0/ext/nokogumboc/Makefile
ldflags = -L. -Wl,-O1 -Wl,--as-needed -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,--no-undefined
removed -Wl,--no-undefined
from them and added this line to the each_ruby_install()
function of the gitlabhq-10.8.5.ebuild
:
${BUNDLE} config build.nokogumbo --with-ldflags='-L. -Wl,-O1 -Wl,--as-needed -fstack-protector -rdynamic -Wl,-export-dynamic'
and the bundle install finished without error.