rcairo / rcairo

The Ruby bindings for cairo.
https://rcairo.github.io/
Other
134 stars 31 forks source link

Error when installing on macOS Big Sur beta 3 #66

Closed samwightt closed 3 years ago

samwightt commented 4 years ago

When I try running the following:

gem install cairo

I get the following output:

Building native extensions. This could take a while...
ERROR:  Error installing cairo:
    ERROR: Failed to build gem native extension.

    current directory: /Users/sam/.rvm/gems/ruby-2.5.8/gems/cairo-1.16.6/ext/cairo
/Users/sam/.rvm/rubies/ruby-2.5.8/bin/ruby -I /Users/sam/.rvm/rubies/ruby-2.5.8/lib/ruby/site_ruby/2.5.0 -r ./siteconf20200810-9922-cxr5fq.rb extconf.rb
checking for GCC... yes
checking for Homebrew... yes
checking for cairo version (>= 1.2.0)... yes
*** 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
    --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=/Users/sam/.rvm/rubies/ruby-2.5.8/bin/$(RUBY_BASE_NAME)
    --with-pkg-config
    --without-pkg-config
    --with-override-variables
    --without-override-variables
/Users/sam/.rvm/gems/ruby-2.5.8/gems/pkg-config-1.4.1/lib/pkg-config.rb:383:in `parse_pc': .pc for zlib doesn't exist. (RuntimeError)
    from /Users/sam/.rvm/gems/ruby-2.5.8/gems/pkg-config-1.4.1/lib/pkg-config.rb:227:in `declaration'
    from /Users/sam/.rvm/gems/ruby-2.5.8/gems/pkg-config-1.4.1/lib/pkg-config.rb:172:in `requires_private'
    from /Users/sam/.rvm/gems/ruby-2.5.8/gems/pkg-config-1.4.1/lib/pkg-config.rb:493:in `block in all_required_packages'
    from /Users/sam/.rvm/gems/ruby-2.5.8/gems/pkg-config-1.4.1/lib/pkg-config.rb:253:in `collect_requires'
    from /Users/sam/.rvm/gems/ruby-2.5.8/gems/pkg-config-1.4.1/lib/pkg-config.rb:259:in `block in collect_requires'
    from /Users/sam/.rvm/gems/ruby-2.5.8/gems/pkg-config-1.4.1/lib/pkg-config.rb:254:in `each'
    from /Users/sam/.rvm/gems/ruby-2.5.8/gems/pkg-config-1.4.1/lib/pkg-config.rb:254:in `collect_requires'
    from /Users/sam/.rvm/gems/ruby-2.5.8/gems/pkg-config-1.4.1/lib/pkg-config.rb:259:in `block in collect_requires'
    from /Users/sam/.rvm/gems/ruby-2.5.8/gems/pkg-config-1.4.1/lib/pkg-config.rb:254:in `each'
    from /Users/sam/.rvm/gems/ruby-2.5.8/gems/pkg-config-1.4.1/lib/pkg-config.rb:254:in `collect_requires'
    from /Users/sam/.rvm/gems/ruby-2.5.8/gems/pkg-config-1.4.1/lib/pkg-config.rb:492:in `all_required_packages'
    from /Users/sam/.rvm/gems/ruby-2.5.8/gems/pkg-config-1.4.1/lib/pkg-config.rb:277:in `collect_cflags'
    from /Users/sam/.rvm/gems/ruby-2.5.8/gems/pkg-config-1.4.1/lib/pkg-config.rb:185:in `cflags_only_other'
    from /Users/sam/.rvm/gems/ruby-2.5.8/gems/pkg-config-1.4.1/lib/pkg-config.rb:553:in `cflags_only_other'
    from /Users/sam/.rvm/gems/ruby-2.5.8/gems/pkg-config-1.4.1/lib/pkg-config.rb:600:in `have_package'
    from extconf.rb:42:in `required_pkg_config_package'
    from extconf.rb:50:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Users/sam/.rvm/gems/ruby-2.5.8/extensions/x86_64-darwin-20/2.5.0/cairo-1.16.6/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/sam/.rvm/gems/ruby-2.5.8/gems/cairo-1.16.6 for inspection.
Results logged to /Users/sam/.rvm/gems/ruby-2.5.8/extensions/x86_64-darwin-20/2.5.0/cairo-1.16.6/gem_make.out

The mkmf.log file contains the following:

checking for GCC... -------------------- yes

"gcc -o conftest -I/Users/sam/.rvm/rubies/ruby-2.5.8/include/ruby-2.5.0/x86_64-darwin20 -I/Users/sam/.rvm/rubies/ruby-2.5.8/include/ruby-2.5.0/ruby/backward -I/Users/sam/.rvm/rubies/ruby-2.5.8/include/ruby-2.5.0 -I.  -I/usr/local/opt/libyaml/include -I/usr/local/opt/libksba/include -I/usr/local/opt/readline/include -I/usr/local/opt/zlib/include -I/usr/local/opt/openssl@1.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wmisleading-indentation -Wextra-tokens  -fno-common -pipe conftest.c  -L. -L/Users/sam/.rvm/rubies/ruby-2.5.8/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/zlib/lib -L/usr/local/opt/openssl@1.1/lib -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/zlib/lib -L/usr/local/opt/openssl@1.1/lib     -lruby.2.5.8  -lpthread -lgmp -ldl -lobjc "
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

"gcc -I/Users/sam/.rvm/rubies/ruby-2.5.8/include/ruby-2.5.0/x86_64-darwin20 -I/Users/sam/.rvm/rubies/ruby-2.5.8/include/ruby-2.5.0/ruby/backward -I/Users/sam/.rvm/rubies/ruby-2.5.8/include/ruby-2.5.0 -I.  -I/usr/local/opt/libyaml/include -I/usr/local/opt/libksba/include -I/usr/local/opt/readline/include -I/usr/local/opt/zlib/include -I/usr/local/opt/openssl@1.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wmisleading-indentation -Wextra-tokens  -fno-common -pipe   -c conftest.c"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: /*top*/
4: #ifndef __GNUC__
5: # error
6: |:/ === __GNUC__ undefined === /:|
7: #endif
/* end */

--------------------

checking for Homebrew... -------------------- yes

--------------------

have_package: checking for cairo version (>= 1.2.0)... -------------------- yes

--------------------

No idea what would cause this issue. Xcode CLI tools are updated and Cairo was installed successfully using brew. Ruby 2.5.8 was installed with RVM. Any idea on how to fix this?

kou commented 4 years ago

Are you using the latest Homebrew and macOS?

samwightt commented 4 years ago

Yep! I'm on the latest version of Homebrew and of the macOS Big Sur beta.

kou commented 4 years ago

Does this reproduce with the Ruby installed Homebrew?

PATH=$(brew --prefix ruby)/bin:$PATH gem install rcairo
ChickenBeard commented 3 years ago

I'm having the same issue with a M1 Mac on Big Sur 11.2.3.

checking for GCC... -------------------- yes

"clang -o conftest -I/Users/evan/.rbenv/versions/2.6.6/include/ruby-2.6.0/-darwin20 -I/Users/evan/.rbenv/versions/2.6.6/include/ruby-2.6.0/ruby/backward -I/Users/evan/.rbenv/versions/2.6.6/include/ruby-2.6.0 -I. -I/Users/evan/.rbenv/versions/2.6.6/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT    -Wno-error=implicit-function-declaration -fno-common -pipe conftest.c  -L. -L/Users/evan/.rbenv/versions/2.6.6/lib -L. -L/Users/evan/.rbenv/versions/2.6.6/lib  -fstack-protector-strong     -lruby.2.6   "
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

"clang -I/Users/evan/.rbenv/versions/2.6.6/include/ruby-2.6.0/-darwin20 -I/Users/evan/.rbenv/versions/2.6.6/include/ruby-2.6.0/ruby/backward -I/Users/evan/.rbenv/versions/2.6.6/include/ruby-2.6.0 -I. -I/Users/evan/.rbenv/versions/2.6.6/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT    -Wno-error=implicit-function-declaration -fno-common -pipe   -c conftest.c"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: /*top*/
4: #ifndef __GNUC__
5: # error
6: |:/ === __GNUC__ undefined === /:|
7: #endif
/* end */

--------------------

checking for Homebrew... -------------------- yes

--------------------

have_package: checking for cairo version (>= 1.2.0)... -------------------- yes

--------------------
kou commented 3 years ago

Could you try the latest pkg-config gem? See also: #69

ChickenBeard commented 3 years ago

No luck.

which pkg-config /opt/homebrew/bin/pkg-config

pkg-config --debug --list-all https://gist.github.com/ChickenBeard/c67512001685f93ab218f5cb70c33418

pkg-config --debug --cflags --libs cairo https://gist.github.com/ChickenBeard/7f9782f7726ce1933a476a9a0ae2c5fd

pkg-config --debug --modversion cairo https://gist.github.com/ChickenBeard/36850af23be0e3201d37dedc2aca9ada

pkg-config --debug --cflags --libs expat https://gist.github.com/ChickenBeard/43087366949c6b511a1d137f1f929cf0

kou commented 3 years ago

Could you show gem install cairo output?

ChickenBeard commented 3 years ago

mkmf.log

Building native extensions. This could take a while...
ERROR:  Error installing cairo:
    ERROR: Failed to build gem native extension.

    current directory: /Users/evan/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/cairo-1.17.5/ext/cairo
/Users/evan/.rbenv/versions/2.6.6/bin/ruby -I /Users/evan/.rbenv/versions/2.6.6/lib/ruby/site_ruby/2.6.0 -r ./siteconf20210411-31069-1jjfsg1.rb extconf.rb
checking for GCC... yes
checking for Homebrew... yes
checking for cairo version (>= 1.2.0)... yes
*** 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=/Users/evan/.rbenv/versions/2.6.6/bin/$(RUBY_BASE_NAME)
    --with-pkg-config
    --without-pkg-config
    --with-override-variables
    --without-override-variables
/Users/evan/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/pkg-config-1.4.5/lib/pkg-config.rb:389:in `parse_pc': .pc doesn't exist: <xproto> (PackageConfig::NotFoundError)
    from /Users/evan/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/pkg-config-1.4.5/lib/pkg-config.rb:233:in `declaration'
    from /Users/evan/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/pkg-config-1.4.5/lib/pkg-config.rb:178:in `requires_private'
    from /Users/evan/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/pkg-config-1.4.5/lib/pkg-config.rb:508:in `block in all_required_packages'
    from /Users/evan/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/pkg-config-1.4.5/lib/pkg-config.rb:259:in `collect_requires'
    from /Users/evan/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/pkg-config-1.4.5/lib/pkg-config.rb:265:in `block in collect_requires'
    from /Users/evan/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/pkg-config-1.4.5/lib/pkg-config.rb:260:in `each'
    from /Users/evan/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/pkg-config-1.4.5/lib/pkg-config.rb:260:in `collect_requires'
    from /Users/evan/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/pkg-config-1.4.5/lib/pkg-config.rb:265:in `block in collect_requires'
    from /Users/evan/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/pkg-config-1.4.5/lib/pkg-config.rb:260:in `each'
    from /Users/evan/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/pkg-config-1.4.5/lib/pkg-config.rb:260:in `collect_requires'
    from /Users/evan/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/pkg-config-1.4.5/lib/pkg-config.rb:265:in `block in collect_requires'
    from /Users/evan/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/pkg-config-1.4.5/lib/pkg-config.rb:260:in `each'
    from /Users/evan/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/pkg-config-1.4.5/lib/pkg-config.rb:260:in `collect_requires'
    from /Users/evan/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/pkg-config-1.4.5/lib/pkg-config.rb:265:in `block in collect_requires'
    from /Users/evan/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/pkg-config-1.4.5/lib/pkg-config.rb:260:in `each'
    from /Users/evan/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/pkg-config-1.4.5/lib/pkg-config.rb:260:in `collect_requires'
    from /Users/evan/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/pkg-config-1.4.5/lib/pkg-config.rb:507:in `all_required_packages'
    from /Users/evan/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/pkg-config-1.4.5/lib/pkg-config.rb:283:in `collect_cflags'
    from /Users/evan/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/pkg-config-1.4.5/lib/pkg-config.rb:191:in `cflags_only_other'
    from /Users/evan/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/pkg-config-1.4.5/lib/pkg-config.rb:568:in `cflags_only_other'
    from /Users/evan/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/pkg-config-1.4.5/lib/pkg-config.rb:615:in `have_package'
    from extconf.rb:42:in `required_pkg_config_package'
    from extconf.rb:50:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Users/evan/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/extensions/-darwin-20/2.6.0/cairo-1.17.5/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/evan/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/cairo-1.17.5 for inspection.
Results logged to /Users/evan/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/extensions/-darwin-20/2.6.0/cairo-1.17.5/gem_make.out
kou commented 3 years ago

Could you show the output of ruby -rpp -r pkg-config -e 'pp PackageConfig.new("xproto")'?

ChickenBeard commented 3 years ago
#<PackageConfig:0x00000001520ea468
 @declarations=nil,
 @msvc_syntax=nil,
 @name="xproto",
 @options={},
 @override_variables={},
 @path_position=nil,
 @paths=
  ["/opt/homebrew/lib/pkgconfig",
   "/opt/homebrew/Library/Homebrew/os/mac/pkgconfig/11",
   "/usr/local/lib/pkgconfig",
   "/usr/lib/pkgconfig"],
 @pc_path=nil,
 @variables=nil>
kou commented 3 years ago

Thanks. Could you try pkg-config 1.4.6?

ChickenBeard commented 3 years ago

Huzzah! gem install pkg-config moved it up to 1.4.6 Then gem install cairo worked like a charm. Finally, gem install gtk3 worked