Closed AlexandreBernard closed 10 years ago
still investigating.. i've tried installing gumbo on the system first. the error changes but remains the same:
$ gem install nokogumbo
Building native extensions. This could take a while...
ERROR: Error installing nokogumbo:
ERROR: Failed to build gem native extension.
/usr/bin/ruby21 extconf.rb
checking for xmlNewDoc() in -lxml2... yes
checking for nokogiri.h in /home/deploy/.gem/ruby/2.1.0/gems/nokogiri-1.6.1/ext/nokogiri... yes
checking for nokogiri.h in /home/deploy/.gem/ruby/2.1.0/gems/nokogiri-1.6.1/ext/nokogiri... yes
checking for gumbo_parse() in -lgumbo... yes
creating Makefile
make "DESTDIR="
compiling nokogumbo.c
In file included from nokogumbo.c:28:0:
/home/deploy/.gem/ruby/2.1.0/gems/nokogiri-1.6.1/ext/nokogiri/nokogiri.h:13:0: warning: "_GNU_SOURCE" redefined
/usr/include/ruby-2.1.0/x86_64-linux/ruby/config.h:17:0: note: this is the location of the previous definition
linking shared-object nokogumboc.so
nokogumbo.o: In function `parse':
nokogumbo.c:(.text+0x26a): undefined reference to `Nokogiri_wrap_xml_document'
collect2: ld returned 1 exit status
make: *** [nokogumboc.so] Error 1
Gem files will remain installed in /home/deploy/.gem/ruby/2.1.0/gems/nokogumbo-1.1.5 for inspection.
Results logged to /home/deploy/.gem/ruby/2.1.0/gems/nokogumbo-1.1.5/ext/nokogumboc/gem_make.out
able to get it installed by passing
gem install nokogumbo -- --with-ldflags=-no-undefined
Also fails on some centos boxes
@rbankston care to create a patch?
Couldn't find a way to get that into the Gem. Anywhere in the extconf.rb I added it I got
compiling nokogumbo.c
In file included from nokogumbo.c:28:0:
/usr/local/lib64/ruby/gems/2.0.0/gems/nokogiri-1.6.2.1/ext/nokogiri/nokogiri.h:13:0: warning: "_GNU_SOURCE" redefined
/usr/include/ruby-2.0.0/x86_64-linux/ruby/config.h:17:0: note: this is the location of the previous definition
compiling string_piece.c
linking shared-object nokogumboc.so
x86_64-pc-linux-gnu-gcc: unrecognized option '-no-undefined'
nokogumbo.o: In function `parse':
nokogumbo.c:(.text+0x26a): undefined reference to `Nokogiri_wrap_xml_document'
collect2: ld returned 1 exit status
make: *** [nokogumboc.so] Error 1
ERROR: Error installing pkg/nokogumbo-1.1.5.gem:
Explicitly adding the library worked for me.
@AlexandreBernard does gem version 1.1.6 solve this for you?
on the server yes it does compile
however now it fails on my mac but let me ask for a confirmation to somebody else at the office tomorrow morning: i played a bit forking the gem on my machine and i suspect there's something i should clean. keeping you informed.
unfortunately others can confirm, that doesn't compile anymore on a mac
we're using ruby 2.1.2 on mavericks with everything up to date i guess
OK, so the current state is that nokogumbo builds on mac osx and ubuntu and fails on gentoo and centos. With the patch @krutten it builds on ubuntu, gentoo, and centos, but fails on mac osx.
Is it worth trying adding the following line to the patch @krutten provided?
if RUBY_PLATFORM !~ /linux/
If necessary, we can more finely select/exclude the linux variant using code from https://github.com/goodtouch/rbenv-ruby-install/blob/master/platform_info.rb#L49
I guess this would work. I definitely don't have any C skills but isn't there a fix that could be done on the code (nokogumbo.c rather than extconf.rb) that would make it run everywhere?
With compiled languages, there are two steps. First you compile each source into an object file; then you link the object files together to build either an executable or a shared library. The Gentoo failure is in the link step:
linking shared-object nokogumboc.so
nokogumbo.o: In function `parse':
nokogumbo.c:(.text+0x26a): undefined reference to `Nokogiri_wrap_xml_document'
collect2: ld returned 1 exit status
Adding the library needed to resolve this, causes a Mac OSX failure is in the link step:
ld: library not found for -l:nokogiri.so
thanks, can you release it please?
done
and.... it works! thanks a lot for the help
currently no idea what could be missing.
note that i tried also with libxml2 installed on the server