Issue #11201 has been updated by Hans Mackowiak.


wx from wxWidgets does have its own wx-config script with does have other flags than pkg-config
(pkg-config in its second version can call (pkg)-config scripts)

thats why:

wx-config --libs-only-l
  *** Error: Unrecognised option: '--libs-only-l'

imo it would be nice if it would have checked if that libs-only-l returns something/a string before shellsplit does try to cut it.


i am okay with it that pkg_config("wx") might not be able to get something but imo it would be better if it does return nil instead of NoMethodError
PS: but i think it still would have been nice if it would have been able to return something meaningful.

another sample would be xml2-config from libxml2

PS: i might try to fix that on my own and then i will add a patch

----------------------------------------
Bug #11201: pkg_config NoMethodError when finding other -config program
https://bugs.ruby-lang.org/issues/11201#change-52695

* Author: Hans Mackowiak
* Status: Feedback
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.3.0dev (2015-05-28 trunk 50658) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------

where it does work (existing package)

~~~ruby
pkg_config("gtk+-x11-2.0") #  => ["-pthread", "", "-lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype"] 
pkg_config("gtk+-x11-2.0", "version") # => "0.28" 
~~~

where it does work (non-existing package)

~~~ruby
pkg_config("wx-bla", "version") # => nil 
pkg_config("wx-bla") #  => nil 
~~~

where it maybe not work (other (pkg)-config program)

~~~ruby
pkg_config("wx", "version") # => "3.1.0" 

pkg_config("wx") #either should try to return the same stuff as pkg_config("gtk+-x11-2.0") if possible, or if not return nil
~~~
~~~
NoMethodError: undefined method `scan' for nil:NilClass
	from /usr/local/rvm/rubies/ruby-head/lib/ruby/2.3.0/shellwords.rb:73:in `shellsplit'
	from /usr/local/rvm/rubies/ruby-head/lib/ruby/2.3.0/mkmf.rb:1819:in `pkg_config'
	from (irb):11
	from /usr/local/rvm/rubies/ruby-head/bin/irb:11:in `<main>'
~~~



-- 
https://bugs.ruby-lang.org/