Giter VIP home page Giter VIP logo

rcairo's Introduction

README

Name

rcairo

Description

Ruby bindings for cairo // cairo extension for Ruby

cairographics.org/

Dependencies

  • ruby >= 2.2.1

  • cairo >= 1.2.0

Install

Package

This way is recommended.

# gem install cairo

Self build

For experimental users.

Add the following to your Gemfile:

gem "cairo", github: "rcairo/rcairo"

Then run the following command:

% bundle install

Documents

Source

There is the rcairo repository at GitHub: github.com/rcairo/rcairo

Mailing list

If you have trouble with cairo or rcairo, or you have some ideas for how it could be improved, please feel free to send a message to the cairo mailinglist at [email protected] , which is archived at

cairographics.org/cgi-bin/mailman/listinfo/cairo

Thanks

  • Yoshinao Muramatsu: win32 surface support patch.

  • NANKI Haruo: some bug fix patches.

  • Paul van Tilburg:

    • some patches that support ruby 1.9.

    • some suggestions.

  • Binzo: some bug reports and fixed that.

  • kimura wataru:

    • some advices for RubyCocoa.

    • reports a bug.

  • OBATA Akio:

    • reports a bug.

    • some suggestions.

  • James Healy: reports bugs.

  • Carsten Bormann: A suggestion.

  • Davide Rambaldi: A suggestion.

  • Yusuke ENDOH: reports a bug.

  • Yuta Taniguchi: a bug fix patch.

  • kimura wataru:

    • reports a bug.

    • some patches.

  • Masayas TARUI:

    • Windows support.

  • Stefan Salewski: reports a bug.

  • Mamoru Tasaka: reports bugs.

  • Nikolai Weibull: reports problems.

  • Will Bryant: reports a bug.

  • Vasily Fedoseyev: fixes a bug.

  • Eric C.: reports a bug.

  • Cédric Boutillier: reports a bug.

  • tmtms: reports a bug.

rcairo's People

Contributors

brodock avatar cosmo0920 avatar dependabot[bot] avatar dimitryandric avatar kou avatar mtasaka avatar myokoym avatar patrickhno avatar scivola avatar spoolkitamura avatar vasfed avatar willbryant avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rcairo's Issues

Error Installing Cairo on macOS

Error when I try to bundle install, it fails on Cairo. I can successfully install the gem using gem install cairo -v 1.16.4 but then it fails on Cairo. When I run bundle install this is the output:

 current directory: /Users/aklu/u-app/vendor/bundle/ruby/2.6.0/gems/cairo-1.16.4/ext/cairo
/Users/aklu/.asdf/installs/ruby/2.6.3/bin/ruby -I /Users/aklu/.asdf/installs/ruby/2.6.3/lib/ruby/2.6.0 -r ./siteconf20201026-8512-1nvisx.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/aklu/.asdf/installs/ruby/2.6.3/bin/$(RUBY_BASE_NAME)
        --with-pkg-config
        --without-pkg-config
        --with-override-variables
        --without-override-variables
/Users/aklu/u-app/vendor/bundle/ruby/2.6.0/gems/pkg-config-1.2.8/lib/pkg-config.rb:299:in `parse_pc': .pc for /usr/local/opt/libffi/lib/pkgconfig/libffi.pc doesn't exist. (RuntimeError)
        from /Users/aklu/u-app/vendor/bundle/ruby/2.6.0/gems/pkg-config-1.2.8/lib/pkg-config.rb:196:in `declaration'
        from /Users/aklu/u-app/vendor/bundle/ruby/2.6.0/gems/pkg-config-1.2.8/lib/pkg-config.rb:210:in `collect_cflags'
        from /Users/aklu/u-app/vendor/bundle/ruby/2.6.0/gems/pkg-config-1.2.8/lib/pkg-config.rb:145:in `cflags'
        from /Users/aklu/u-app/vendor/bundle/ruby/2.6.0/gems/pkg-config-1.2.8/lib/pkg-config.rb:215:in `block in collect_cflags'
        from /Users/aklu/u-app/vendor/bundle/ruby/2.6.0/gems/pkg-config-1.2.8/lib/pkg-config.rb:214:in `collect'
        from /Users/aklu/u-app/vendor/bundle/ruby/2.6.0/gems/pkg-config-1.2.8/lib/pkg-config.rb:214:in `collect_cflags'
        from /Users/aklu/u-app/vendor/bundle/ruby/2.6.0/gems/pkg-config-1.2.8/lib/pkg-config.rb:145:in `cflags'
        from /Users/aklu/u-app/vendor/bundle/ruby/2.6.0/gems/pkg-config-1.2.8/lib/pkg-config.rb:215:in `block in collect_cflags'
        from /Users/aklu/u-app/vendor/bundle/ruby/2.6.0/gems/pkg-config-1.2.8/lib/pkg-config.rb:214:in `collect'
        from /Users/aklu/u-app/vendor/bundle/ruby/2.6.0/gems/pkg-config-1.2.8/lib/pkg-config.rb:214:in `collect_cflags'
        from /Users/aklu/u-app/vendor/bundle/ruby/2.6.0/gems/pkg-config-1.2.8/lib/pkg-config.rb:154:in `cflags_only_other'
        from /Users/aklu/u-app/vendor/bundle/ruby/2.6.0/gems/pkg-config-1.2.8/lib/pkg-config.rb:472:in `cflags_only_other'
        from /Users/aklu/u-app/vendor/bundle/ruby/2.6.0/gems/pkg-config-1.2.8/lib/pkg-config.rb:519: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/aklu/u-app/vendor/bundle/ruby/2.6.0/extensions/x86_64-darwin-19/2.6.0/cairo-1.16.4/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/aklu/u-app/vendor/bundle/ruby/2.6.0/gems/cairo-1.16.4 for inspection.
Results logged to /Users/aklu/u-app/vendor/bundle/ruby/2.6.0/extensions/x86_64-darwin-19/2.6.0/cairo-1.16.4/gem_make.out

An error occurred while installing cairo (1.16.4), and Bundler cannot continue.
Make sure that `gem install cairo -v '1.16.4'` succeeds before bundling.

In Gemfile:
  cairo

The mkmf.log file contains the following:

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

"clang -o conftest -I/Users/aklu/.asdf/installs/ruby/2.6.3/include/ruby-2.6.0/x86_64-darwin19 -I/Users/aklu/.asdf/installs/ruby/2.6.3/include/ruby-2.6.0/ruby/backward -I/Users/aklu/.asdf/installs/ruby/2.6.3/include/ruby-2.6.0 -I. -I/Users/aklu/.asdf/installs/ruby/2.6.3/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -O3 -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens  -fno-common -pipe conftest.c  -L. -L/Users/aklu/.asdf/installs/ruby/2.6.3/lib -L. -L/Users/aklu/.asdf/installs/ruby/2.6.3/lib  -fstack-protector-strong -L/usr/local/lib     -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/aklu/.asdf/installs/ruby/2.6.3/include/ruby-2.6.0/x86_64-darwin19 -I/Users/aklu/.asdf/installs/ruby/2.6.3/include/ruby-2.6.0/ruby/backward -I/Users/aklu/.asdf/installs/ruby/2.6.3/include/ruby-2.6.0 -I. -I/Users/aklu/.asdf/installs/ruby/2.6.3/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -O3 -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -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, Mac OS Cataline version 10.15.7. Homebrew version 2.5.6. Ruby Version: ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin19].
Any help would be greatly appreciated!

Japanese String shown as blocks of boxes in ruby on rails application running using apache.

I am using ruby on rails application using the apache with phusion passenger. In the application, uses cairo to create image. The image contains Japanese strings that render the strings as small boxes instead of characters with apache server but the characters displayed correctly when rails using puma. Currently i am using the font family "takaop" which is correctly working with puma but not with apache server. Only some fonts are supporting in apache.

Thank You.
sample

non-ASCII code characters in color names

About some color names in lib/cairo/colors.rb, non-ASCII code characters are mixed as following.

    # Big dip o’ruby: #9C2542: (156, 37, 66)
    BIG_DIP_O’RUBY = RGB.new(0.611764705882353, 0.1450980392156863, 0.25882352941176473)

    # Café au lait: #A67B5B: (166, 123, 91)
    CAFÉ_AU_LAIT = RGB.new(0.6509803921568628, 0.4823529411764706, 0.3568627450980392)

    # Café noir: #4B3621: (75, 54, 33)
    CAFÉ_NOIR = RGB.new(0.29411764705882354, 0.21176470588235294, 0.12941176470588237)

    # Halayà úbe: #663854: (102, 55, 84)
    HALAYÀ_ÚBE = RGB.new(0.4, 0.21568627450980393, 0.32941176470588235)

It might be a good idea to use ASCII code characters only.

OSX install fails if XQuartz is not installed

Awesome to see that you're checking if I have brew installed, and using it to install cairo. Cairo itself is dependent on XQuartz. Unfortunately you cannot install XQuartz through brew, and need to install it through https://xquartz.macosforge.org. When I did brew install cairo myself, I got

cairo: Unsatisfied dependency: XQuartz 0.0.0
Homebrew does not package XQuartz. Installers may be found at:
  https://xquartz.macosforge.org

which was helpful at understanding what to do. When I first tried to install the gem though, I got the following error message:

checking for GCC... yes
checking for Win32 OS... no
checking for cairo version (>= 1.2.0)... no
checking for brew... yes
installing 'cairo' native package... failed
failed to run 'brew install cairo'.
*** 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/pm/.rvm/rubies/ruby-2.1.2/bin/ruby
    --with-pkg-config
    --without-pkg-config
    --with-override-variables
    --without-override-variables

extconf failed, exit code 1

I didn't notice that the failure was from brew initially, as the *** extconf.rb failed *** and below output hides it. I suppose this is a rubygems thing though?

Anyways, not such a big deal, and I was able to resolve this myself, so I'm reporting this mainly to make things Googleable incase someone runs into a similar issue.

Make rb_cCairo_XCBSurface public.

Can rb_cCairo_XCBSurface be added to rb_cairo.h? I would like to extend this class in a project of mine, or would it be better to bundle my own copy of rcairo?

Cant load cairo.so in cygwin. ruby 2.1

Seems cygwin suport is broken?

$ ruby -e 'require "cairo"'
/home/patrick/.rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `require': No such process - /home/patrick/.gem/ruby/2.1.1/extensions/x86-cygwin/2.1.0/cairo-1.12.8/cairo.so (LoadError)
        from /home/patrick/.rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
        from /home/patrick/.rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require'
        from /home/patrick/.gem/ruby/2.1.1/gems/cairo-1.12.8/lib/cairo.rb:46:in `rescue in <top (required)>'
        from /home/patrick/.gem/ruby/2.1.1/gems/cairo-1.12.8/lib/cairo.rb:42:in `<top (required)>'
        from /home/patrick/.rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `require'
        from /home/patrick/.rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
        from /home/patrick/.rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require'
        from -e:1:in `<main>'

$ cygcheck /home/patrick/.gem/ruby/2.1.1/extensions/x86-cygwin/2.1.0/cairo-1.12.8/cairo.so
C:\cygwin\home\patrick\.gem\ruby\2.1.1\extensions\x86-cygwin\2.1.0\cairo-1.12.8\cairo.so
  C:\cygwin\home\patrick\.rubies\ruby-2.1.1\bin\cygruby210.dll
    C:\cygwin\bin\cygcrypt-0.dll
      C:\cygwin\bin\cygwin1.dll
        C:\WINDOWS\system32\KERNEL32.dll
          C:\WINDOWS\system32\ntdll.dll
    C:\cygwin\bin\cyggcc_s-1.dll
    C:\cygwin\bin\cygssp-0.dll
    C:\WINDOWS\system32\USER32.dll
      C:\WINDOWS\system32\GDI32.dll
  C:\cygwin\bin\cygcairo-2.dll
    C:\cygwin\bin\cygfontconfig-1.dll
      C:\cygwin\bin\cygexpat-1.dll
      C:\cygwin\bin\cygfreetype-6.dll
        C:\cygwin\bin\cygbz2-1.dll
        C:\cygwin\bin\cygpng15-15.dll
          C:\cygwin\bin\cygz.dll
    C:\cygwin\bin\cygpixman-1-0.dll
    C:\cygwin\bin\cygX11-6.dll
      C:\cygwin\bin\cygxcb-1.dll
        C:\cygwin\bin\cygXau-6.dll
        C:\cygwin\bin\cygXdmcp-6.dll
    C:\cygwin\bin\cygxcb-render-0.dll
    C:\cygwin\bin\cygxcb-shm-0.dll
    C:\cygwin\bin\cygXext-6.dll
    C:\cygwin\bin\cygXrender-1.dll

$ ruby -v
ruby 2.1.1p76 (2014-02-24 revision 45161) [i386-cygwin]

RecordingSurfaceTest fails with cairo 1.10.2

Fedora 14 and 15 now use cairo 1.10.2 and with this cairo RecordingSurfaceTest test in test/test_recording_surface.rb fails like:

  1. Failure:
    test_new(RecordingSurfaceTest) [cairo-1.10.0/test/test_recording_surface.rb:16]:
    <[10.0, 20.0, 99.0, 109.0]> expected but was
    <[14.0, 29.0, 67.0, 72.0]>.

Fedora 13 uses cairo 1.8.10, and with this cairo this test is successful.

Fails to install on Mac OS X Yosemite

I am getting a weird error compiling....... Any help please?

Benjamins-MacBook-Pro:caredox Ben$ sudo gem install cairo
Password:
Fetching: pkg-config-1.1.5.gem (100%)
Successfully installed pkg-config-1.1.5
Fetching: cairo-1.12.9.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing cairo:
    ERROR: Failed to build gem native extension.

    /Users/Ben/.rvm/rubies/ruby-1.9.3-p550/bin/ruby -r ./siteconf20141110-82223-1dv66fm.rb extconf.rb
checking for GCC... yes
checking for Win32 OS... no
checking for cairo version (>= 1.2.0)... yes
checking for Mac OS X... yes
checking for HAVE_RUBY_ST_H in ruby.h... yes
checking for HAVE_RUBY_IO_H in ruby.h... yes
checking for rb_errinfo() in ruby.h... yes
checking for enum ruby_value_type in ruby.h... yes
creating Makefile

make  clean

make
compiling rb_cairo.c
couldn't understand kern.osversion `14.0.0'
rb_cairo.c: In function ‘rb_cairo_satisfied_version’:
rb_cairo.c:31: warning: unused parameter ‘self’
compiling rb_cairo_constants.c
couldn't understand kern.osversion `14.0.0'
rb_cairo_constants.c: In function ‘rb_cairo_operator_from_ruby_object’:
rb_cairo_constants.c:152: warning: comparison of unsigned expression < 0 is always false
rb_cairo_constants.c: In function ‘rb_cairo_antialias_from_ruby_object’:
rb_cairo_constants.c:153: warning: comparison of unsigned expression < 0 is always false
rb_cairo_constants.c: In function ‘rb_cairo_fill_rule_from_ruby_object’:
rb_cairo_constants.c:154: warning: comparison of unsigned expression < 0 is always false
rb_cairo_constants.c: In function ‘rb_cairo_line_cap_from_ruby_object’:
rb_cairo_constants.c:155: warning: comparison of unsigned expression < 0 is always false
rb_cairo_constants.c: In function ‘rb_cairo_line_join_from_ruby_object’:
rb_cairo_constants.c:156: warning: comparison of unsigned expression < 0 is always false
rb_cairo_constants.c: In function ‘rb_cairo_font_slant_from_ruby_object’:
rb_cairo_constants.c:157: warning: comparison of unsigned expression < 0 is always false
rb_cairo_constants.c: In function ‘rb_cairo_font_weight_from_ruby_object’:
rb_cairo_constants.c:158: warning: comparison of unsigned expression < 0 is always false
rb_cairo_constants.c: In function ‘rb_cairo_subpixel_order_from_ruby_object’:
rb_cairo_constants.c:159: warning: comparison of unsigned expression < 0 is always false
rb_cairo_constants.c: In function ‘rb_cairo_hint_style_from_ruby_object’:
rb_cairo_constants.c:160: warning: comparison of unsigned expression < 0 is always false
rb_cairo_constants.c: In function ‘rb_cairo_hint_metrics_from_ruby_object’:
rb_cairo_constants.c:161: warning: comparison of unsigned expression < 0 is always false
rb_cairo_constants.c: In function ‘rb_cairo_path_data_type_from_ruby_object’:
rb_cairo_constants.c:162: warning: comparison of unsigned expression < 0 is always false
rb_cairo_constants.c: In function ‘rb_cairo_extend_from_ruby_object’:
rb_cairo_constants.c:165: warning: comparison of unsigned expression < 0 is always false
rb_cairo_constants.c: In function ‘rb_cairo_filter_from_ruby_object’:
rb_cairo_constants.c:166: warning: comparison of unsigned expression < 0 is always false
rb_cairo_constants.c: In function ‘rb_cairo_svg_version_from_ruby_object’:
rb_cairo_constants.c:168: warning: comparison of unsigned expression < 0 is always false
rb_cairo_constants.c: In function ‘rb_cairo_ps_level_from_ruby_object’:
rb_cairo_constants.c:173: warning: comparison of unsigned expression < 0 is always false
rb_cairo_constants.c: In function ‘rb_cairo_pdf_version_from_ruby_object’:
rb_cairo_constants.c:180: warning: comparison of unsigned expression < 0 is always false
rb_cairo_constants.c: In function ‘rb_cairo_text_cluster_flags_from_ruby_object’:
rb_cairo_constants.c:186: warning: comparison of unsigned expression < 0 is always false
rb_cairo_constants.c: In function ‘rb_cairo_script_mode_from_ruby_object’:
rb_cairo_constants.c:190: warning: comparison of unsigned expression < 0 is always false
rb_cairo_constants.c: In function ‘rb_cairo_region_overlap_from_ruby_object’:
rb_cairo_constants.c:194: warning: comparison of unsigned expression < 0 is always false
rb_cairo_constants.c: In function ‘cr_svg_get_versions’:
rb_cairo_constants.c:208: warning: unused parameter ‘self’
rb_cairo_constants.c: In function ‘cr_svg_version_to_string’:
rb_cairo_constants.c:227: warning: unused parameter ‘self’
rb_cairo_constants.c: In function ‘cr_format_stride_for_width’:
rb_cairo_constants.c:246: warning: unused parameter ‘self’
rb_cairo_constants.c: In function ‘cr_ps_get_levels’:
rb_cairo_constants.c:256: warning: unused parameter ‘self’
rb_cairo_constants.c: In function ‘cr_ps_level_to_string’:
rb_cairo_constants.c:274: warning: unused parameter ‘self’
rb_cairo_constants.c: In function ‘cr_pdf_get_versions’:
rb_cairo_constants.c:293: warning: unused parameter ‘self’
rb_cairo_constants.c: In function ‘cr_pdf_version_to_string’:
rb_cairo_constants.c:311: warning: unused parameter ‘self’
compiling rb_cairo_context.c
couldn't understand kern.osversion `14.0.0'
rb_cairo_context.c: In function ‘cr_destroy_all_guarded_contexts_at_end_iter’:
rb_cairo_context.c:1496: warning: unused parameter ‘value’
rb_cairo_context.c:1496: warning: unused parameter ‘data’
rb_cairo_context.c: In function ‘cr_destroy_all_guarded_contexts_at_end’:
rb_cairo_context.c:1503: warning: unused parameter ‘data’
compiling rb_cairo_device.c
couldn't understand kern.osversion `14.0.0'
rb_cairo_device.c: In function ‘cr_device_script_supported_p’:
rb_cairo_device.c:100: warning: unused parameter ‘klass’
rb_cairo_device.c: In function ‘cr_device_xml_supported_p’:
rb_cairo_device.c:110: warning: unused parameter ‘klass’
rb_cairo_device.c: In function ‘cr_device_initialize’:
rb_cairo_device.c:192: warning: unused parameter ‘argc’
rb_cairo_device.c:192: warning: unused parameter ‘argv’
rb_cairo_device.c: In function ‘cr_finish_all_guarded_devices_at_end_iter’:
rb_cairo_device.c:262: warning: unused parameter ‘value’
rb_cairo_device.c:262: warning: unused parameter ‘data’
rb_cairo_device.c: In function ‘cr_finish_all_guarded_devices_at_end’:
rb_cairo_device.c:269: warning: unused parameter ‘data’
compiling rb_cairo_exception.c
couldn't understand kern.osversion `14.0.0'
rb_cairo_exception.c: In function ‘rb_cairo_check_status’:
rb_cairo_exception.c:70: warning: enumeration value ‘CAIRO_STATUS_JBIG2_GLOBAL_MISSING’ not handled in switch
compiling rb_cairo_font_extents.c
couldn't understand kern.osversion `14.0.0'
compiling rb_cairo_font_face.c
couldn't understand kern.osversion `14.0.0'
compiling rb_cairo_font_options.c
couldn't understand kern.osversion `14.0.0'
compiling rb_cairo_glyph.c
couldn't understand kern.osversion `14.0.0'
compiling rb_cairo_io.c
couldn't understand kern.osversion `14.0.0'
compiling rb_cairo_matrix.c
couldn't understand kern.osversion `14.0.0'
rb_cairo_matrix.c: In function ‘cr_matrix_init_identity’:
rb_cairo_matrix.c:86: warning: unused parameter ‘self’
rb_cairo_matrix.c: In function ‘cr_matrix_init_translate’:
rb_cairo_matrix.c:94: warning: unused parameter ‘self’
rb_cairo_matrix.c: In function ‘cr_matrix_init_scale’:
rb_cairo_matrix.c:102: warning: unused parameter ‘self’
rb_cairo_matrix.c: In function ‘cr_matrix_init_rotate’:
rb_cairo_matrix.c:110: warning: unused parameter ‘self’
compiling rb_cairo_path.c
couldn't understand kern.osversion `14.0.0'
rb_cairo_path.c: In function ‘cr_path_move_to_initialize’:
rb_cairo_path.c:139: warning: unused parameter ‘self’
rb_cairo_path.c: In function ‘cr_path_line_to_initialize’:
rb_cairo_path.c:158: warning: unused parameter ‘self’
rb_cairo_path.c: In function ‘cr_path_curve_to_initialize’:
rb_cairo_path.c:177: warning: unused parameter ‘self’
rb_cairo_path.c: In function ‘cr_path_close_path_initialize’:
rb_cairo_path.c:213: warning: unused parameter ‘self’
compiling rb_cairo_pattern.c
couldn't understand kern.osversion `14.0.0'
rb_cairo_pattern.c: In function ‘cr_pattern_solid_supported_p’:
rb_cairo_pattern.c:87: warning: unused parameter ‘klass’
rb_cairo_pattern.c: In function ‘cr_pattern_surface_supported_p’:
rb_cairo_pattern.c:93: warning: unused parameter ‘klass’
rb_cairo_pattern.c: In function ‘cr_pattern_gradient_supported_p’:
rb_cairo_pattern.c:99: warning: unused parameter ‘klass’
rb_cairo_pattern.c: In function ‘cr_pattern_linear_supported_p’:
rb_cairo_pattern.c:105: warning: unused parameter ‘klass’
rb_cairo_pattern.c: In function ‘cr_pattern_radial_supported_p’:
rb_cairo_pattern.c:111: warning: unused parameter ‘klass’
rb_cairo_pattern.c: In function ‘cr_pattern_mesh_supported_p’:
rb_cairo_pattern.c:117: warning: unused parameter ‘klass’
rb_cairo_pattern.c: In function ‘cr_pattern_raster_source_supported_p’:
rb_cairo_pattern.c:127: warning: unused parameter ‘klass’
rb_cairo_pattern.c: In function ‘cr_pattern_initialize’:
rb_cairo_pattern.c:180: warning: unused parameter ‘argc’
rb_cairo_pattern.c:180: warning: unused parameter ‘argv’
rb_cairo_pattern.c: In function ‘cr_mesh_pattern_set_control_point’:
rb_cairo_pattern.c:598: warning: comparison of unsigned expression >= 0 is always true
rb_cairo_pattern.c: In function ‘cr_mesh_pattern_set_corner_color_generic’:
rb_cairo_pattern.c:628: warning: comparison of unsigned expression >= 0 is always true
rb_cairo_pattern.c: In function ‘cr_mesh_pattern_get_corner_color’:
rb_cairo_pattern.c:692: warning: comparison of unsigned expression >= 0 is always true
rb_cairo_pattern.c: In function ‘cr_mesh_pattern_get_control_point’:
rb_cairo_pattern.c:726: warning: comparison of unsigned expression >= 0 is always true
rb_cairo_pattern.c: In function ‘cr_raster_source_acquire_callback’:
rb_cairo_pattern.c:748: warning: unused parameter ‘pattern’
rb_cairo_pattern.c: In function ‘cr_raster_source_release_callback’:
rb_cairo_pattern.c:781: warning: unused parameter ‘pattern’
rb_cairo_pattern.c: In function ‘cr_raster_source_snapshot_callback’:
rb_cairo_pattern.c:830: warning: unused parameter ‘pattern’
rb_cairo_pattern.c: In function ‘cr_raster_source_copy_callback’:
rb_cairo_pattern.c:854: warning: unused parameter ‘pattern’
rb_cairo_pattern.c:856: warning: unused parameter ‘other’
rb_cairo_pattern.c: In function ‘cr_raster_source_finish_callback’:
rb_cairo_pattern.c:879: warning: unused parameter ‘pattern’
compiling rb_cairo_private.c
couldn't understand kern.osversion `14.0.0'
compiling rb_cairo_rectangle.c
couldn't understand kern.osversion `14.0.0'
compiling rb_cairo_region.c
couldn't understand kern.osversion `14.0.0'
compiling rb_cairo_scaled_font.c
couldn't understand kern.osversion `14.0.0'
compiling rb_cairo_surface.c
couldn't understand kern.osversion `14.0.0'
In file included from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:55,
                 from /System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:23,
                 from /usr/local/Cellar/cairo/1.14.0/include/cairo/cairo-quartz.h:43,
                 from rb_cairo_surface.c:54:
/System/Library/Frameworks/CoreServices.framework/Frameworks/FSEvents.framework/Headers/FSEvents.h:262: error: expected ‘,’ or ‘}’ before ‘__attribute__’
/System/Library/Frameworks/CoreServices.framework/Frameworks/FSEvents.framework/Headers/FSEvents.h:414: error: expected ‘,’ or ‘}’ before ‘__attribute__’
rb_cairo_surface.c: In function ‘cr_surface_image_supported_p’:
rb_cairo_surface.c:230: warning: unused parameter ‘klass’
rb_cairo_surface.c: In function ‘cr_surface_pdf_supported_p’:
rb_cairo_surface.c:236: warning: unused parameter ‘klass’
rb_cairo_surface.c: In function ‘cr_surface_ps_supported_p’:
rb_cairo_surface.c:246: warning: unused parameter ‘klass’
rb_cairo_surface.c: In function ‘cr_surface_quartz_supported_p’:
rb_cairo_surface.c:256: warning: unused parameter ‘klass’
rb_cairo_surface.c: In function ‘cr_surface_win32_supported_p’:
rb_cairo_surface.c:266: warning: unused parameter ‘klass’
rb_cairo_surface.c: In function ‘cr_surface_svg_supported_p’:
rb_cairo_surface.c:276: warning: unused parameter ‘klass’
rb_cairo_surface.c: In function ‘cr_surface_win32_printing_supported_p’:
rb_cairo_surface.c:286: warning: unused parameter ‘klass’
rb_cairo_surface.c: In function ‘cr_surface_quartz_image_supported_p’:
rb_cairo_surface.c:296: warning: unused parameter ‘klass’
rb_cairo_surface.c: In function ‘cr_surface_script_supported_p’:
rb_cairo_surface.c:306: warning: unused parameter ‘klass’
rb_cairo_surface.c: In function ‘cr_surface_recording_supported_p’:
rb_cairo_surface.c:316: warning: unused parameter ‘klass’
rb_cairo_surface.c: In function ‘cr_surface_gl_supported_p’:
rb_cairo_surface.c:326: warning: unused parameter ‘klass’
rb_cairo_surface.c: In function ‘cr_surface_tee_supported_p’:
rb_cairo_surface.c:342: warning: unused parameter ‘klass’
rb_cairo_surface.c: In function ‘cr_surface_xml_supported_p’:
rb_cairo_surface.c:352: warning: unused parameter ‘klass’
rb_cairo_surface.c: In function ‘cr_surface_initialize’:
rb_cairo_surface.c:432: warning: unused parameter ‘argc’
rb_cairo_surface.c:432: warning: unused parameter ‘argv’
rb_cairo_surface.c: In function ‘cr_image_surface_create’:
rb_cairo_surface.c:923: warning: unused parameter ‘self’
rb_cairo_surface.c: In function ‘cr_image_surface_create_for_data’:
rb_cairo_surface.c:933: warning: unused parameter ‘self’
rb_cairo_surface.c: In function ‘cr_quartz_surface_initialize’:
rb_cairo_surface.c:1264: warning: assignment makes pointer from integer without a cast
rb_cairo_surface.c: In function ‘cr_quartz_image_surface_initialize’:
rb_cairo_surface.c:1476: warning: implicit declaration of function ‘cairo_quartz_image_surface_create’
rb_cairo_surface.c:1476: warning: assignment makes pointer from integer without a cast
rb_cairo_surface.c: In function ‘cr_quartz_image_surface_get_image’:
rb_cairo_surface.c:1489: warning: implicit declaration of function ‘cairo_quartz_image_surface_get_image’
rb_cairo_surface.c:1489: warning: assignment makes pointer from integer without a cast
rb_cairo_surface.c: In function ‘cr_finish_all_guarded_surfaces_at_end_iter’:
rb_cairo_surface.c:1904: warning: unused parameter ‘value’
rb_cairo_surface.c:1904: warning: unused parameter ‘data’
rb_cairo_surface.c: In function ‘cr_finish_all_guarded_surfaces_at_end’:
rb_cairo_surface.c:1911: warning: unused parameter ‘data’
make: *** [rb_cairo_surface.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/Ben/.rvm/rubies/ruby-1.9.3-p550/lib/ruby/gems/1.9.1/gems/cairo-1.12.9 for inspection.
Results logged to /Users/Ben/.rvm/rubies/ruby-1.9.3-p550/lib/ruby/gems/1.9.1/extensions/x86_64-darwin-14/1.9.1/cairo-1.12.9/gem_make.out

Incorrect value at Cairo::Color::RGB#to_s

For example, color :INDIGO is "#4B0082FF".
But rcairo shows "#4C0082FF" as below.

require 'cairo'

color = :INDIGO
p Cairo::Color.parse(color).to_s   # => "#4C0082FF"

In line number 108 of lib/cairo/color.rb, I would think it might be '.round' method, not '.ceil' method.

def to_s
  "#%02X%02X%02X%02X" % to_a.collect {|v| (v * 255).ceil}
end

undefined method 'create_cairo_context'

Hey there. I'm trying to get pango/cairo/gtk working, and when I try and run my app, I get this:

in `block in para': undefined method `create_cairo_context' for #<Gdk::Window:0x10165c820 ptr=0x1014166f0>

The line is this:

Gtk.main

Googling this errors seems to indicate that I should be building things in a certain order, and I thought I was... any advice would be helpful.

Environment:

Ruby: 1.9.2
Gems:
pango: 0.90.2
cairo: 1.10.0
gtk2: 0.90.2

Installed:

pango 1.24.5
cairo 1.10.0
gtk2: 2.20.1

I'm running on Mac OSX Snow Leopard.

Assertion failed on windows 7 64 with ruby 2.3.0 32

Hi

I prototyped a program on ruby 2.3.1 on linux.

I'm trying to make it work on windows 7 64, but it fails to start.

The error is :

Assertion failed!

Program: C:\ruby230\bin\ruby.exe
File: cairo-surface.c, Line 545

Expression: surface->is_clear

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

I tried with 2.2.4 also.

I'm not using cairo directly, but gtk3.

Load error on Rubinius

Hi, I'm getting this error: Missing or uninitialized constant: Cairo::Color when requiring cairo.
Any idea what's causing this / how to fix it?

Can't specify path of PDFSurface as Pathname object

The following script fails to create a valid PDF file.

require 'pathname'
require 'cairo'

surface = Cairo::PDFSurface.new Pathname("sample.pdf"), 100, 100
context = Cairo::Context.new surface

context.move_to 10, 10
context.line_to 90, 90
context.stroke

context.show_page

surface.finish

The content of sample.pdf is merely '%EOF'.

Why?

If we change the first argument of PDFSurface.new to String instead of Pathname, it is okay.

Pathname object has write method, but ...

Environment:
ruby 2.1.6p336 (2015-04-13 revision 50298) [i386-mingw32]
cairo (1.14.1 x86-mingw32)

Security Notice & Bug Bounty - NULL Pointer Dereference - huntr.dev

Overview

rcairo is a Ruby bindings for cairo.

Affected versions of this package are vulnerable to NULL Pointer Dereference. HarBuzz is an OpenType text shaping engine, it contains a tool named hb-view which utilizes Cairo to give a graphical view of text using a font provided by the user. This vulnerability is due to logical problems in the program, and can cause a Denial of Service attack with a crafted font file.

Bug Bounty

We have opened up a bounty for this issue on our bug bounty platform. Want to solve this vulnerability and get rewarded 💰? Go to https://huntr.dev/

We will submit a pull request directly to your repository with the fix as soon as possible. Want to learn more? Go to https://github.com/418sec/huntr 📚

Automatically generated by @huntr-helper...

Error when installing on macOS Big Sur 11.5.2

When I try to install

gem install cairo -v '1.16.6'

ruby version 2.7.1 (other ruby versions seem okay)

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

    current directory: /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/cairo-1.16.6/ext/cairo
/Users/mariacastro/.rbenv/versions/2.7.1/bin/ruby -I /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0 -r ./siteconf20210913-42046-17z6cj8.rb extconf.rb
checking for GCC... yes
checking for Homebrew... yes
checking for cairo version (>= 1.2.0)... yes
[BUG] Segmentation fault at 0x00000000381bd820
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [-darwin20]

-- Crash Report log information --------------------------------------------
   See Crash Report log file under the one of following:
     * ~/Library/Logs/DiagnosticReports
     * /Library/Logs/DiagnosticReports
   for more details.
Don't forget to include the above Crash Report log file in bug reports.

-- Control frame information -----------------------------------------------
c:0001 p:---- s:0003 e:000002 (none) [FINISH]


-- Other runtime information -----------------------------------------------

* Loaded script: extconf.rb

* Loaded features:

    0 enumerator.so
    1 thread.rb
    2 rational.so
    3 complex.so
    4 ruby2_keywords.rb
    5 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/enc/encdb.bundle
    6 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/enc/trans/transdb.bundle
    7 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/rbconfig.rb
    8 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/compatibility.rb
    9 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/defaults.rb
   10 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/deprecate.rb
   11 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/errors.rb
   12 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/version.rb
   13 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/requirement.rb
   14 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/platform.rb
   15 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/basic_specification.rb
   16 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/stub_specification.rb
   17 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/util.rb
   18 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/text.rb
   19 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/user_interaction.rb
   20 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/specification_policy.rb
   21 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/util/list.rb
   22 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/specification.rb
   23 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/exceptions.rb
   24 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/bundler_version_finder.rb
   25 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/dependency.rb
   26 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_gem.rb
   27 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/monitor.bundle
   28 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/monitor.rb
   29 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb
   30 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_warn.rb
   31 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems.rb
   32 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/did_you_mean/version.rb
   33 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/did_you_mean/core_ext/name_error.rb
   34 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/did_you_mean/levenshtein.rb
   35 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/did_you_mean/jaro_winkler.rb
   36 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/did_you_mean/spell_checker.rb
   37 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/did_you_mean/spell_checkers/name_error_checkers/class_name_checker.rb
   38 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/did_you_mean/spell_checkers/name_error_checkers/variable_name_checker.rb
   39 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/did_you_mean/spell_checkers/name_error_checkers.rb
   40 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/did_you_mean/spell_checkers/method_name_checker.rb
   41 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/did_you_mean/spell_checkers/key_error_checker.rb
   42 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/did_you_mean/spell_checkers/null_checker.rb
   43 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/did_you_mean/formatters/plain_formatter.rb
   44 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/did_you_mean/tree_spell_checker.rb
   45 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/did_you_mean.rb
   46 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/cairo-1.16.6/ext/cairo/siteconf20210913-42046-17z6cj8.rb
   47 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/pathname.bundle
   48 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/pathname.rb
   49 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/English.rb
   50 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/fileutils.rb
   51 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/shellwords.rb
   52 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/mkmf.rb
   53 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/path_support.rb
   54 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/pkg-config-1.4.6/lib/pkg-config/version.rb
   55 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/pkg-config-1.4.6/lib/pkg-config.rb
   56 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/native-package-installer-1.1.1/lib/native-package-installer/version.rb
   57 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/native-package-installer-1.1.1/lib/native-package-installer/executable-finder.rb
   58 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/native-package-installer-1.1.1/lib/native-package-installer/platform/msys2.rb
   59 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/native-package-installer-1.1.1/lib/native-package-installer/platform/freebsd.rb
   60 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/native-package-installer-1.1.1/lib/native-package-installer/platform/debian.rb
   61 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/native-package-installer-1.1.1/lib/native-package-installer/platform/alt-linux.rb
   62 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/native-package-installer-1.1.1/lib/native-package-installer/platform/arch-linux.rb
   63 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/native-package-installer-1.1.1/lib/native-package-installer/platform/fedora.rb
   64 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/native-package-installer-1.1.1/lib/native-package-installer/platform/pld-linux.rb
   65 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/native-package-installer-1.1.1/lib/native-package-installer/platform/redhat.rb
   66 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/native-package-installer-1.1.1/lib/native-package-installer/platform/suse.rb
   67 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/native-package-installer-1.1.1/lib/native-package-installer/platform/ubuntu.rb
   68 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/native-package-installer-1.1.1/lib/native-package-installer/platform/homebrew.rb
   69 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/native-package-installer-1.1.1/lib/native-package-installer/platform/macports.rb
   70 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/native-package-installer-1.1.1/lib/native-package-installer/platform/unknown.rb
   71 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/native-package-installer-1.1.1/lib/native-package-installer/platform.rb
   72 /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/native-package-installer-1.1.1/lib/native-package-installer.rb

* Process memory map:

102e28000-102e2c000 r-x /Users/mariacastro/.rbenv/versions/2.7.1/bin/ruby
102e2c000-102e30000 r-- /Users/mariacastro/.rbenv/versions/2.7.1/bin/ruby
102e30000-102e34000 rw- /Users/mariacastro/.rbenv/versions/2.7.1/bin/ruby
102e34000-102e38000 r-- /Users/mariacastro/.rbenv/versions/2.7.1/bin/ruby
102e38000-102e40000 rw- /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/enc/encdb.bundle
102e40000-102e44000 r-- /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/enc/encdb.bundle
102e44000-102e48000 r-- /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/enc/encdb.bundle
102e48000-102e4c000 rw- /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/enc/encdb.bundle
102e4c000-102e50000 --- /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/enc/encdb.bundle
102e50000-102e58000 rw- /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/enc/encdb.bundle
102e58000-102e5c000 --- /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/enc/encdb.bundle
102e5c000-102e60000 --- /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/enc/encdb.bundle
102e60000-102e68000 rw- /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/enc/encdb.bundle
102e68000-102e6c000 --- /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/enc/encdb.bundle
102e6c000-102e70000 --- /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/enc/encdb.bundle
102e70000-102e78000 rw- /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/enc/encdb.bundle
102e78000-102e7c000 --- /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/enc/encdb.bundle
102e7c000-102e80000 r-- /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/enc/encdb.bundle
102e80000-102e84000 r-x /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/enc/encdb.bundle
102e84000-102e88000 r-- /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/enc/encdb.bundle
102e88000-102e8c000 rw- /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/enc/encdb.bundle
102e8c000-102e90000 r-- /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/enc/encdb.bundle
102e90000-102e94000 r-x /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/enc/trans/transdb.bundle
102e94000-102e98000 r-- /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/enc/trans/transdb.bundle
102e98000-102e9c000 rw- /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/enc/trans/transdb.bundle
102e9c000-102ea0000 r-- /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/enc/trans/transdb.bundle
102ea0000-102ea4000 r-- /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/monitor.bundle
102ea4000-102ea8000 r-x /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/monitor.bundle
102ea8000-102eac000 r-- /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/monitor.bundle
102eac000-102eb0000 rw- /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/monitor.bundle
102eb0000-102eb4000 r-- /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/monitor.bundle
102eb4000-102ebc000 r-x /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/pathname.bundle
102ebc000-102ec0000 r-- /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/pathname.bundle
102ec0000-102ec4000 rw- /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/pathname.bundle
102ec4000-102ec8000 r-- /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/pathname.bundle
1031d4000-103254000 r-x /usr/lib/dyld
103254000-10325c000 r-- /usr/lib/dyld
10325c000-103260000 rw- /usr/lib/dyld
103260000-103294000 rw- /usr/lib/dyld
103294000-1032d8000 r-- /usr/lib/dyld
1032d8000-1032dc000 r-- /Users/mariacastro/.rbenv/versions/2.7.1/lib/libruby.2.7.dylib
1032dc000-10365c000 r-x /Users/mariacastro/.rbenv/versions/2.7.1/lib/libruby.2.7.dylib
10365c000-103664000 r-- /Users/mariacastro/.rbenv/versions/2.7.1/lib/libruby.2.7.dylib
103664000-103668000 rw- /Users/mariacastro/.rbenv/versions/2.7.1/lib/libruby.2.7.dylib
103668000-10367c000 rw- /Users/mariacastro/.rbenv/versions/2.7.1/lib/libruby.2.7.dylib
10367c000-1036f8000 r-- /Users/mariacastro/.rbenv/versions/2.7.1/lib/libruby.2.7.dylib
1036f8000-1036fc000 ---
1036fc000-1037a0000 rw-
1037a0000-1037a4000 ---
1037a4000-103848000 rw-
103848000-10384c000 ---
10384c000-1038f0000 rw-
1038f0000-1038f4000 ---
1038f4000-103998000 rw-
103998000-10399c000 ---
10399c000-103a40000 rw-
103a40000-103a44000 ---
103a44000-103ae8000 rw-
103ae8000-103aec000 ---
103aec000-103b90000 rw-
103b90000-103b94000 ---
103b94000-103c38000 rw-
103c38000-103c3c000 ---
103c3c000-103ce0000 rw-
103ce0000-103ce4000 ---
103ce4000-103d88000 rw-
103d88000-103d8c000 ---
103d8c000-103e30000 rw-
103e30000-103e34000 ---
103e34000-103ed8000 rw-
103ed8000-103edc000 ---
103edc000-103f80000 rw-
103f80000-103f84000 ---
103f84000-104028000 rw-
104028000-10402c000 ---
10402c000-1040d0000 rw-
1040d0000-1040d4000 ---
1040d4000-104178000 rw-
104178000-10417c000 ---
10417c000-104220000 rw-
104220000-104224000 ---
104224000-1042c8000 rw-
1042c8000-1042cc000 ---
1042cc000-104370000 rw-
104370000-104374000 ---
104374000-104418000 rw-
104418000-10441c000 ---
10441c000-1044c0000 rw-
1044c0000-1044c4000 ---
1044c4000-104568000 rw-
104568000-10456c000 ---
10456c000-104610000 rw-
104610000-104614000 ---
104614000-1046b8000 rw-
1046b8000-1046bc000 ---
1046bc000-104760000 rw-
104760000-104764000 ---
104764000-104808000 rw-
104808000-10480c000 ---
10480c000-1048b0000 rw-
1048b0000-1048b4000 ---
1048b4000-104958000 rw-
104958000-10495c000 ---
10495c000-104a00000 rw-
104a00000-104a04000 ---
104a04000-104aa8000 rw-
104aa8000-104aac000 ---
104aac000-104b50000 rw-
104b50000-104b54000 ---
104b54000-104bf8000 rw-
117e00000-117f00000 rw-
117f00000-118000000 rw-
118000000-118800000 rw-
118800000-119000000 rw-
119000000-119800000 rw-
119800000-11a000000 rw-
11a000000-11a800000 rw-
11a800000-11b000000 rw-
11b000000-11b800000 rw-
11b800000-11c000000 rw-
11c000000-11c800000 rw-
11c800000-11d000000 rw-
11d000000-11d800000 rw-
11d800000-11e000000 rw-
11e000000-11e800000 rw-
11e800000-11f000000 rw-
11f000000-11f800000 rw-
11f800000-120000000 rw-
120000000-120100000 rw-
120100000-120200000 rw-
120800000-121000000 rw-
121000000-121800000 rw-
127e00000-127e04000 rw-
127f00000-128000000 rw-
128000000-128800000 rw-
128800000-129000000 rw-
129000000-129800000 rw-
129800000-12a000000 rw-
12a000000-12a800000 rw-
12a800000-12b000000 rw-
12b000000-12b800000 rw-
12b800000-12c000000 rw-
12c000000-12c800000 rw-
12c800000-12d000000 rw-
12d000000-12d800000 rw-
12d800000-12e000000 rw-
12e000000-12e800000 rw-
12e800000-12f000000 rw-
12f000000-12f800000 rw-
12f800000-130000000 rw-
130000000-132000000 rw-
132000000-132800000 rw-
137e00000-137f00000 rw-
138000000-138800000 rw-
168fd8000-16c7dc000 ---
16c7dc000-16cfd8000 rw-
16cfd8000-16cfdc000 ---
16cfdc000-16d064000 rw-
180000000-190000000 r--
190000000-1a0000000 r--
1a0000000-1b0000000 r--
1b0000000-1c0000000 r--
1c0000000-1d0000000 r--
1d0000000-1e0000000 r--
1e0000000-1f0000000 r--
1f0000000-1fc000000 r--
1fc000000-1fcc58000 r--
1fcc58000-1fe000000 rw-
1fe000000-200000000 r--
200000000-208000000 r--
208000000-208a08000 r--
208a08000-20a6a4000 rw-
20a6a4000-20c000000 r--
20c000000-20c6a4000 r--
20c6a4000-2103c4000 r--
2103c4000-212000000 r--
212000000-220000000 r--
220000000-230000000 r--
230000000-240000000 r--
240000000-250000000 r--
250000000-260000000 r--
260000000-270000000 r--
270000000-280000000 r--
fc0000000-1000000000 ---
1000000000-7000000000 ---
[IMPORTANT]
Don't forget to include the Crash Report log file under
DiagnosticReports directory in bug reports.


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

  /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/extensions/-darwin-20/2.7.0/cairo-1.16.6/mkmf.log

extconf failed, uncaught signal 6

Gem files will remain installed in /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/cairo-1.16.6 for inspection.
Results logged to /Users/mariacastro/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/extensions/-darwin-20/2.7.0/cairo-1.16.6/gem_make.out

The mkmf.log file contains the following:

1 checking for GCC... -------------------- yes
  2
  3 "clang -o conftest -I/Users/mariacastro/.rbenv/versions/2.7.1/include/ruby-2.7.0/-darwin20 -I/Users/mariacastro/.rbenv/versions/2.7.1/include/ruby-2.7.0/ruby/backward -I/Users/mariacastro/.rbenv/versions/2.7.1/include/ruby-2.7.0 -I. -    I/Users/mariacastro/.rbenv/versions/2.7.1/include -I/opt/homebrew/opt/[email protected]/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -Wno-error=implicit-function-declaration  -fno-common -pipe conftes    t.c  -L. -L/Users/mariacastro/.rbenv/versions/2.7.1/lib -L. -L/Users/mariacastro/.rbenv/versions/2.7.1/lib -L/opt/homebrew/opt/[email protected]/lib -fstack-protector-strong -L/usr/local/lib     -lruby.2.7   "
  4 checked program was:
  5 /* begin */
  6 1: #include "ruby.h"
  7 2:
  8 3: int main(int argc, char **argv)
  9 4: {
 10 5:   return !!argv[argc];
 11 6: }
 12 /* end */
 13
 14 "clang -I/Users/mariacastro/.rbenv/versions/2.7.1/include/ruby-2.7.0/-darwin20 -I/Users/mariacastro/.rbenv/versions/2.7.1/include/ruby-2.7.0/ruby/backward -I/Users/mariacastro/.rbenv/versions/2.7.1/include/ruby-2.7.0 -I. -I/Users/mari    acastro/.rbenv/versions/2.7.1/include -I/opt/homebrew/opt/[email protected]/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"
 15 checked program was:
 16 /* begin */
 17 1: #include "ruby.h"
 18 2:
 19 3: /*top*/
 20 4: #ifndef __GNUC__
 21 5: # error
 22 6: |:/ === __GNUC__ undefined === /:|
 23 7: #endif
 24 /* end */
 25
 26 --------------------
 27
 28 checking for Homebrew... -------------------- yes
 29
 30 --------------------
 31
 32 have_package: checking for cairo version (>= 1.2.0)... -------------------- yes
 33
 34 --------------------

using Big Sur 11.5.2 (M1)
any idea on how to fix it? again, other versions of ruby work find (2.6.6 and 2.7.2)

An error occurred while installing cairo 1.16 on windows

current directory: d:/Ruby25/lib/ruby/gems/2.5.0/gems/cairo-1.16.4/ext/cairo
d:/Ruby25/bin/ruby.exe -r ./siteconf20200121-20552-1a6b3ke.rb extconf.rb
checking for GCC... yes
checking for Homebrew... no
checking for cairo version (>= 1.2.0)... no
installing 'mingw-w64-i686-cairo' native package... failed
Failed to run 'pacman.exe -S --noconfirm mingw-w64-i686-cairo'.
*** 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=d:/Ruby25/bin/$(RUBY_BASE_NAME)
	--with-pkg-config
	--without-pkg-config
	--with-override-variables
	--without-override-variables

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

  d:/Ruby25/lib/ruby/gems/2.5.0/extensions/x86-mingw32/2.5.0/cairo-1.16.4/mkmf.log

extconf failed, exit code 1


mkmf.log:
checking for GCC... -------------------- yes

"i686-w64-mingw32-gcc -o conftest.exe -Id:/Ruby25/include/ruby-2.5.0/i386-mingw32 -Id:/Ruby25/include/ruby-2.5.0/ruby/backward -Id:/Ruby25/include/ruby-2.5.0 -I. -D_FORTIFY_SOURCE=2 -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64  -O3 -fno-fast-math conftest.c  -L. -Ld:/Ruby25/lib -L. -pipe -s     -lmsvcrt-ruby250  -lgmp -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi  "
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <winsock2.h>
4: #include <windows.h>
5: int main(int argc, char **argv)
6: {
7:   return 0;
8: }
/* end */

"i686-w64-mingw32-gcc -Id:/Ruby25/include/ruby-2.5.0/i386-mingw32 -Id:/Ruby25/include/ruby-2.5.0/ruby/backward -Id:/Ruby25/include/ruby-2.5.0 -I. -D_FORTIFY_SOURCE=2 -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64  -O3 -fno-fast-math   -c conftest.c"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <winsock2.h>
4: #include <windows.h>
5: /*top*/
6: #ifndef __GNUC__
7: # error
8: |:/ === __GNUC__ undefined === /:|
9: #endif
/* end */

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

checking for Homebrew... -------------------- no

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

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

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

"pacman.exe -S --noconfirm mingw-w64-i686-cairo"
错误:无法初始化事务处理 (无法锁定数据库)
错误:无法锁定数据库:File exists
  如果你确认软件包管理器没有在运行,
  你可以删除 /var/lib/pacman/db.lck。
installing 'mingw-w64-i686-cairo' native package... failed
Failed to run 'pacman.exe -S --noconfirm mingw-w64-i686-cairo'.
--------------------

Inconsistant spelling of grey/gray

There are 8 named colors that include the word "grey", and 34 that include the word "gray", with no overlap in name and little overlap in color. This leads to confusion on which spelling to use unless I have the list of constants open for reference.

Tests fail for rcairo 1.10.0

I get a number of test failures when running tests for rcairo 1.10.0

It seems that the test failures related to the assertions have been present also in rcairo 1.8.x, but the failures related to the missing 'omit' method are new. They happen both when trying to compile against cairo 1.8.x and cairo 1.10.x.

  1. Error:
    test_text_cluster_flags(ConstantsTest):
    NoMethodError: undefined method assert_true' for #<ConstantsTest:0x7f819d203e08> ./test/test_constants.rb:11:intest_text_cluster_flags'

  2. Error:
    test_new_symbols_since_1_7_2(ExceptionTest):
    NoMethodError: undefined method assert_true' for #<ExceptionTest:0x7f819d205e10> ./test/test_exception.rb:21:inassert_defined'
    ./test/test_exception.rb:10:in send' ./test/test_exception.rb:10:intest_new_symbols_since_1_7_2'

  3. Error:
    test_new_empty(RegionTest):
    NoMethodError: undefined method assert_predicate' for #<RegionTest:0x7f819d20bc48> ./test/test_region.rb:10:intest_new_empty'

  4. Error:
    test_new_rectangle(RegionTest):
    NoMethodError: undefined method assert_not_predicate' for #<RegionTest:0x7f819d20bbf8> ./test/test_region.rb:15:intest_new_rectangle'

  5. Error:
    test_mode(ScriptDeviceTest):
    NoMethodError: undefined method omit' for #<ScriptDeviceTest:0x7f819d20e1a0> ./test/cairo-test-utils.rb:23:inonly_device'
    ./test/test_script_device.rb:8:in `setup'

  6. Error:
    test_new(ScriptDeviceTest):
    NoMethodError: undefined method omit' for #<ScriptDeviceTest:0x7f819d20e178> ./test/cairo-test-utils.rb:23:inonly_device'
    ./test/test_script_device.rb:8:in `setup'

  7. Error:
    test_new_with_block(ScriptDeviceTest):
    NoMethodError: undefined method omit' for #<ScriptDeviceTest:0x7f819d20e128> ./test/cairo-test-utils.rb:23:inonly_device'
    ./test/test_script_device.rb:8:in `setup'

  8. Error:
    test_write_comment(ScriptDeviceTest):
    NoMethodError: undefined method omit' for #<ScriptDeviceTest:0x7f819d20e0d8> ./test/cairo-test-utils.rb:23:inonly_device'
    ./test/test_script_device.rb:8:in `setup'

  9. Error:
    test_device(ScriptSurfaceTest):
    NoMethodError: undefined method omit' for #<ScriptSurfaceTest:0x7f819d20f0c8> ./test/cairo-test-utils.rb:30:inonly_surface'
    ./test/test_script_surface.rb:5:in `setup'

  10. Error:
    test_new(TeeSurfaceTest):
    NoMethodError: undefined method omit' for #<TeeSurfaceTest:0x7f819d210f40> ./test/cairo-test-utils.rb:30:inonly_surface'
    ./test/test_tee_surface.rb:5:in `setup'

  11. Error:
    test_new(XMLDeviceTest):
    NoMethodError: undefined method omit' for #<XMLDeviceTest:0x7f819d214a78> ./test/cairo-test-utils.rb:23:inonly_device'
    ./test/test_xml_device.rb:5:in `setup'

  12. Error:
    test_new_with_block(XMLDeviceTest):
    NoMethodError: undefined method omit' for #<XMLDeviceTest:0x7f819d214a50> ./test/cairo-test-utils.rb:23:inonly_device'
    ./test/test_xml_device.rb:5:in `setup'

  13. Error:
    test_new(XMLSurfaceTest):
    NoMethodError: undefined method omit' for #<XMLSurfaceTest:0x7f819d2158b0> ./test/cairo-test-utils.rb:30:inonly_surface'
    ./test/test_xml_surface.rb:5:in `setup'

65 tests, 112 assertions, 0 failures, 13 errors

On Windows: cannot load such file -- cairo.so (LoadError)

On Windows 7 64:

> ruby -v

Ruby 2.3.3p222 (2016-11-21 revision 56859) [x64-mingw32] 

> gem install gtk3

Fetching: pkg-config-1.2.0.gem (100%)
Successfully installed pkg-config-1.2.0
Fetching: native-package-installer-1.0.0.gem (100%)
Successfully installed native-package-installer-1.0.0
Fetching: cairo-1.15.6-x64-mingw32.gem (100%)
Successfully installed cairo-1.15.6-x64-mingw32
Fetching: glib2-3.1.3-x64-mingw32.gem (100%)
Successfully installed glib2-3.1.3-x64-mingw32
Fetching: gobject-introspection-3.1.3-x64-mingw32.gem (100%)
Successfully installed gobject-introspection-3.1.3-x64-mingw32
Fetching: gio2-3.1.3-x64-mingw32.gem (100%)
Successfully installed gio2-3.1.3-x64-mingw32
Fetching: atk-3.1.3-x64-mingw32.gem (100%)
Successfully installed atk-3.1.3-x64-mingw32
Fetching: cairo-gobject-3.1.3-x64-mingw32.gem (100%)
Successfully installed cairo-gobject-3.1.3-x64-mingw32
Fetching: pango-3.1.3-x64-mingw32.gem (100%)
Successfully installed pango-3.1.3-x64-mingw32
Fetching: gdk_pixbuf2-3.1.3-x64-mingw32.gem (100%)
Successfully installed gdk_pixbuf2-3.1.3-x64-mingw32
Fetching: gdk3-3.1.3-x64-mingw32.gem (100%)
Successfully installed gdk3-3.1.3-x64-mingw32
Fetching: rsvg2-3.1.3-x64-mingw32.gem (100%)
Successfully installed rsvg2-3.1.3-x64-mingw32
Fetching: gtk3-3.1.3-x64-mingw32.gem (100%)
Successfully installed gtk3-3.1.3-x64-mingw32
13 gems installed

> ruby ruby-gnome-example.rb

C:/dev/ruby/Ruby23-x64/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- cairo.so (LoadError)
        from C:/dev/ruby/Ruby23-x64/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from C:/Dev/ruby/Ruby23-x64/lib/ruby/gems/2.3.0/gems/cairo-1.15.6-x64-mingw32/lib/cairo.rb:48:in `rescue in <top (required)>'
        from C:/Dev/ruby/Ruby23-x64/lib/ruby/gems/2.3.0/gems/cairo-1.15.6-x64-mingw32/lib/cairo.rb:44:in `<top (required)>'
        from C:/dev/ruby/Ruby23-x64/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from C:/dev/ruby/Ruby23-x64/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from C:/Dev/ruby/Ruby23-x64/lib/ruby/gems/2.3.0/gems/glib2-3.1.3-x64-mingw32/lib/glib2.rb:112:in `<top (required)>'
        from C:/dev/ruby/Ruby23-x64/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from C:/dev/ruby/Ruby23-x64/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from C:/Dev/ruby/Ruby23-x64/lib/ruby/gems/2.3.0/gems/gobject-introspection-3.1.3-x64-mingw32/lib/gobject-introspection.rb:17:in `<top (required)>'
        from C:/dev/ruby/Ruby23-x64/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from C:/dev/ruby/Ruby23-x64/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from C:/Dev/ruby/Ruby23-x64/lib/ruby/gems/2.3.0/gems/gtk3-3.1.3-x64-mingw32/lib/gtk3.rb:17:in `<top (required)>'
        from C:/dev/ruby/Ruby23-x64/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:133:in `require'
        from C:/dev/ruby/Ruby23-x64/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:133:in `rescue in require'
        from C:/dev/ruby/Ruby23-x64/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
        from ruby-gnome-example.rb:1:in `<main>'

Cairo::QuartzSurface#cg_context dose not work no RubyCocoa environment in OS X

My Environment:

  • Mac OS X 10.9
  • RubyCocoa is not installed
  • install cairo with brew install cairo --without-x11

Summary

  • Cairo::QuartzSurface#initialize works well in current master.
  • But, Cairo::QuartzSurface#cg_context dose not work.

Detail

following test code reproduce dyld: lazy symbol binding failed: Symbol not found: _ocid_to_rbobj error:

require 'cairo'

class QuartzSurfaceTest < Test::Unit::TestCase
  include CairoTestUtils

  def setup
    only_surface("Quartz")
  end

  def test_generate_dyld_lookup_error
    surface = Cairo::QuartzSurface.new(100, 100)
    surface.cg_context
  end
end

above test code generate following error:

% bundle exec ruby test/run-test.rb 
Loaded suite test/run-test
Started
..............................dyld: lazy symbol binding failed: Symbol not found: _ocid_to_rbobj
  Referenced from: /Users/cosmo/Github/rcairo/ext/cairo/cairo.bundle
  Expected in: flat namespace

dyld: Symbol not found: _ocid_to_rbobj
  Referenced from: /Users/cosmo/Github/rcairo/ext/cairo/cairo.bundle
  Expected in: flat namespace

zsh: trace trap  bundle exec ruby test/run-test.rb

following C functions provided by RubyCocoa. but no #ifdef guard for non RubyCocoa environment found in cr_quartz_surface_get_cg_context(rb_cairo_surface.c).

BOOL rbobj_to_nsobj (VALUE obj, id* nsobj);
VALUE ocid_to_rbobj (VALUE context_obj, id ocid);

How do it treat Cairo::QuartzSurface#cg_context?

bundle install fail for Cairo on Mac-OX

I am running into this issue with almost all the version of cairo, getting below error:

/Users/akankshasaxena/.gem/ruby/2.6.4/gems/pkg-config-1.3.8/lib/pkg-config.rb:342:in `parse_pc': .pc for /usr/local/opt/libffi/lib/pkgconfig/libffi.pc doesn't exist. (RuntimeError)

Sharing my system configuration :

$ ruby -v -r pp -r pkg-config -e 'pp PackageConfig.new("cairo").paths' 
ruby 2.6.4p104 (2019-08-28 revision 67798) [x86_64-darwin18]
["/usr/local/lib/pkgconfig",
 "/usr/local/opt/mysql-client/lib/pkgconfig",
 "/usr/local/opt/[email protected]/lib/pkgconfig",
 "/usr/local/opt/openssl/lib/pkgconfig",
 "/usr/local/opt/ncurses/lib/pkgconfig",
 "/usr/local/opt/libevent/lib/pkgconfig",
 "/usr/lib/pkgconfig",
 "/usr/local/lib/pkgconfig",
 "/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/10.14",
 "/usr/local/lib/pkgconfig",
 "/usr/local/share/pkgconfig",
 "/usr/lib/pkgconfig"]

$ sw_vers -productVersion
10.14.6

$ brew --prefix  
/usr/local

$which pkg-config
/usr/local/bin/pkg-config

$brew list | grep pkg-config
pkg-config


$ brew info pkg-config
pkg-config: stable 0.29.2 (bottled)
Manage compile and link flags for libraries
https://freedesktop.org/wiki/Software/pkg-config/
/usr/local/Cellar/pkg-config/0.29.2 (11 files, 627.2KB) *
  Poured from bottle on 2019-09-26 at 11:37:24
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/pkg-config.rb
==> Analytics
install: 101,680 (30 days), 311,328 (90 days), 1,364,201 (365 days)
install_on_request: 28,181 (30 days), 82,442 (90 days), 332,464 (365 days)
build_error: 0 (30 days)

$ brew --repository
/usr/local/Homebrew


$ ls -la /usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig
total 0
drwxr-xr-x  15 akankshasaxena  admin  480 Sep 26 11:33 .
drwxr-xr-x  10 akankshasaxena  admin  320 Sep 26 11:33 ..
drwxr-xr-x   9 akankshasaxena  admin  288 Sep 26 11:33 10.10
drwxr-xr-x   9 akankshasaxena  admin  288 Sep 26 11:33 10.11
drwxr-xr-x   9 akankshasaxena  admin  288 Sep 26 11:33 10.12
drwxr-xr-x   9 akankshasaxena  admin  288 Sep 26 11:33 10.13
drwxr-xr-x   9 akankshasaxena  admin  288 Sep 26 11:33 10.14
drwxr-xr-x   9 akankshasaxena  admin  288 Sep 26 11:33 10.15
lrwxr-xr-x   1 akankshasaxena  admin    4 Sep 26 11:33 10.4 -> 10.5
drwxr-xr-x   5 akankshasaxena  admin  160 Sep 26 11:33 10.5
drwxr-xr-x   5 akankshasaxena  admin  160 Sep 26 11:33 10.6
drwxr-xr-x   5 akankshasaxena  admin  160 Sep 26 11:33 10.7
drwxr-xr-x   9 akankshasaxena  admin  288 Sep 26 11:33 10.8
drwxr-xr-x   9 akankshasaxena  admin  288 Sep 26 11:33 10.9
drwxr-xr-x   4 akankshasaxena  admin  128 Sep 26 11:33 fuse


$ . gem list pkg-config

*** LOCAL GEMS ***

pkg-config (1.3.8, 1.3.7)

$ ruby --version
ruby 2.6.4p104 (2019-08-28 revision 67798) [x86_64-darwin18]

There is old issue which got resolved 2 years back - #49
similar thing is happening with me

CMYK or grayscale PDF

For printing purpose, the color space of PDFs must be basically CMYK or grayscale.

Is it impossible to get a CMYK or grayscale PDF via improving rcairo?

Upgrading cairo to 1.17.6-1 breaks ruby-cairo-1.17.5-6

Hi all, not sure if this bug report is for you, but it's my best guess. Apparently there's a new version of cairo, and it's already been passed on to anyone running Arch. This breaks anything using ruby-cairo and ruby-gtk3 on my system. Example logs:

 kori@tempest  ~  ruby bin/ideapad-perf/ideapad-perf-tray.rb               
<internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require': /usr/lib/ruby/gems/3.0.0/extensions/x86_64-linux/3.0.0/cairo-1.17.5/cairo.so: undefined symbol: cairo_xml_create_for_stream - /usr/lib/ruby/gems/3.0.0/extensions/x86_64-linux/3.0.0/cairo-1.17.5/cairo.so (LoadError)
	from <internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /usr/lib/ruby/gems/3.0.0/gems/cairo-1.17.5/lib/cairo.rb:54:in `rescue in <top (required)>'
	from /usr/lib/ruby/gems/3.0.0/gems/cairo-1.17.5/lib/cairo.rb:50:in `<top (required)>'
	from <internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /usr/lib/ruby/gems/3.0.0/gems/cairo-gobject-3.4.5/lib/cairo-gobject.rb:17:in `<top (required)>'
	from <internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /usr/lib/ruby/gems/3.0.0/gems/gdk3-3.4.5/lib/gdk3.rb:18:in `<top (required)>'
	from <internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /usr/lib/ruby/gems/3.0.0/gems/gtk3-3.4.5/lib/gtk3.rb:18:in `<top (required)>'
	from <internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:160:in `require'
	from <internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:160:in `rescue in require'
	from <internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:149:in `require'
	from bin/ideapad-perf/ideapad-perf-tray.rb:2:in `<main>'
<internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- 3.0/cairo.so (LoadError)
	from <internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /usr/lib/ruby/gems/3.0.0/gems/cairo-1.17.5/lib/cairo.rb:52:in `<top (required)>'
	from <internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /usr/lib/ruby/gems/3.0.0/gems/cairo-gobject-3.4.5/lib/cairo-gobject.rb:17:in `<top (required)>'
	from <internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /usr/lib/ruby/gems/3.0.0/gems/gdk3-3.4.5/lib/gdk3.rb:18:in `<top (required)>'
	from <internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /usr/lib/ruby/gems/3.0.0/gems/gtk3-3.4.5/lib/gtk3.rb:18:in `<top (required)>'
	from <internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:160:in `require'
	from <internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:160:in `rescue in require'
	from <internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:149:in `require'
	from bin/ideapad-perf/ideapad-perf-tray.rb:2:in `<main>'
<internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- gtk3 (LoadError)
	from <internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from bin/ideapad-perf/ideapad-perf-tray.rb:2:in `<main>'

Additional info:

  • ruby-cairo-1.17.5-6, ruby-3.0.3-1, cairo-1.17.6-1

Steps to reproduce:
Upgrade cairo to the latest version and open anything that depends on ruby-gtk3/ruby-cairo.

rcairo 1.17.5 test failure with cairo 1.17.6

Looks like rcairo 1.17.5 causes test failure with cairo 1.17.6 (with cairo 1.17.4 rcairo test passes)

Failure: test_unit(SVGSurfaceTest)
/builddir/build/BUILD/cairo-1.17.5/TMPINSTDIR/usr/share/gems/gems/cairo-1.17.5/test/test_svg_surface.rb:13:in `test_unit'
     10:     only_cairo_version(1, 15, 10)
     11:     output = StringIO.new
     12:     surface = Cairo::SVGSurface.new(output, 10, 20)
  => 13:     assert_equal(Cairo::SVGUnit::PT, surface.document_unit)
     14:     surface.document_unit = Cairo::SVGUnit::CM
     15:     assert_equal(Cairo::SVGUnit::CM, surface.document_unit)
     16:   end
<7> expected but was
<0>

Memory leak on ARM

Hi,

I have two Gentoos installed with exactly the same packages and gems, but one is an AMD64 and the other one is an ARM.

The same code above causes a memory leak, but only on my ARM machine:

require 'cairo'

loop do
  cs = Cairo::ImageSurface.new(:ARGB32, 600, 600)
  cr = Cairo::Context.new(cs)
  GC.start
end

If I remove cr = Cairo::Context.new(cs) the leak doesn't happen.

Here is the info from my AMD64:

ruby -v
ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-linux]

pkg-config cairo --modversion
1.12.16

gem list cairo
cairo (1.12.9)

And here the same from my ARM:

ruby -v
ruby 2.1.3p242 (2014-09-19 revision 47630) [armv7a-linux-eabi]

pkg-config cairo --modversion
1.12.16

gem list cairo
cairo (1.12.9)

If I can help with more info, feel free to ask. I haven't any success debugging it with valgrind because at the moment I'm only able to ruby the arm system on a qemu chroot, on which I can't run valgrind. In a fell days I may have a new arm machine on which I can try it. Thanks!

Error when installing on macOS Big Sur 11.2

When I try to install

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/ludo/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/cairo-1.17.4/ext/cairo
/Users/ludo/.rbenv/versions/2.7.1/bin/ruby -I /Users/ludo/.rbenv/versions/2.7.1/lib/ruby/2.7.0 -r ./siteconf20210203-60976-1miwu3o.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/ludo/.rbenv/versions/2.7.1/bin/$(RUBY_BASE_NAME)
	--with-pkg-config
	--without-pkg-config
	--with-override-variables
	--without-override-variables
/Users/ludo/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/pkg-config-1.4.4/lib/pkg-config.rb:389:in `parse_pc': .pc doesn't exist: <expat> (PackageConfig::NotFoundError)
	from /Users/ludo/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/pkg-config-1.4.4/lib/pkg-config.rb:233:in `declaration'
	from /Users/ludo/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/pkg-config-1.4.4/lib/pkg-config.rb:178:in `requires_private'
	from /Users/ludo/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/pkg-config-1.4.4/lib/pkg-config.rb:504:in `block in all_required_packages'
	from /Users/ludo/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/pkg-config-1.4.4/lib/pkg-config.rb:259:in `collect_requires'
	from /Users/ludo/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/pkg-config-1.4.4/lib/pkg-config.rb:265:in `block in collect_requires'
	from /Users/ludo/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/pkg-config-1.4.4/lib/pkg-config.rb:260:in `each'
	from /Users/ludo/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/pkg-config-1.4.4/lib/pkg-config.rb:260:in `collect_requires'
	from /Users/ludo/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/pkg-config-1.4.4/lib/pkg-config.rb:265:in `block in collect_requires'
	from /Users/ludo/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/pkg-config-1.4.4/lib/pkg-config.rb:260:in `each'
	from /Users/ludo/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/pkg-config-1.4.4/lib/pkg-config.rb:260:in `collect_requires'
	from /Users/ludo/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/pkg-config-1.4.4/lib/pkg-config.rb:503:in `all_required_packages'
	from /Users/ludo/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/pkg-config-1.4.4/lib/pkg-config.rb:283:in `collect_cflags'
	from /Users/ludo/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/pkg-config-1.4.4/lib/pkg-config.rb:191:in `cflags_only_other'
	from /Users/ludo/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/pkg-config-1.4.4/lib/pkg-config.rb:564:in `cflags_only_other'
	from /Users/ludo/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/pkg-config-1.4.4/lib/pkg-config.rb:611: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/ludo/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/extensions/x86_64-darwin-20/2.7.0/cairo-1.17.4/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/ludo/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/cairo-1.17.4 for inspection.
Results logged to /Users/ludo/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/extensions/x86_64-darwin-20/2.7.0/cairo-1.17.4/gem_make.out

The mkmf.log file contains the following:

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

"clang -o conftest -I/Users/ludo/.rbenv/versions/2.7.1/include/ruby-2.7.0/x86_64-darwin20 -I/Users/ludo/.rbenv/versions/2.7.1/include/ruby-2.7.0/ruby/backward -I/Users/ludo/.rbenv/versions/2.7.1/include/ruby-2.7.0 -I. -I/Users/ludo/.rbenv/versions/2.7.1/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens  -fno-common -pipe conftest.c  -L. -L/Users/ludo/.rbenv/versions/2.7.1/lib -L. -L/Users/ludo/.rbenv/versions/2.7.1/lib  -fstack-protector-strong -L/usr/local/lib     -lruby.2.7   "
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return !!argv[argc];
6: }
/* end */

"clang -I/Users/ludo/.rbenv/versions/2.7.1/include/ruby-2.7.0/x86_64-darwin20 -I/Users/ludo/.rbenv/versions/2.7.1/include/ruby-2.7.0/ruby/backward -I/Users/ludo/.rbenv/versions/2.7.1/include/ruby-2.7.0 -I. -I/Users/ludo/.rbenv/versions/2.7.1/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -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

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

Error since updating to big sur 11.2
Any idea on how to fix this ?

rcairo latest git with cairo 1.10.2 produces test error

With cairo 1.10.2, rcairo test cases causes some error:

..........................E
===============================================================================
Error:
test_acquire_and_release(RasterPatternSourceTest):
ArgumentError: wrong number of arguments(2 for 0)
    /home/mtasaka/rpmbuild/TEMP/rcairo/rcairo/test/test_raster_source_pattern.rb:14:in `initialize'
    /home/mtasaka/rpmbuild/TEMP/rcairo/rcairo/test/test_raster_source_pattern.rb:14:in `new'
    /home/mtasaka/rpmbuild/TEMP/rcairo/rcairo/test/test_raster_source_pattern.rb:14:in `block (2 levels) in test_acquire_and_release'
    /home/mtasaka/rpmbuild/TEMP/rcairo/rcairo/test/test_raster_source_pattern.rb:9:in `initialize'
    /home/mtasaka/rpmbuild/TEMP/rcairo/rcairo/test/test_raster_source_pattern.rb:9:in `new'
    /home/mtasaka/rpmbuild/TEMP/rcairo/rcairo/test/test_raster_source_pattern.rb:9:in `block in test_acquire_and_release'
    /home/mtasaka/rpmbuild/TEMP/rcairo/rcairo/test/test_raster_source_pattern.rb:8:in `initialize'
    /home/mtasaka/rpmbuild/TEMP/rcairo/rcairo/test/test_raster_source_pattern.rb:8:in `new'
    /home/mtasaka/rpmbuild/TEMP/rcairo/rcairo/test/test_raster_source_pattern.rb:8:in `test_acquire_and_release'
===============================================================================
E
===============================================================================
Error:
test_error(RasterPatternSourceTest::CopyTest):
NotImplementedError: Cairo::ScriptDevice class creation isn't supported on this cairo installation
    /home/mtasaka/rpmbuild/TEMP/rcairo/rcairo/test/test_raster_source_pattern.rb:117:in `initialize'
    /home/mtasaka/rpmbuild/TEMP/rcairo/rcairo/test/test_raster_source_pattern.rb:117:in `new'
    /home/mtasaka/rpmbuild/TEMP/rcairo/rcairo/test/test_raster_source_pattern.rb:117:in `test_error'
===============================================================================
E
===============================================================================
Error:
test_success(RasterPatternSourceTest::CopyTest):
NotImplementedError: Cairo::ScriptDevice class creation isn't supported on this cairo installation
    /home/mtasaka/rpmbuild/TEMP/rcairo/rcairo/test/test_raster_source_pattern.rb:80:in `initialize'
    /home/mtasaka/rpmbuild/TEMP/rcairo/rcairo/test/test_raster_source_pattern.rb:80:in `new'
    /home/mtasaka/rpmbuild/TEMP/rcairo/rcairo/test/test_raster_source_pattern.rb:80:in `test_success'
===============================================================================
E
===============================================================================
Error:
test_error(RasterPatternSourceTest::SnapshotTest):
ArgumentError: wrong number of arguments(2 for 0)
    /home/mtasaka/rpmbuild/TEMP/rcairo/rcairo/test/test_raster_source_pattern.rb:60:in `initialize'
    /home/mtasaka/rpmbuild/TEMP/rcairo/rcairo/test/test_raster_source_pattern.rb:60:in `new'
    /home/mtasaka/rpmbuild/TEMP/rcairo/rcairo/test/test_raster_source_pattern.rb:60:in `block (2 levels) in test_error'
    /home/mtasaka/rpmbuild/TEMP/rcairo/rcairo/test/test_raster_source_pattern.rb:58:in `initialize'
    /home/mtasaka/rpmbuild/TEMP/rcairo/rcairo/test/test_raster_source_pattern.rb:58:in `new'
    /home/mtasaka/rpmbuild/TEMP/rcairo/rcairo/test/test_raster_source_pattern.rb:58:in `block in test_error'
    /home/mtasaka/rpmbuild/TEMP/rcairo/rcairo/test/test_raster_source_pattern.rb:57:in `initialize'
    /home/mtasaka/rpmbuild/TEMP/rcairo/rcairo/test/test_raster_source_pattern.rb:57:in `new'
    /home/mtasaka/rpmbuild/TEMP/rcairo/rcairo/test/test_raster_source_pattern.rb:57:in `test_error'
===============================================================================
E
===============================================================================
Error:
test_success(RasterPatternSourceTest::SnapshotTest):
ArgumentError: wrong number of arguments(2 for 0)
    /home/mtasaka/rpmbuild/TEMP/rcairo/rcairo/test/test_raster_source_pattern.rb:43:in `initialize'
    /home/mtasaka/rpmbuild/TEMP/rcairo/rcairo/test/test_raster_source_pattern.rb:43:in `new'
    /home/mtasaka/rpmbuild/TEMP/rcairo/rcairo/test/test_raster_source_pattern.rb:43:in `block (2 levels) in test_success'
    /home/mtasaka/rpmbuild/TEMP/rcairo/rcairo/test/test_raster_source_pattern.rb:41:in `initialize'
    /home/mtasaka/rpmbuild/TEMP/rcairo/rcairo/test/test_raster_source_pattern.rb:41:in `new'
    /home/mtasaka/rpmbuild/TEMP/rcairo/rcairo/test/test_raster_source_pattern.rb:41:in `block in test_success'
    /home/mtasaka/rpmbuild/TEMP/rcairo/rcairo/test/test_raster_source_pattern.rb:40:in `initialize'
    /home/mtasaka/rpmbuild/TEMP/rcairo/rcairo/test/test_raster_source_pattern.rb:40:in `new'
    /home/mtasaka/rpmbuild/TEMP/rcairo/rcairo/test/test_raster_source_pattern.rb:40:in `test_success'

0 tests, 121 assertions, 0 failures, 5 errors, 0 pendings, 10 omissions, 0 notifications

Looks like RasterSourcePattern is not available on 1.10.2, however rcairo tries to test it.
Note that with cairo 1.10.2 rcairo 1.12.1 gem (which is the latest released gem) provides more errors (on ScriptDeviceTest and XMLDeviceTest), which seems fixed with #11

Error when installing on macOS Big Sur beta 3

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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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?

Warnings on installing RCairo on Windows

Hello! I tried to install rcairo last night on:

  • cairo (1.17.5)
  • Windows 10 x64
  • Ruby 2.6.6p146 (2020-03-31 revision 67876) [x64-mingw32]

The installation was successful but I got these warnings/ errors during the installation.

Installing required msys2 packages: mingw-w64-x86_64-cairo
warning: dependency cycle detected:
warning: mingw-w64-x86_64-harfbuzz will be installed before its mingw-w64-x86_64-freetype dependency
error: failed retrieving file 'mingw-w64-x86_64-bzip2-1.0.8-1-any.pkg.tar.xz' from repo.msys2.org : The requested URL returned error: 404
error: failed retrieving file 'mingw-w64-x86_64-bzip2-1.0.8-1-any.pkg.tar.xz' from sourceforge.net : Maximum file size exceeded
error: failed retrieving file 'mingw-w64-x86_64-mpdecimal-2.4.2-1-any.pkg.tar.xz' from repo.msys2.org : The requested URL returned error: 404
error: failed retrieving file 'mingw-w64-x86_64-mpdecimal-2.4.2-1-any.pkg.tar.xz' from sourceforge.net : The requested URL returned error: 404
error: failed retrieving file 'mingw-w64-x86_64-tk-8.6.10-1-any.pkg.tar.xz' from repo.msys2.org : The requested URL returned error: 404
error: failed retrieving file 'mingw-w64-x86_64-tk-8.6.10-1-any.pkg.tar.xz' from sourceforge.net : The requested URL returned error: 404
error: failed retrieving file 'mingw-w64-x86_64-graphite2-1.3.13-2-any.pkg.tar.xz' from repo.msys2.org : The requested URL returned error: 404
error: failed retrieving file 'mingw-w64-x86_64-graphite2-1.3.13-2-any.pkg.tar.xz' from sourceforge.net : The requested URL returned error: 404
error: failed retrieving file 'mingw-w64-x86_64-harfbuzz-2.6.4-3-any.pkg.tar.xz' from repo.msys2.org : The requested URL returned error: 404
error: failed retrieving file 'mingw-w64-x86_64-harfbuzz-2.6.4-3-any.pkg.tar.xz' from sourceforge.net : The requested URL returned error: 404
error: failed retrieving file 'mingw-w64-x86_64-freetype-2.10.1-1-any.pkg.tar.xz' from repo.msys2.org : The requested URL returned error: 404
error: failed retrieving file 'mingw-w64-x86_64-freetype-2.10.1-1-any.pkg.tar.xz' from sourceforge.net : The requested URL returned error: 404
error: failed retrieving file 'mingw-w64-x86_64-fontconfig-2.13.1-1-any.pkg.tar.xz' from repo.msys2.org : The requested URL returned error: 404
error: failed retrieving file 'mingw-w64-x86_64-fontconfig-2.13.1-1-any.pkg.tar.xz' from sourceforge.net : The requested URL returned error: 404
error: failed retrieving file 'mingw-w64-x86_64-pixman-0.38.4-1-any.pkg.tar.xz' from repo.msys2.org : The requested URL returned error: 404
error: failed retrieving file 'mingw-w64-x86_64-pixman-0.38.4-1-any.pkg.tar.xz' from sourceforge.net : The requested URL returned error: 404
error: failed retrieving file 'mingw-w64-x86_64-cairo-1.16.0-1-any.pkg.tar.xz' from repo.msys2.org : The requested URL returned error: 404
error: failed retrieving file 'mingw-w64-x86_64-cairo-1.16.0-1-any.pkg.tar.xz' from sourceforge.net : The requested URL returned error: 404
Building native extensions. This could take a while...

I documented this and wrote about the installation being successful on: https://notepad.onghu.com/2021/ruby-cairo-installation-windows/ so that people do not get worried, but I don't know what the root cause is, and how to fix it.

Thanks!

Doesn't detect cairo when installed via homebrew

  1. Cairo is installed using homebrew
$ brew install cairo  
Error: cairo-1.12.2 already installed
  1. checkout latest github code
$ cd /tmp
$ git clone git://github.com/rcairo/rcairo.git
  1. install
$ cd rcairo
$ rake install

cairo 1.12.3 built to pkg/cairo-1.12.3.gem
rake aborted!
Couldn't install gem, run `gem install /private/tmp/rcairo/pkg/cairo-1.12.3.gem' for more detailed output

Tasks: TOP => install
(See full trace by running task with --trace)

$ gem install /private/tmp/rcairo/pkg/cairo-1.12.3.gem

Building native extensions.  This could take a while...
ERROR:  Error installing /private/tmp/rcairo/pkg/cairo-1.12.3.gem:
    ERROR: Failed to build gem native extension.

        /Users/rmoriz/.rbenv/versions/1.9.3-p194-perf/bin/ruby extconf.rb
checking for GCC... yes
checking for Win32 OS... no
checking for Mac OS X... yes
checking for cairo version (>= 1.2.0)... no
checking for brew... yes
installing 'cairo' native package... failed
failed to run 'brew install cairo'.
*** 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/rmoriz/.rbenv/versions/1.9.3-p194-perf/bin/ruby
    --with-pkg-config
    --without-pkg-config
    --with-override-variables
    --without-override-variables


Gem files will remain installed in /Users/rmoriz/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/cairo-1.12.3 for inspection.
Results logged to /Users/rmoriz/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/cairo-1.12.3/ext/cairo/gem_make.out


Error installing on Heroku: `stderr@@GLIBC_2.2.5' can not be used

Hi all,

I'm having trouble trying to deploy an app to Heroku. The error seems to be caused by a failure in the Cairo gem make script.

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
remote:
current directory:
/tmp/build_c62652fd/vendor/bundle/ruby/2.7.0/gems/cairo-1.17.5/ext/cairo
/tmp/build_c62652fd/vendor/ruby-2.7.3/bin/ruby -I
/tmp/build_c62652fd/vendor/ruby-2.7.3/lib/ruby/2.7.0 -r
./siteconf20210623-803-1w1w2pl.rb extconf.rb
checking for GCC... yes
checking for Homebrew... no
checking for cairo version (>= 1.2.0)... yes
checking for cairo-ft... yes
checking for macOS... no
checking for HAVE_RUBY_ST_H in ruby.h... yes
checking for HAVE_RUBY_IO_H in ruby.h... yes
checking for rb_errinfo() in ruby.h... yes
checking for rb_gc_adjust_memory_usage() in ruby.h... yes
checking for enum ruby_value_type in ruby.h... yes
creating Makefile
remote:
current directory:
/tmp/build_c62652fd/vendor/bundle/ruby/2.7.0/gems/cairo-1.17.5/ext/cairo
make "DESTDIR=" clean
remote:
current directory:
/tmp/build_c62652fd/vendor/bundle/ruby/2.7.0/gems/cairo-1.17.5/ext/cairo
make "DESTDIR="
compiling rb_cairo.c
compiling rb_cairo_constants.c
compiling rb_cairo_context.c
compiling rb_cairo_device.c
compiling rb_cairo_exception.c
compiling rb_cairo_font_extents.c
compiling rb_cairo_font_face.c
compiling rb_cairo_font_options.c
compiling rb_cairo_glyph.c
compiling rb_cairo_io.c
compiling rb_cairo_matrix.c
compiling rb_cairo_path.c
compiling rb_cairo_pattern.c
compiling rb_cairo_private.c
compiling rb_cairo_quartz_surface.c
compiling rb_cairo_rectangle.c
compiling rb_cairo_region.c
compiling rb_cairo_scaled_font.c
compiling rb_cairo_surface.c
compiling rb_cairo_text_cluster.c
compiling rb_cairo_text_extents.c
linking shared-object cairo.so
/usr/bin/ld:
/tmp/build_c62652fd/.apt/usr/lib/x86_64-linux-gnu/libcairo.a(cairo-boxes.o):
relocation R_X86_64_PC32 against symbol `stderr@@GLIBC_2.2.5' can not be used
when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make: *** [Makefile:262: cairo.so] Error 1
remote:
make failed, exit code 2
remote:
Gem files will remain installed in
/tmp/build_c62652fd/vendor/bundle/ruby/2.7.0/gems/cairo-1.17.5 for inspection.
Results logged to
/tmp/build_c62652fd/vendor/bundle/ruby/2.7.0/extensions/x86_64-linux/2.7.0/cairo-1.17.5/gem_make.out
remote:
An error occurred while installing cairo (1.17.5), and Bundler cannot continue.
Make sure that `gem install cairo -v '1.17.5' --source 'https://rubygems.org/'`
succeeds before bundling.
remote:
In Gemfile:
  gtk3 was resolved to 3.4.4, which depends on
    gdk3 was resolved to 3.4.4, which depends on
      pango was resolved to 3.4.4, which depends on
        cairo-gobject was resolved to 3.4.4, which depends on
          cairo
remote:
remote:  !
Failed to install gems via Bundler.
remote:  !
Push rejected, failed to compile Ruby app.
remote:
Push failed

Cairo libcairo2-dev is installed on the system using apt-get.

Any idea what's going wrong here?

Question: how to use a custom font with Pango?

I've been trying to define a custom font (one that is not available system-wide) through:

roboto = Cairo::FreeTypeFontFace.new('Roboto[wdth,wght].ttf')

It seems I can't pass that to pango with existing ruby-exposed api. Do you happen to have an example or know how this can be done? From what I understand it only relies on platform font catalog, which is non ideal in some cases (when you are trying to just generate some images).

It seems in Javascript (Canvas) which relies on Cairo and Pango, they've implemented by adding a second FontDescription collection and a register_font method: https://github.com/Automattic/node-canvas/pull/715/files#diff-fcd2a8b5219778601499d08051ba0c47e0f29247b3fca83caacaa385fd747b9a.

I've also found some other explanations here: http://mces.blogspot.com/2015/05/how-to-use-custom-application-fonts.html

Can not compile rcairo - error below

Hi.

Rcairo 1.12.9

It does not work:

In directory:
/Depot/jjj/rcairo-1.12.9/ruby extconf.rb

checking for GCC... yes
checking for Win32 OS... no
checking for cairo version (>= 1.2.0)... yes
checking for Mac OS X... no
checking for HAVE_RUBY_ST_H in ruby.h... yes
checking for HAVE_RUBY_IO_H in ruby.h... yes
checking for rb_errinfo() in ruby.h... no
checking for enum ruby_value_type in ruby.h... yes
creating Makefile
creating Makefile
/Depot/jjj/rcairo-1.12.9/make
(cd ext/cairo && make)
make[1]: Entering directory '/Depot/jjj/rcairo-1.12.9/ext/cairo'
compiling rb_cairo_font_face.c
compiling rb_cairo_rectangle.c
compiling rb_cairo_exception.c
compiling rb_cairo_io.c
In file included from rb_cairo_io.c:12:0:
rb_cairo_io.c: In function 'rb_cairo__io_func_rescue':
rb_cairo_private.h:43:23: error: 'ruby_errinfo' undeclared (first use in this function)

define RB_ERRINFO (ruby_errinfo)

                   ^

rb_cairo_io.c:49:20: note: in expansion of macro 'RB_ERRINFO'
closure->error = RB_ERRINFO;
^
rb_cairo_private.h:43:23: note: each undeclared identifier is reported only once for each function it appears in

define RB_ERRINFO (ruby_errinfo)

                   ^

rb_cairo_io.c:49:20: note: in expansion of macro 'RB_ERRINFO'
closure->error = RB_ERRINFO;
^
Makefile:224: recipe for target 'rb_cairo_io.o' failed
make[1]: *** [rb_cairo_io.o] Error 1
make[1]: Leaving directory '/Depot/jjj/rcairo-1.12.9/ext/cairo'
Makefile:2: recipe for target 'all' failed
make: *** [all] Error 2

My system:

cairo 1.12.16

Operating System: GNU/Linux
OS Bit Type: x86_64
Kernel Version: 3.10.17
GCC Version: 4.8.2
Glibc Version: 2.17
CFLAGS in use: -O2 -fPIC -fno-strict-overflow
RAM: 7860120 kB RAM (7675.9 MB) (7.5 Gig)
Binutils Version: GNU ld (GNU Binutils) 2.24
Make Version in use: 4.0
Cmake Version in use: 3.0.0
CPU Model: Intel(R) Celeron(R) CPU G1630 @ 2.80GHz
Screen Resolution: 1920x1080
Openssl Version: 1.0.1e
Tar Version: 1.27.1
Ruby Version: 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
Rubygems Version: 2.4.1
Rubygems Installation Directory: /Programs/Ruby/2.1.2/lib/ruby/gems/2.1.0
GTK Version 2: 2.24.22
GTK Version 3: 3.13.4
Glib Version: 2.41.2
ATK Version: 2.13.3
Pango Version: 1.36.5
Cairo Version: 1.12.16
Bison Version: 3.0.2
Intltool Version: 0.50.2
Nasm version: 2.10.09
M4 version: 1.4.17
Flex Version: 2.5.37
Readline Version: 6.3
File version: 5.19
KDE Version: 4.13.3
Grep Version: 2.20
Coreutils Version: 8.23
Fontconfig Version: 2.11.1
Perl Version: 5.18.1
Python Version: 2.7.5

Ffmpeg Version: 2.3

Thanks

test_xml_device.rb fails if XMLSurface is not defined (because XMLDevice is)

On my Debian system, the librairy cairo (1.12) does not define CAIRO_HAS_XML_SURFACE, nor CAIRO_HAS_XML_DEVICE in cairo-features.h.
Whereas the version 1.10 of rcairo was answering false to the questions: Cairo::constant_defined?("XMLDevice"), it is answering true with the version 1.12. (The answer to Cairo::constant_defined?("XMLSurface") is false in both cases).

As a consequence, the test test_xml_device.rb fails with the following error:

...................................................................E
===============================================================================
Error: test_new(XMLDeviceTest)
ArgumentError: wrong number of arguments(1 for 0)
/home/boutil/debian/packages/ruby/ruby-cairo/ruby-cairo/test/test_xml_device.rb:10:in `initialize'
      7: 
      8:   def test_new
      9:     output = StringIO.new
  => 10:     device = Cairo::XMLDevice.new(output)
     11:     assert_equal("", output.string)
     12:   end
     13: 
/home/boutil/debian/packages/ruby/ruby-cairo/ruby-cairo/test/test_xml_device.rb:10:in `new'
/home/boutil/debian/packages/ruby/ruby-cairo/ruby-cairo/test/test_xml_device.rb:10:in `test_new'
===============================================================================
E
===============================================================================
Error: test_new_with_block(XMLDeviceTest)
ArgumentError: wrong number of arguments(1 for 0)
/home/boutil/debian/packages/ruby/ruby-cairo/ruby-cairo/test/test_xml_device.rb:17:in `initialize'
     14:   def test_new_with_block
     15:     output = StringIO.new
     16:     string = nil
  => 17:     Cairo::XMLDevice.new(output) do |device|
     18:       string = output.string
     19:     end
     20:     assert_equal("", string)
/home/boutil/debian/packages/ruby/ruby-cairo/ruby-cairo/test/test_xml_device.rb:17:in `new'
/home/boutil/debian/packages/ruby/ruby-cairo/ruby-cairo/test/test_xml_device.rb:17:in `test_new_with_block'
===============================================================================
O
===============================================================================
Only for XMLSurface surface available [test_new(XMLSurfaceTest)]
/home/boutil/debian/packages/ruby/ruby-cairo/ruby-cairo/test/cairo-test-utils.rb:30:in `only_surface'
===============================================================================

as the test is not omitted because Cairo::const_defined("XMLDevice") is true, but NEED_DEFINE_OUTPUT_INITIALIZE is not defined (thus the ArgumentError in the constructor, if I understand correctly).

A possibility is to use the following patch, to move back the #ifdef CAIRO_HAS_XML_SURFACE statement before the definition of the XMLDevice class, as it was the case before (at least in 1.10) to avoid the definition of XMLDevice without XMLSurface. What do you think?

--- ruby-cairo-1.12.1.orig/ext/cairo/rb_cairo_device.c
+++ ruby-cairo-1.12.1/ext/cairo/rb_cairo_device.c
@@ -418,9 +418,10 @@ Init_cairo_device (void)
   rb_cCairo_XlibDevice =
     rb_define_class_under (rb_mCairo, "XlibDevice", rb_cCairo_Device);

+#  ifdef CAIRO_HAS_XML_SURFACE
   rb_cCairo_XMLDevice =
     rb_define_class_under (rb_mCairo, "XMLDevice", rb_cCairo_Device);
-#  ifdef CAIRO_HAS_XML_SURFACE
+
   rb_define_method (rb_cCairo_XMLDevice, "initialize",
                     cr_xml_device_initialize, 1);

If XMLDevice needs to be defined anyway, then the way the selection of omitted tests has to be changed. Thanks!

Cédric

requesting write to buffer/memory

I'm might not know how to use Cairo/RCairo, but I wasn't able to determine a way to capture a surface to a byte array. I'm working with Rails, so it would impact performance pretty heavily to write files out to the disk, just to read them back. TIA.

Is there a way to combine .svg files?

I have a base .svg that has a logo shape within it, I'd like to annotate beneath the logo using a custom font and a string.

Here's what I have so far, it's not working very well.

require 'cairo'

class SVG
  def self.text_to_svg text
    text = Text.format_text text
    svg = design_from_declaration text
  end

  def self.design_from_declaration text
    path = prepare_svg
    svg = annotate_svg path, text
  end

  def self.prepare_svg
    token = rand(36**8).to_s(36)
    path = 'tmp/declaration_image_' + token + '.svg'
    FileUtils.cp 'app/assets/images/base.svg', path

    path
  end

  # this method is overwriting the original data in
  # base.svg
  def self.annotate_svg path, text
    height = 580
    width = 380

    surface = Cairo::SVGSurface.new(path, width, height)
    c = Cairo::Context.new(surface)

    c.set_font_size(20.0)
    #c.font_face = 'app/assets/fonts/confidential.ttf' # returns 'TypeError: not a cairo font face: '
    c.move_to 50, 50
    c.set_source_rgba [0,80,0,20]
    c.text_path text

    c.fill

    c.target.finish
  end
end

name clash between cairo.rb and cairo.so

When rcairo is installed without rubygems (e.g. ruby extconf.rb && make && make install), there is a name clash between cairo.rb and cairo.so:

$ ruby -r cairo -e 'puts :ok'
/usr/lib/ruby/vendor_ruby/1.8/i486-linux/cairo.so: uninitialized constant Cairo::Color (NameError)
$ echo $?
1

That happens because the directory in which cairo.so ends up comes first in $LOAD_PATH, so when a program does require "cairo" it will end up loading cairo.so instead of cairo.rb. The solution that several other packages use for this is to add a _ext suffix for the compiled extension, e.g. in cairo's case it would be cairo_ext.

Segfault occurs by a use of already finished surface

Hi,

I noticed a use of already finished surface (the surface whose Surface#finish is called) causes a segmentation fault.
I know a use of already finished surface is wrong usage.
But it would be better if it raises an exception instead of segfault.

Here is a sample code to reproduce the problem and its result.

% cat test.rb
gem 'cairo'
require 'cairo'
surface = Cairo::SVGSurface.new( "test.svg", 100, 100 )
surface.finish
cr = Cairo::Context.new( surface ) # this will cause a segfault.

% ruby test.rb
-:5: [BUG] Segmentation fault
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0005 p:---- s:0014 b:0014 l:000013 d:000013 CFUNC  :initialize
c:0004 p:---- s:0012 b:0012 l:000011 d:000011 CFUNC  :new
c:0003 p:0082 s:0008 b:0008 l:0011c8 d:001bb8 EVAL   -:5
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:0011c8 d:0011c8 TOP   

-- Ruby level backtrace information ----------------------------------------
-:5:in `<main>'
-:5:in `new'
-:5:in `initialize'

-- C level backtrace information -------------------------------------------
/usr/lib/libruby-1.9.1.so.1.9(+0x158429) [0x7f0c6dfa2429]
/usr/lib/libruby-1.9.1.so.1.9(+0x5a589) [0x7f0c6dea4589]
/usr/lib/libruby-1.9.1.so.1.9(rb_bug+0xb3) [0x7f0c6dea4d73]
/usr/lib/libruby-1.9.1.so.1.9(+0xf92df) [0x7f0c6df432df]
/lib/x86_64-linux-gnu/libpthread.so.0(+0xf210) [0x7f0c6dc3d210] ../nptl/sysdeps/pthread/funlockfile.c:29
[0x1ab7210]

-- Other runtime information -----------------------------------------------

* Loaded script: -

* Loaded features:

    0 enumerator.so
    1 /usr/lib/ruby/1.9.1/x86_64-linux/enc/encdb.so
    2 /usr/lib/ruby/1.9.1/x86_64-linux/enc/trans/transdb.so
    3 /usr/lib/ruby/1.9.1/rubygems/defaults.rb
    4 /usr/lib/ruby/1.9.1/x86_64-linux/rbconfig.rb
    5 /usr/lib/ruby/1.9.1/rubygems/deprecate.rb
    6 /usr/lib/ruby/1.9.1/rubygems/exceptions.rb
    7 /usr/lib/ruby/1.9.1/rubygems/custom_require.rb
    8 /usr/lib/ruby/1.9.1/rubygems.rb
    9 /usr/lib/ruby/1.9.1/rubygems/version.rb
   10 /usr/lib/ruby/1.9.1/rubygems/requirement.rb
   11 /usr/lib/ruby/1.9.1/rubygems/dependency.rb
   12 /usr/lib/ruby/1.9.1/rubygems/platform.rb
   13 /usr/lib/ruby/1.9.1/rubygems/specification.rb
   14 /usr/lib/ruby/1.9.1/rubygems/path_support.rb
   15 /home/qw/.gem/ruby/1.9.1/gems/cairo-1.12.6/lib/cairo/color.rb
   16 /home/qw/.gem/ruby/1.9.1/gems/cairo-1.12.6/lib/cairo/paper.rb
   17 /home/qw/.gem/ruby/1.9.1/gems/cairo-1.12.6/lib/cairo.so
   18 /home/qw/.gem/ruby/1.9.1/gems/cairo-1.12.6/lib/cairo/constants.rb
   19 /home/qw/.gem/ruby/1.9.1/gems/cairo-1.12.6/lib/cairo/point.rb
   20 /home/qw/.gem/ruby/1.9.1/gems/cairo-1.12.6/lib/cairo/colors.rb
   21 /home/qw/.gem/ruby/1.9.1/gems/cairo-1.12.6/lib/cairo/papers.rb
   22 /home/qw/.gem/ruby/1.9.1/gems/cairo-1.12.6/lib/cairo/context/rectangle.rb
   23 /home/qw/.gem/ruby/1.9.1/gems/cairo-1.12.6/lib/cairo/context/triangle.rb
   24 /home/qw/.gem/ruby/1.9.1/gems/cairo-1.12.6/lib/cairo/context/circle.rb
   25 /home/qw/.gem/ruby/1.9.1/gems/cairo-1.12.6/lib/cairo/context/path.rb
   26 /home/qw/.gem/ruby/1.9.1/gems/cairo-1.12.6/lib/cairo/context/blur.rb
   27 /home/qw/.gem/ruby/1.9.1/gems/cairo-1.12.6/lib/cairo/context/color.rb
   28 /home/qw/.gem/ruby/1.9.1/gems/cairo-1.12.6/lib/cairo/context.rb
   29 /home/qw/.gem/ruby/1.9.1/gems/cairo-1.12.6/lib/cairo/device.rb
   30 /home/qw/.gem/ruby/1.9.1/gems/cairo-1.12.6/lib/cairo/surface.rb
   31 /home/qw/.gem/ruby/1.9.1/gems/cairo-1.12.6/lib/cairo/pattern.rb
   32 /usr/lib/ruby/1.9.1/forwardable.rb
   33 /home/qw/.gem/ruby/1.9.1/gems/cairo-1.12.6/lib/cairo/path.rb
   34 /home/qw/.gem/ruby/1.9.1/gems/cairo-1.12.6/lib/cairo.rb

* Process memory map:

00400000-00401000 r-xp 00000000 08:05 149472                             /usr/bin/ruby1.9.1
00600000-00601000 r--p 00000000 08:05 149472                             /usr/bin/ruby1.9.1
00601000-00602000 rw-p 00001000 08:05 149472                             /usr/bin/ruby1.9.1
01787000-01ce5000 rw-p 00000000 00:00 0                                  [heap]
7f0c6a22c000-7f0c6a241000 r-xp 00000000 08:05 655383                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7f0c6a241000-7f0c6a441000 ---p 00015000 08:05 655383                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7f0c6a441000-7f0c6a442000 rw-p 00015000 08:05 655383                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7f0c6a442000-7f0c6a447000 r-xp 00000000 08:05 140663                     /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0
7f0c6a447000-7f0c6a646000 ---p 00005000 08:05 140663                     /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0
7f0c6a646000-7f0c6a647000 rw-p 00004000 08:05 140663                     /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0
7f0c6a647000-7f0c6a649000 r-xp 00000000 08:05 140661                     /usr/lib/x86_64-linux-gnu/libXau.so.6.0.0
7f0c6a649000-7f0c6a849000 ---p 00002000 08:05 140661                     /usr/lib/x86_64-linux-gnu/libXau.so.6.0.0
7f0c6a849000-7f0c6a84a000 rw-p 00002000 08:05 140661                     /usr/lib/x86_64-linux-gnu/libXau.so.6.0.0
7f0c6a84a000-7f0c6a871000 r-xp 00000000 08:05 657164                     /lib/x86_64-linux-gnu/libexpat.so.1.6.0
7f0c6a871000-7f0c6aa71000 ---p 00027000 08:05 657164                     /lib/x86_64-linux-gnu/libexpat.so.1.6.0
7f0c6aa71000-7f0c6aa73000 r--p 00027000 08:05 657164                     /lib/x86_64-linux-gnu/libexpat.so.1.6.0
7f0c6aa73000-7f0c6aa74000 rw-p 00029000 08:05 657164                     /lib/x86_64-linux-gnu/libexpat.so.1.6.0
7f0c6aa74000-7f0c6aa8b000 r-xp 00000000 08:05 655599                     /lib/x86_64-linux-gnu/libz.so.1.2.8
7f0c6aa8b000-7f0c6ac8a000 ---p 00017000 08:05 655599                     /lib/x86_64-linux-gnu/libz.so.1.2.8
7f0c6ac8a000-7f0c6ac8b000 r--p 00016000 08:05 655599                     /lib/x86_64-linux-gnu/libz.so.1.2.8
7f0c6ac8b000-7f0c6ac8c000 rw-p 00017000 08:05 655599                     /lib/x86_64-linux-gnu/libz.so.1.2.8
7f0c6ac8c000-7f0c6ac9d000 r-xp 00000000 08:05 135903                     /usr/lib/x86_64-linux-gnu/libXext.so.6.4.0
7f0c6ac9d000-7f0c6ae9d000 ---p 00011000 08:05 135903                     /usr/lib/x86_64-linux-gnu/libXext.so.6.4.0
7f0c6ae9d000-7f0c6ae9e000 rw-p 00011000 08:05 135903                     /usr/lib/x86_64-linux-gnu/libXext.so.6.4.0
7f0c6ae9e000-7f0c6afd3000 r-xp 00000000 08:05 164415                     /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0
7f0c6afd3000-7f0c6b1d3000 ---p 00135000 08:05 164415                     /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0
7f0c6b1d3000-7f0c6b1d9000 rw-p 00135000 08:05 164415                     /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0
7f0c6b1d9000-7f0c6b1e2000 r-xp 00000000 08:05 159680                     /usr/lib/x86_64-linux-gnu/libXrender.so.1.3.0
7f0c6b1e2000-7f0c6b3e1000 ---p 00009000 08:05 159680                     /usr/lib/x86_64-linux-gnu/libXrender.so.1.3.0
7f0c6b3e1000-7f0c6b3e2000 rw-p 00008000 08:05 159680                     /usr/lib/x86_64-linux-gnu/libXrender.so.1.3.0
7f0c6b3e2000-7f0c6b401000 r-xp 00000000 08:05 131369                     /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0
7f0c6b401000-7f0c6b600000 ---p 0001f000 08:05 131369                     /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0
7f0c6b600000-7f0c6b601000 r--p 0001e000 08:05 131369                     /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0
7f0c6b601000-7f0c6b602000 rw-p 0001f000 08:05 131369                     /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0
7f0c6b602000-7f0c6b60a000 r-xp 00000000 08:05 148869                     /usr/lib/x86_64-linux-gnu/libxcb-render.so.0.0.0
7f0c6b60a000-7f0c6b80a000 ---p 00008000 08:05 148869                     /usr/lib/x86_64-linux-gnu/libxcb-render.so.0.0.0
7f0c6b80a000-7f0c6b80b000 r--p 00008000 08:05 148869                     /usr/lib/x86_64-linux-gnu/libxcb-render.so.0.0.0
7f0c6b80b000-7f0c6b80c000 rw-p 00009000 08:05 148869                     /usr/lib/x86_64-linux-gnu/libxcb-render.so.0.0.0
7f0c6b80c000-7f0c6b80e000 r-xp 00000000 08:05 159686                     /usr/lib/x86_64-linux-gnu/libxcb-shm.so.0.0.0
7f0c6b80e000-7f0c6ba0d000 ---p 00002000 08:05 159686                     /usr/lib/x86_64-linux-gnu/libxcb-shm.so.0.0.0
7f0c6ba0d000-7f0c6ba0e000 r--p 00001000 08:05 159686                     /usr/lib/x86_64-linux-gnu/libxcb-shm.so.0.0.0
7f0c6ba0e000-7f0c6ba0f000 rw-p 00002000 08:05 159686                     /usr/lib/x86_64-linux-gnu/libxcb-shm.so.0.0.0
7f0c6ba0f000-7f0c6ba35000 r-xp 00000000 08:05 657131                     /lib/x86_64-linux-gnu/libpng12.so.0.49.0
7f0c6ba35000-7f0c6bc34000 ---p 00026000 08:05 657131                     /lib/x86_64-linux-gnu/libpng12.so.0.49.0
7f0c6bc34000-7f0c6bc35000 r--p 00025000 08:05 657131                     /lib/x86_64-linux-gnu/libpng12.so.0.49.0
7f0c6bc35000-7f0c6bc36000 rw-p 00026000 08:05 657131                     /lib/x86_64-linux-gnu/libpng12.so.0.49.0
7f0c6bc36000-7f0c6bccf000 r-xp 00000000 08:05 138479                     /usr/lib/x86_64-linux-gnu/libfreetype.so.6.8.1
7f0c6bccf000-7f0c6bece000 ---p 00099000 08:05 138479                     /usr/lib/x86_64-linux-gnu/libfreetype.so.6.8.1
7f0c6bece000-7f0c6bed4000 r--p 00098000 08:05 138479                     /usr/lib/x86_64-linux-gnu/libfreetype.so.6.8.1
7f0c6bed4000-7f0c6bed5000 rw-p 0009e000 08:05 138479                     /usr/lib/x86_64-linux-gnu/libfreetype.so.6.8.1
7f0c6bed5000-7f0c6bf0a000 r-xp 00000000 08:05 140656                     /usr/lib/x86_64-linux-gnu/libfontconfig.so.1.5.0
7f0c6bf0a000-7f0c6c10a000 ---p 00035000 08:05 140656                     /usr/lib/x86_64-linux-gnu/libfontconfig.so.1.5.0
7f0c6c10a000-7f0c6c10b000 r--p 00035000 08:05 140656                     /usr/lib/x86_64-linux-gnu/libfontconfig.so.1.5.0
7f0c6c10b000-7f0c6c10c000 rw-p 00036000 08:05 140656                     /usr/lib/x86_64-linux-gnu/libfontconfig.so.1.5.0
7f0c6c10c000-7f0c6c18c000 r-xp 00000000 08:05 135856                     /usr/lib/x86_64-linux-gnu/libpixman-1.so.0.26.0
7f0c6c18c000-7f0c6c38c000 ---p 00080000 08:05 135856                     /usr/lib/x86_64-linux-gnu/libpixman-1.so.0.26.0
7f0c6c38c000-7f0c6c392000 rw-p 00080000 08:05 135856                     /usr/lib/x86_64-linux-gnu/libpixman-1.so.0.26.0
7f0c6c392000-7f0c6c491000 r-xp 00000000 08:05 146860                     /usr/lib/x86_64-linux-gnu/libcairo.so.2.11200.14
7f0c6c491000-7f0c6c690000 ---p 000ff000 08:05 146860                     /usr/lib/x86_64-linux-gnu/libcairo.so.2.11200.14
7f0c6c690000-7f0c6c693000 r--p 000fe000 08:05 146860                     /usr/lib/x86_64-linux-gnu/libcairo.so.2.11200.14
7f0c6c693000-7f0c6c694000 rw-p 00101000 08:05 146860                     /usr/lib/x86_64-linux-gnu/libcairo.so.2.11200.14
7f0c6c694000-7f0c6c696000 rw-p 00000000 00:00 0 
7f0c6c696000-7f0c6c6c0000 r-xp 00000000 00:13 1707350                    /home/qw/.gem/ruby/1.9.1/gems/cairo-1.12.6/lib/cairo.so
7f0c6c6c0000-7f0c6c8bf000 ---p 0002a000 00:13 1707350                    /home/qw/.gem/ruby/1.9.1/gems/cairo-1.12.6/lib/cairo.so
7f0c6c8bf000-7f0c6c8c0000 r--p 00029000 00:13 1707350                    /home/qw/.gem/ruby/1.9.1/gems/cairo-1.12.6/lib/cairo.so
7f0c6c8c0000-7f0c6c8c2000 rw-p 0002a000 00:13 1707350                    /home/qw/.gem/ruby/1.9.1/gems/cairo-1.12.6/lib/cairo.so
7f0c6c8c2000-7f0c6c8c4000 r-xp 00000000 08:05 678789                     /usr/lib/ruby/1.9.1/x86_64-linux/enc/trans/transdb.so
7f0c6c8c4000-7f0c6cac4000 ---p 00002000 08:05 678789                     /usr/lib/ruby/1.9.1/x86_64-linux/enc/trans/transdb.so
7f0c6cac4000-7f0c6cac5000 r--p 00002000 08:05 678789                     /usr/lib/ruby/1.9.1/x86_64-linux/enc/trans/transdb.so
7f0c6cac5000-7f0c6cac6000 rw-p 00003000 08:05 678789                     /usr/lib/ruby/1.9.1/x86_64-linux/enc/trans/transdb.so
7f0c6cac6000-7f0c6cac8000 r-xp 00000000 08:05 678815                     /usr/lib/ruby/1.9.1/x86_64-linux/enc/encdb.so
7f0c6cac8000-7f0c6ccc7000 ---p 00002000 08:05 678815                     /usr/lib/ruby/1.9.1/x86_64-linux/enc/encdb.so
7f0c6ccc7000-7f0c6ccc8000 r--p 00001000 08:05 678815                     /usr/lib/ruby/1.9.1/x86_64-linux/enc/encdb.so
7f0c6ccc8000-7f0c6ccc9000 rw-p 00002000 08:05 678815                     /usr/lib/ruby/1.9.1/x86_64-linux/enc/encdb.so
7f0c6ccc9000-7f0c6cf40000 r--p 00000000 08:05 136400                     /usr/lib/locale/locale-archive
7f0c6cf40000-7f0c6d0e4000 r-xp 00000000 08:05 655883                     /lib/x86_64-linux-gnu/libc-2.17.so
7f0c6d0e4000-7f0c6d2e3000 ---p 001a4000 08:05 655883                     /lib/x86_64-linux-gnu/libc-2.17.so
7f0c6d2e3000-7f0c6d2e7000 r--p 001a3000 08:05 655883                     /lib/x86_64-linux-gnu/libc-2.17.so
7f0c6d2e7000-7f0c6d2e9000 rw-p 001a7000 08:05 655883                     /lib/x86_64-linux-gnu/libc-2.17.so
7f0c6d2e9000-7f0c6d2ed000 rw-p 00000000 00:00 0 
7f0c6d2ed000-7f0c6d3ea000 r-xp 00000000 08:05 655888                     /lib/x86_64-linux-gnu/libm-2.17.so
7f0c6d3ea000-7f0c6d5e9000 ---p 000fd000 08:05 655888                     /lib/x86_64-linux-gnu/libm-2.17.so
7f0c6d5e9000-7f0c6d5ea000 r--p 000fc000 08:05 655888                     /lib/x86_64-linux-gnu/libm-2.17.so
7f0c6d5ea000-7f0c6d5eb000 rw-p 000fd000 08:05 655888                     /lib/x86_64-linux-gnu/libm-2.17.so
7f0c6d5eb000-7f0c6d5f3000 r-xp 00000000 08:05 655885                     /lib/x86_64-linux-gnu/libcrypt-2.17.so
7f0c6d5f3000-7f0c6d7f2000 ---p 00008000 08:05 655885                     /lib/x86_64-linux-gnu/libcrypt-2.17.so
7f0c6d7f2000-7f0c6d7f3000 r--p 00007000 08:05 655885                     /lib/x86_64-linux-gnu/libcrypt-2.17.so
7f0c6d7f3000-7f0c6d7f4000 rw-p 00008000 08:05 655885                     /lib/x86_64-linux-gnu/libcrypt-2.17.so
7f0c6d7f4000-7f0c6d822000 rw-p 00000000 00:00 0 
7f0c6d822000-7f0c6d825000 r-xp 00000000 08:05 655886                     /lib/x86_64-linux-gnu/libdl-2.17.so
7f0c6d825000-7f0c6da24000 ---p 00003000 08:05 655886                     /lib/x86_64-linux-gnu/libdl-2.17.so
7f0c6da24000-7f0c6da25000 r--p 00002000 08:05 655886                     /lib/x86_64-linux-gnu/libdl-2.17.so
7f0c6da25000-7f0c6da26000 rw-p 00003000 08:05 655886                     /lib/x86_64-linux-gnu/libdl-2.17.so
7f0c6da26000-7f0c6da2d000 r-xp 00000000 08:05 666775                     /lib/x86_64-linux-gnu/librt-2.17.so
7f0c6da2d000-7f0c6dc2c000 ---p 00007000 08:05 666775                     /lib/x86_64-linux-gnu/librt-2.17.so
7f0c6dc2c000-7f0c6dc2d000 r--p 00006000 08:05 666775                     /lib/x86_64-linux-gnu/librt-2.17.so
7f0c6dc2d000-7f0c6dc2e000 rw-p 00007000 08:05 666775                     /lib/x86_64-linux-gnu/librt-2.17.so
7f0c6dc2e000-7f0c6dc45000 r-xp 00000000 08:05 655375                     /lib/x86_64-linux-gnu/libpthread-2.17.so
7f0c6dc45000-7f0c6de44000 ---p 00017000 08:05 655375                     /lib/x86_64-linux-gnu/libpthread-2.17.so
7f0c6de44000-7f0c6de45000 r--p 00016000 08:05 655375                     /lib/x86_64-linux-gnu/libpthread-2.17.so
7f0c6de45000-7f0c6de46000 rw-p 00017000 08:05 655375                     /lib/x86_64-linux-gnu/libpthread-2.17.so
7f0c6de46000-7f0c6de4a000 rw-p 00000000 00:00 0 
7f0c6de4a000-7f0c6e03d000 r-xp 00000000 08:05 142796                     /usr/lib/libruby-1.9.1.so.1.9.1
7f0c6e03d000-7f0c6e23c000 ---p 001f3000 08:05 142796                     /usr/lib/libruby-1.9.1.so.1.9.1
7f0c6e23c000-7f0c6e244000 rw-p 001f2000 08:05 142796                     /usr/lib/libruby-1.9.1.so.1.9.1
7f0c6e244000-7f0c6e260000 rw-p 00000000 00:00 0 
7f0c6e260000-7f0c6e281000 r-xp 00000000 08:05 655877                     /lib/x86_64-linux-gnu/ld-2.17.so
7f0c6e35e000-7f0c6e464000 rw-p 00000000 00:00 0 
7f0c6e473000-7f0c6e474000 rw-p 00000000 00:00 0 
7f0c6e474000-7f0c6e47b000 r--s 00000000 08:05 182983                     /usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache
7f0c6e47b000-7f0c6e47c000 ---p 00000000 00:00 0 
7f0c6e47c000-7f0c6e481000 rw-p 00000000 00:00 0                          [stack:23438]
7f0c6e481000-7f0c6e482000 r--p 00021000 08:05 655877                     /lib/x86_64-linux-gnu/ld-2.17.so
7f0c6e482000-7f0c6e483000 rw-p 00022000 08:05 655877                     /lib/x86_64-linux-gnu/ld-2.17.so
7f0c6e483000-7f0c6e484000 rw-p 00000000 00:00 0 
7fff2abbc000-7fff2abdd000 rw-p 00000000 00:00 0                          [stack]
7fff2abfe000-7fff2ac00000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]


[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

Regards,

test_new(RecordingSurfaceTest) fails with cairo 1.15.8

with rcalro 1.15.10, git head (looks like same with 1.15.9), test fails with cairo 1.15.8 (but some other dependencies may be related) as:

Failure: test_new(RecordingSurfaceTest)
/home/tasaka1/rpmbuild/fedora-specific/TMP/rubygem-cairo/master/GIT/rcairo/test/test_recording_surface.rb:18:in `test_new'
     15:       context.line_to(80, 100)
     16:       context.stroke
     17:     end
  => 18:     assert_equal([10.0, 20.0, 61.0, 61.0], surface.ink_extents)
     19:   end
     20: end
<[10.0, 20.0, 61.0, 61.0]> expected but was
<[14.0, 29.0, 67.0, 72.0]>

diff:
? [10.0, 20.0, 61.0, 61.0]
?   4     9     7    72   

Error when installing cairo 1.16.5 on Windows

Hello,

I'm facing the following error when running bundle install:

Fetching cairo 1.16.5
Installing cairo 1.16.5 with native extensions
avertissement : Le trousseau de clés publique est introuvable ; avez-vous exécuté « pacman-key --init » ?
erreur : mingw32 : la clé « AD351C50AE085775EB59333B5F92EFC1A47D45A1 » est inconnue
erreur : le trousseau de clés n’est pas accessible en écriture
erreur : mingw64 : la clé « AD351C50AE085775EB59333B5F92EFC1A47D45A1 » est inconnue
erreur : le trousseau de clés n’est pas accessible en écriture
erreur : msys : la clé « AD351C50AE085775EB59333B5F92EFC1A47D45A1 » est inconnue
erreur : le trousseau de clés n’est pas accessible en écriture
erreur : la base de données « mingw32 » n’est pas valide (base de données non valide ou corrompue (signature PGP))
erreur : la base de données « mingw64 » n’est pas valide (base de données non valide ou corrompue (signature PGP))
erreur : la base de données « msys » n’est pas valide (base de données non valide ou corrompue (signature PGP))
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/cairo-1.16.5/ext/cairo
C:/Ruby27-x64/bin/ruby.exe -I C:/Ruby27-x64/lib/ruby/2.7.0 -r
./siteconf20200617-14044-10i7kre.rb extconf.rb
checking for GCC... yes
checking for Homebrew... no
checking for cairo version (>= 1.2.0)... no
installing 'mingw-w64-x86_64-cairo' native package... failed
Failed to run 'pacman.exe -S --noconfirm mingw-w64-x86_64-cairo'.
*** 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=C:/Ruby27-x64/bin/$(RUBY_BASE_NAME)
        --with-pkg-config
        --without-pkg-config
        --with-override-variables
        --without-override-variables

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

C:/Ruby27-x64/lib/ruby/gems/2.7.0/extensions/x64-mingw32/2.7.0/cairo-1.16.5/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/cairo-1.16.5 for inspection.
Results logged to
C:/Ruby27-x64/lib/ruby/gems/2.7.0/extensions/x64-mingw32/2.7.0/cairo-1.16.5/gem_make.out

An error occurred while installing cairo (1.16.5), and Bundler cannot continue.
Make sure that `gem install cairo -v '1.16.5' --source 'https://rubygems.org/'`
succeeds before bundling.

In Gemfile:
  poppler was resolved to 3.4.3, which depends on
    cairo-gobject was resolved to 3.4.3, which depends on
      cairo

And here is the content of C:/Ruby27-x64/lib/ruby/gems/2.7.0/extensions/x64-mingw32/2.7.0/cairo-1.16.5/mkmf.log :

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

"x86_64-w64-mingw32-gcc -o conftest.exe -IC:/Ruby27-x64/include/ruby-2.7.0/x64-mingw32 -IC:/Ruby27-x64/include/ruby-2.7.0/ruby/backward -IC:/Ruby27-x64/include/ruby-2.7.0 -I. -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0600 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64  -O3 -fno-fast-math -fstack-protector-strong conftest.c  -L. -LC:/Ruby27-x64/lib -L. -pipe -s -fstack-protector-strong     -lx64-msvcrt-ruby270  -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi  "
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <winsock2.h>
4: #include <windows.h>
5: int main(int argc, char **argv)
6: {
7:   return !!argv[argc];
8: }
/* end */

"x86_64-w64-mingw32-gcc -IC:/Ruby27-x64/include/ruby-2.7.0/x64-mingw32 -IC:/Ruby27-x64/include/ruby-2.7.0/ruby/backward -IC:/Ruby27-x64/include/ruby-2.7.0 -I. -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0600 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64  -O3 -fno-fast-math -fstack-protector-strong   -c conftest.c"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <winsock2.h>
4: #include <windows.h>
5: /*top*/
6: #ifndef __GNUC__
7: # error
8: |:/ === __GNUC__ undefined === /:|
9: #endif
/* end */

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

checking for Homebrew... -------------------- no

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

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

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

"pacman.exe -S --noconfirm mingw-w64-x86_64-cairo"
avertissement : Le trousseau de clés publique est introuvable ; avez-vous exécuté « pacman-key --init » ?
erreur : mingw32 : la clé « AD351C50AE085775EB59333B5F92EFC1A47D45A1 » est inconnue
erreur : le trousseau de clés n’est pas accessible en écriture
erreur : mingw64 : la clé « AD351C50AE085775EB59333B5F92EFC1A47D45A1 » est inconnue
erreur : le trousseau de clés n’est pas accessible en écriture
erreur : msys : la clé « AD351C50AE085775EB59333B5F92EFC1A47D45A1 » est inconnue
erreur : le trousseau de clés n’est pas accessible en écriture
erreur : la base de données « mingw32 » n’est pas valide (base de données non valide ou corrompue (signature PGP))
erreur : la base de données « mingw64 » n’est pas valide (base de données non valide ou corrompue (signature PGP))
erreur : la base de données « msys » n’est pas valide (base de données non valide ou corrompue (signature PGP))
installing 'mingw-w64-x86_64-cairo' native package... failed
Failed to run 'pacman.exe -S --noconfirm mingw-w64-x86_64-cairo'.
--------------------


I already ran pacman-key --init as suggested but it didn't solve the issue.

If you have any idea, it would help a lot !

Thanks :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.