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

Commit 77be60c3 breaks installation with homebrew system libraries and pkg_config #1780

Closed
xeron opened this issue Jul 27, 2018 · 2 comments
Closed

Comments

@xeron
Copy link

xeron commented Jul 27, 2018

Gem installation fails for me starting from 1.8.3. I started to check commits and this is what I found:

When I'm on b5b97bc bundle exec rake succeeds.
When I'm on 77be60c bundle exec rake fails.

Making following change on the latest master fixes the issue:

diff --git a/ext/nokogiri/extconf.rb b/ext/nokogiri/extconf.rb
index 1b0ca4ed..ae89b019 100644
--- a/ext/nokogiri/extconf.rb
+++ b/ext/nokogiri/extconf.rb
@@ -434,7 +434,7 @@ end
 
 if RbConfig::MAKEFILE_CONFIG['CC'] =~ /gcc/
   $CFLAGS << " -O3" unless $CFLAGS[/-O\d/]
-  $CFLAGS << " -Wall -Wcast-qual -Wwrite-strings -Wextra -Wmissing-noreturn -Winline"
+  $CFLAGS << " -Wall -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline"
 end
 
 case

My setup:

  • macOS 10.13.6
  • Xcode 9.4.1
  • homebrew latest version
  • libxml2: stable 2.9.7 (bottled) – FORCE LINKED
  • libxslt: stable 1.1.32 – FORCE LINKED
  • brew link libxml2 libxslt --force
  • My $CPPFLAGS env variable: -I/opt/brew/include
  • My $LDFLAGS env variable: -L/opt/brew/lib
  • My $NOKOGIRI_USE_SYSTEM_LIBRARIES env variable: Y

Rake log:

$ bundle exec rake
cd tmp/x86_64-darwin17/nokogiri/2.5.1
/Users/ilarionov/.rvm/rubies/ruby-2.5.1/bin/ruby -I. ../../../../ext/nokogiri/extconf.rb 
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
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"

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"

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"

ERROR: cannot discover where libxml2 is located on your system. please make sure `pkg-config` is installed.
rake aborted!
Command failed with status (1): [/Users/ilarionov/.rvm/rubies/ruby-2.5.1/bi...]
/Users/ilarionov/workspace/devel/nokogiri/.bundle/vendor/ruby/2.5.0/gems/rake-compiler-1.0.4/lib/rake/extensiontask.rb:205:in `block (2 levels) in define_compile_tasks'
/Users/ilarionov/workspace/devel/nokogiri/.bundle/vendor/ruby/2.5.0/gems/rake-compiler-1.0.4/lib/rake/extensiontask.rb:202:in `block in define_compile_tasks'
/Users/ilarionov/workspace/devel/nokogiri/.bundle/vendor/ruby/2.5.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/Users/ilarionov/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.3/lib/bundler/cli/exec.rb:74:in `load'
/Users/ilarionov/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.3/lib/bundler/cli/exec.rb:74:in `kernel_load'
/Users/ilarionov/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.3/lib/bundler/cli/exec.rb:28:in `run'
/Users/ilarionov/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.3/lib/bundler/cli.rb:424:in `exec'
/Users/ilarionov/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.3/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/Users/ilarionov/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/Users/ilarionov/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.3/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/Users/ilarionov/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.3/lib/bundler/cli.rb:27:in `dispatch'
/Users/ilarionov/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.3/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/Users/ilarionov/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.3/lib/bundler/cli.rb:18:in `start'
/Users/ilarionov/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.3/exe/bundle:30:in `block in <top (required)>'
/Users/ilarionov/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.3/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
/Users/ilarionov/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.3/exe/bundle:22:in `<top (required)>'
/Users/ilarionov/.rvm/gems/ruby-2.5.1/bin/bundle:23:in `load'
/Users/ilarionov/.rvm/gems/ruby-2.5.1/bin/bundle:23:in `<main>'
/Users/ilarionov/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:24:in `eval'
/Users/ilarionov/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:24:in `<main>'
Tasks: TOP => default => test => compile => compile:x86_64-darwin17 => compile:nokogiri:x86_64-darwin17 => copy:nokogiri:x86_64-darwin17:2.5.1 => tmp/x86_64-darwin17/nokogiri/2.5.1/nokogiri.bundle => tmp/x86_64-darwin17/nokogiri/2.5.1/Makefile
(See full trace by running task with --trace)

pkg_config output:

$ pkg-config --cflags libxml-2.0
-I/opt/brew/Cellar/libxml2/2.9.7/include/libxml2
$ pkg-config --libs libxml-2.0
-L/opt/brew/Cellar/libxml2/2.9.7/lib -lxml2
$ pkg-config --libs libxslt
-L/opt/brew/Cellar/libxslt/1.1.32/lib -L/opt/brew/Cellar/libxml2/2.9.7/lib -lxslt -lxml2 -lz -lpthread -liconv -lm -lxml2
$ pkg-config --cflags libxslt
-I/opt/brew/Cellar/libxslt/1.1.32/include -I/opt/brew/Cellar/libxml2/2.9.7/include/libxml2

Attached mkmf.log when trying to install 1.8.4 using rubygems:

mkmf.log

@xeron
Copy link
Author

xeron commented Aug 15, 2018

Same issue with macports and:

$ sudo port installed | grep libx
  libxml2 @2.9.7_0 (active)
  libxslt @1.1.32_0 (active)
$ echo $CPPFLAGS
-I/opt/local/include
$ echo $LDFLAGS
-L/opt/local/lib
$ echo $NOKOGIRI_USE_SYSTEM_LIBRARIES 
Y

@flavorjones
Copy link
Member

Hi, this appears to be a duplicate of #1772 related to #1731. Closing, please follow on #1772.

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

No branches or pull requests

2 participants