devel/elfutils port installs a shared library called libelf.so.1, causing the linker to print warnings when linking test programs. /usr/bin/ld: warning: libelf.so.2, needed by /usr/local/lib/libruby23.so, may conflict with libelf.so.1 This causes pkg_config function call in ext/nokogiri/extconf.rb to return nil, so it fallbacks to rubygem-pkg-config. However, the rubygem-pkg-config 1.2.0 provided by ports cannot pass the version check. gem 'pkg-config', (gem_ver='~> 1.1.7') ===> Building for rubygem-nokogiri-1.7.2 Successfully built RubyGem Name: nokogiri Version: 1.7.2 File: nokogiri-1.7.2.gem ===> Staging for rubygem-nokogiri-1.7.2 ===> rubygem-nokogiri-1.7.2 depends on package: rubygem-pkg-config>=1.1.7 - found ===> rubygem-nokogiri-1.7.2 depends on file: /usr/local/bin/ruby23 - found ===> rubygem-nokogiri-1.7.2 depends on file: /usr/local/bin/gem23 - found ===> Generating temporary packing list (cd /wrkdirs/usr/ports/textproc/rubygem-nokogiri/work/nokogiri-1.7.2; /usr/bin/env RB_USER_INSTALL=yes LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 /usr/local/bin/gem23 install -l --no-update-sources --install-dir /wrkdirs/usr/ports/textproc/rubygem-nokogiri/work/stage/usr/local/lib/ruby/gems/2.3 --ignore-dependencies --bindir=/wrkdirs/usr/ports/textproc/rubygem-nokogiri/work/stage/usr/local/bin --rdoc --ri nokogiri-1.7.2.gem -- --build-args --use-system-libraries) Building native extensions with: '--build-args --use-system-libraries' This could take a while... ERROR: Error installing nokogiri-1.7.2.gem: ERROR: Failed to build gem native extension. current directory: /wrkdirs/usr/ports/textproc/rubygem-nokogiri/work/stage/usr/local/lib/ruby/gems/2.3/gems/nokogiri-1.7.2/ext/nokogiri /usr/local/bin/ruby23 -r ./siteconf20170520-5753-1cepj95.rb extconf.rb --build-args --use-system-libraries checking if the C compiler accepts ... yes Building nokogiri using system libraries. pkg-config could not be used to find libxml-2.0 Please install either `pkg-config` or the pkg-config gem per gem install pkg-config -v "~> 1.1.7" pkg-config could not be used to find libxslt Please install either `pkg-config` or the pkg-config gem per gem install pkg-config -v "~> 1.1.7" pkg-config could not be used to find libexslt Please install either `pkg-config` or the pkg-config gem per gem install pkg-config -v "~> 1.1.7" 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/local/bin/$(RUBY_BASE_NAME)23 --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 --without-xml2-include=${xml2-dir}/include --with-xml2-lib --without-xml2-lib=${xml2-dir}/lib --with-libxml-2.0-config --without-libxml-2.0-config --with-pkg-config --without-pkg-config --with-xslt-dir --without-xslt-dir --with-xslt-include --without-xslt-include=${xslt-dir}/include --with-xslt-lib --without-xslt-lib=${xslt-dir}/lib --with-libxslt-config --without-libxslt-config --with-exslt-dir --without-exslt-dir --with-exslt-include --without-exslt-include=${exslt-dir}/include --with-exslt-lib --without-exslt-lib=${exslt-dir}/lib --with-libexslt-config --without-libexslt-config To see why this extension failed to compile, please check the mkmf.log which can be found here: /wrkdirs/usr/ports/textproc/rubygem-nokogiri/work/stage/usr/local/lib/ruby/gems/2.3/extensions/amd64-freebsd-11/2.3/nokogiri-1.7.2/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /wrkdirs/usr/ports/textproc/rubygem-nokogiri/work/stage/usr/local/lib/ruby/gems/2.3/gems/nokogiri-1.7.2 for inspection. Results logged to /wrkdirs/usr/ports/textproc/rubygem-nokogiri/work/stage/usr/local/lib/ruby/gems/2.3/extensions/amd64-freebsd-11/2.3/nokogiri-1.7.2/gem_make.out *** Error code 1 Stop. make: stopped in /usr/ports/textproc/rubygem-nokogiri
There are a number of things going on here. The libelf warning is just that, a warning. It doesn't cause an error. The real issue is as you say the requirement on pkg-config 1.1.x. That was fixed in r445195, so I think this issue is solved now. Please let me know if you still have an issue. As a side note, there's another issue with nokogiri where it will build with -Werror and die due to a bug in ruby: "cc -I/usr/local/include/ruby-2.4//amd64-freebsd12 -I/usr/local/include/ruby-2.4//ruby/backward -I/usr/local/include/ruby-2.4/ -I. -I/usr/local/include -isystem /usr/local/include -O2 -pipe -fstack-protector -isystem /usr/local/include -fno-strict-aliasing -fPIC -Werror -c conftest.c" In file included from conftest.c:1: In file included from /usr/local/include/ruby-2.4/ruby.h:33: /usr/local/include/ruby-2.4/ruby/ruby.h:915:1: error: attribute '__deprecated__' is ignored, place it after "struct" to apply attribute to type declaration [-Werror,-Wignored-attributes] DEPRECATED_TYPE(("RClass is internal use only"), ^ /usr/local/include/ruby-2.4//amd64-freebsd12/ruby/config.h:126:49: note: expanded from macro 'DEPRECATED_TYPE' #define DEPRECATED_TYPE(mesg,x) __attribute__ ((__deprecated__ mesg)) x ^ In file included from conftest.c:1: In file included from /usr/local/include/ruby-2.4/ruby.h:33: /usr/local/include/ruby-2.4/ruby/ruby.h:2152:1: error: unknown attribute '__error__' ignored [-Werror,-Wunknown-attributes] ERRORFUNC(("bad scan arg format"), int rb_scan_args_bad_format(const char*)); ^ /usr/local/include/ruby-2.4//amd64-freebsd12/ruby/config.h:131:43: note: expanded from macro 'ERRORFUNC' #define ERRORFUNC(mesg,x) __attribute__ ((__error__ mesg)) x ^ In file included from conftest.c:1: In file included from /usr/local/include/ruby-2.4/ruby.h:33: /usr/local/include/ruby-2.4/ruby/ruby.h:2153:1: error: unknown attribute '__error__' ignored [-Werror,-Wunknown-attributes] ERRORFUNC(("variable argument length doesn't match"), int rb_scan_args_length_mismatch(const char*,int)); ^ /usr/local/include/ruby-2.4//amd64-freebsd12/ruby/config.h:131:43: note: expanded from macro 'ERRORFUNC' #define ERRORFUNC(mesg,x) __attribute__ ((__error__ mesg)) x ^ 3 errors generated. checked program was: /* begin */ 1: #include "ruby.h" 2: 3: int main() {return 0;} /* end */ But this is only in the case where you try to build nokogiri without the --use-system-libraries flags and is really a bug in nokogiri for passing the -Werror flag, and a bug in ruby for bad use of C macros.
(In reply to Steve Wills from comment #1) > There are a number of things going on here. The libelf warning is just > that, a warning. It doesn't cause an error. It did cause error when using pkg_config function in mkmf. You can test it by creating a wrapper script called 'cc' and put it in PATH, #!/bin/sh echo 'warning: Hello World!' 1>&2 exec /usr/bin/cc "$@" and write a simple program printing the result of pkg_config call. require 'mkmf' require 'pp' pp pkg_config 'zlib' You will see 'nil' because of the warning message. The content of mkmf.log: "pkg-config --exists zlib" | pkg-config --libs zlib => "-lz \n" "cc -o conftest -I/usr/local/include/ruby-2.3//amd64-freebsd11 -I/usr/local/include/ruby-2.3//ruby/backward -I/usr/local/include/ruby-2.3/ -I. -I/usr/local/include -isystem /usr/local/include -O2 -pipe -march=sandybridge -fstack-protector -isystem /usr/local/include -fno-strict-aliasing -fPIC conftest.c -L. -L/usr/local/lib -L. -fstack-protector -rdynamic -lruby23 -lelf -lunwind -lexecinfo -lprocstat -lcrypt -lm -lpthread -L/usr/local/lib -L/usr/local/lib -lc" warning: Hello World! checked program was: /* begin */ 1: #include "ruby.h" 2: 3: int main(int argc, char **argv) 4: { 5: return 0; 6: } /* end */ "cc -o conftest -I/usr/local/include/ruby-2.3//amd64-freebsd11 -I/usr/local/include/ruby-2.3//ruby/backward -I/usr/local/include/ruby-2.3/ -I. -I/usr/local/include -isystem /usr/local/include -O2 -pipe -march=sandybridge -fstack-protector -isystem /usr/local/include -fno-strict-aliasing -fPIC conftest.c -L. -L/usr/local/lib -L. -fstack-protector -rdynamic -lruby23 -lz -lelf -lunwind -lexecinfo -lprocstat -lcrypt -lm -lpthread -L/usr/local/lib -L/usr/local/lib -lc" warning: Hello World! checked program was: /* begin */ 1: #include "ruby.h" 2: 3: int main(int argc, char **argv) 4: { 5: return 0; 6: } /* end */ package configuration for zlib is not found > The real issue is as you say the requirement on pkg-config 1.1.x. If the pkg_config check didn't fail, it would not use rubygem-pkg-config. This is why it can be built in poudriere without patching the version requirement of rubygem-pkg-config. > That was fixed in r445195, so I think this issue is solved now. > Please let me know if you still have an issue. Yes, it is fixed now.