Bug 18623

Summary: Patch for Ruby gem cairo-1.8.0 to build on Mac OS X Leopard
Product: cairo Reporter: sebastian <sebastian.gassner>
Component: generalAssignee: Carl Worth <cworth>
Status: RESOLVED NOTOURBUG QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium CC: martinharrigan
Version: 1.9.1Keywords: patch
Hardware: x86-64 (AMD64)   
OS: Mac OS X (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Patch fixing extconf.rb on Mac OS X Leopard

Description sebastian 2008-11-19 06:15:06 UTC
Created attachment 20443 [details] [review]
Patch fixing extconf.rb on Mac OS X Leopard

Overview
--------

Building the Ruby gem for cairo fails on Mac OS X Leopard because the '-o' option in line 129 of extconf.rb is lacking a blank after the 'o'

    126       if PKGConfig.msvc?
    127         output_option = "-Fo"
    128       else
    129         output_option = "-o"
    130       end

resulting in the compiler complaining about the '-o' flag (full trace below):
  
  :
  /usr/bin/../libexec/gcc/darwin/ppc/as: Flag option -o has already been seen!
  /usr/bin/../libexec/gcc/darwin/i386/as: Flag option -o has already been seen!
  :


Steps to reproduce
------------------

    sudo gem install cairo


Solution
--------

Apply the patch attached to this post, build the gem:

    [dowload the gem cairo-1.8.0]
    cd cairo-1.8.0
    patch -p0 < 20081118-fix_rcairo_build_on_mac_leopard.patch
    ruby extconf.rb
    make
    make install


Stack Trace
-----------

sebastian@sebastian:~/Desktop %> sudo gem install cairo
Bulk updating Gem source index for: http://gems.rubyforge.org
Building native extensions.  This could take a while...
ERROR:  Error installing cairo:
	ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb install cairo
checking for GCC... yes
checking for cairo version (>= 1.2.0)... yes
checking for HAVE_RUBY_ST_H in ruby.h... no
checking for ruby/st.h... no
checking for rb_errinfo() in ruby.h... no
checking for enum ruby_value_type in ruby.h... no
checking Win32 OS... no
checking for CAIRO_HAS_QUARTZ_SURFACE in cairo.h... yes
checking for RubyCocoa... yes
creating Makefile

make
Makefile:175: warning: overriding commands for target `/Library/Ruby/Gems/1.8/gems/cairo-1.8.0/src/lib'
Makefile:169: warning: ignoring old commands for target `/Library/Ruby/Gems/1.8/gems/cairo-1.8.0/src/lib'
gcc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0 -I. -DHAVE_RUBY_COCOA -DRB_CAIRO_COMPILATION  -fno-common -arch ppc -arch i386 -Os -pipe -fno-common -Wall -DPNG_NO_MMX_CODE -DXTHREADS -I/opt/local/include/cairo -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include -I/sw/include/libpng12 -I/usr/X11/include  -c /Library/Ruby/Gems/1.8/gems/cairo-1.8.0/src/rb_cairo.c -osrc/rb_cairo.o
/usr/bin/../libexec/gcc/darwin/ppc/as: Flag option -o has already been seen!
/usr/bin/../libexec/gcc/darwin/i386/as: Flag option -o has already been seen!
gcc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0 -I. -DHAVE_RUBY_COCOA -DRB_CAIRO_COMPILATION  -fno-common -arch ppc -arch i386 -Os -pipe -fno-common -Wall -DPNG_NO_MMX_CODE -DXTHREADS -I/opt/local/include/cairo -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include -I/sw/include/libpng12 -I/usr/X11/include  -c /Library/Ruby/Gems/1.8/gems/cairo-1.8.0/src/rb_cairo_constants.c -osrc/rb_cairo_constants.o
/usr/bin/../libexec/gcc/darwin/i386/as: Flag option -o has already been seen!
/usr/bin/../libexec/gcc/darwin/ppc/as: Flag option -o has already been seen!
gcc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0 -I. -DHAVE_RUBY_COCOA -DRB_CAIRO_COMPILATION  -fno-common -arch ppc -arch i386 -Os -pipe -fno-common -Wall -DPNG_NO_MMX_CODE -DXTHREADS -I/opt/local/include/cairo -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include -I/sw/include/libpng12 -I/usr/X11/include  -c /Library/Ruby/Gems/1.8/gems/cairo-1.8.0/src/rb_cairo_context.c -osrc/rb_cairo_context.o
/usr/bin/../libexec/gcc/darwin/ppc/as: Flag option -o has already been seen!
/usr/bin/../libexec/gcc/darwin/i386/as: Flag option -o has already been seen!
gcc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0 -I. -DHAVE_RUBY_COCOA -DRB_CAIRO_COMPILATION  -fno-common -arch ppc -arch i386 -Os -pipe -fno-common -Wall -DPNG_NO_MMX_CODE -DXTHREADS -I/opt/local/include/cairo -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include -I/sw/include/libpng12 -I/usr/X11/include  -c /Library/Ruby/Gems/1.8/gems/cairo-1.8.0/src/rb_cairo_exception.c -osrc/rb_cairo_exception.o
/usr/bin/../libexec/gcc/darwin/ppc/as: Flag option -o has already been seen!
/usr/bin/../libexec/gcc/darwin/i386/as: Flag option -o has already been seen!
gcc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0 -I. -DHAVE_RUBY_COCOA -DRB_CAIRO_COMPILATION  -fno-common -arch ppc -arch i386 -Os -pipe -fno-common -Wall -DPNG_NO_MMX_CODE -DXTHREADS -I/opt/local/include/cairo -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include -I/sw/include/libpng12 -I/usr/X11/include  -c /Library/Ruby/Gems/1.8/gems/cairo-1.8.0/src/rb_cairo_font_extents.c -osrc/rb_cairo_font_extents.o
/usr/bin/../libexec/gcc/darwin/i386/as: Flag option -o has already been seen!
/usr/bin/../libexec/gcc/darwin/ppc/as: Flag option -o has already been seen!
gcc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0 -I. -DHAVE_RUBY_COCOA -DRB_CAIRO_COMPILATION  -fno-common -arch ppc -arch i386 -Os -pipe -fno-common -Wall -DPNG_NO_MMX_CODE -DXTHREADS -I/opt/local/include/cairo -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include -I/sw/include/libpng12 -I/usr/X11/include  -c /Library/Ruby/Gems/1.8/gems/cairo-1.8.0/src/rb_cairo_font_face.c -osrc/rb_cairo_font_face.o
/usr/bin/../libexec/gcc/darwin/ppc/as: Flag option -o has already been seen!
/usr/bin/../libexec/gcc/darwin/i386/as: Flag option -o has already been seen!
gcc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0 -I. -DHAVE_RUBY_COCOA -DRB_CAIRO_COMPILATION  -fno-common -arch ppc -arch i386 -Os -pipe -fno-common -Wall -DPNG_NO_MMX_CODE -DXTHREADS -I/opt/local/include/cairo -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include -I/sw/include/libpng12 -I/usr/X11/include  -c /Library/Ruby/Gems/1.8/gems/cairo-1.8.0/src/rb_cairo_font_options.c -osrc/rb_cairo_font_options.o
/usr/bin/../libexec/gcc/darwin/i386/as: Flag option -o has already been seen!
/usr/bin/../libexec/gcc/darwin/ppc/as: Flag option -o has already been seen!
gcc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0 -I. -DHAVE_RUBY_COCOA -DRB_CAIRO_COMPILATION  -fno-common -arch ppc -arch i386 -Os -pipe -fno-common -Wall -DPNG_NO_MMX_CODE -DXTHREADS -I/opt/local/include/cairo -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include -I/sw/include/libpng12 -I/usr/X11/include  -c /Library/Ruby/Gems/1.8/gems/cairo-1.8.0/src/rb_cairo_glyph.c -osrc/rb_cairo_glyph.o
/usr/bin/../libexec/gcc/darwin/i386/as: Flag option -o has already been seen!
/usr/bin/../libexec/gcc/darwin/ppc/as: Flag option -o has already been seen!
gcc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0 -I. -DHAVE_RUBY_COCOA -DRB_CAIRO_COMPILATION  -fno-common -arch ppc -arch i386 -Os -pipe -fno-common -Wall -DPNG_NO_MMX_CODE -DXTHREADS -I/opt/local/include/cairo -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include -I/sw/include/libpng12 -I/usr/X11/include  -c /Library/Ruby/Gems/1.8/gems/cairo-1.8.0/src/rb_cairo_matrix.c -osrc/rb_cairo_matrix.o
/usr/bin/../libexec/gcc/darwin/i386/as: Flag option -o has already been seen!
/usr/bin/../libexec/gcc/darwin/ppc/as: Flag option -o has already been seen!
gcc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0 -I. -DHAVE_RUBY_COCOA -DRB_CAIRO_COMPILATION  -fno-common -arch ppc -arch i386 -Os -pipe -fno-common -Wall -DPNG_NO_MMX_CODE -DXTHREADS -I/opt/local/include/cairo -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include -I/sw/include/libpng12 -I/usr/X11/include  -c /Library/Ruby/Gems/1.8/gems/cairo-1.8.0/src/rb_cairo_path.c -osrc/rb_cairo_path.o
/usr/bin/../libexec/gcc/darwin/i386/as: Flag option -o has already been seen!
/usr/bin/../libexec/gcc/darwin/ppc/as: Flag option -o has already been seen!
gcc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0 -I. -DHAVE_RUBY_COCOA -DRB_CAIRO_COMPILATION  -fno-common -arch ppc -arch i386 -Os -pipe -fno-common -Wall -DPNG_NO_MMX_CODE -DXTHREADS -I/opt/local/include/cairo -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include -I/sw/include/libpng12 -I/usr/X11/include  -c /Library/Ruby/Gems/1.8/gems/cairo-1.8.0/src/rb_cairo_pattern.c -osrc/rb_cairo_pattern.o
/usr/bin/../libexec/gcc/darwin/ppc/as: Flag option -o has already been seen!
/usr/bin/../libexec/gcc/darwin/i386/as: Flag option -o has already been seen!
gcc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0 -I. -DHAVE_RUBY_COCOA -DRB_CAIRO_COMPILATION  -fno-common -arch ppc -arch i386 -Os -pipe -fno-common -Wall -DPNG_NO_MMX_CODE -DXTHREADS -I/opt/local/include/cairo -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include -I/sw/include/libpng12 -I/usr/X11/include  -c /Library/Ruby/Gems/1.8/gems/cairo-1.8.0/src/rb_cairo_private.c -osrc/rb_cairo_private.o
/usr/bin/../libexec/gcc/darwin/i386/as: Flag option -o has already been seen!
/usr/bin/../libexec/gcc/darwin/ppc/as: Flag option -o has already been seen!
gcc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0 -I. -DHAVE_RUBY_COCOA -DRB_CAIRO_COMPILATION  -fno-common -arch ppc -arch i386 -Os -pipe -fno-common -Wall -DPNG_NO_MMX_CODE -DXTHREADS -I/opt/local/include/cairo -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include -I/sw/include/libpng12 -I/usr/X11/include  -c /Library/Ruby/Gems/1.8/gems/cairo-1.8.0/src/rb_cairo_scaled_font.c -osrc/rb_cairo_scaled_font.o
/usr/bin/../libexec/gcc/darwin/i386/as: Flag option -o has already been seen!
/usr/bin/../libexec/gcc/darwin/ppc/as: Flag option -o has already been seen!
gcc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0 -I. -DHAVE_RUBY_COCOA -DRB_CAIRO_COMPILATION  -fno-common -arch ppc -arch i386 -Os -pipe -fno-common -Wall -DPNG_NO_MMX_CODE -DXTHREADS -I/opt/local/include/cairo -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include -I/sw/include/libpng12 -I/usr/X11/include  -c /Library/Ruby/Gems/1.8/gems/cairo-1.8.0/src/rb_cairo_surface.c -osrc/rb_cairo_surface.o
/usr/bin/../libexec/gcc/darwin/ppc/as: Flag option -o has already been seen!
/usr/bin/../libexec/gcc/darwin/i386/as: Flag option -o has already been seen!
/Library/Ruby/Gems/1.8/gems/cairo-1.8.0/src/rb_cairo_surface.c: In function 'cr_quartz_image_surface_initialize':
/Library/Ruby/Gems/1.8/gems/cairo-1.8.0/src/rb_cairo_surface.c:1156: warning: implicit declaration of function 'cairo_quartz_image_surface_create'
/Library/Ruby/Gems/1.8/gems/cairo-1.8.0/src/rb_cairo_surface.c:1156: warning: assignment makes pointer from integer without a cast
/Library/Ruby/Gems/1.8/gems/cairo-1.8.0/src/rb_cairo_surface.c: In function 'cr_quartz_image_surface_get_image':
/Library/Ruby/Gems/1.8/gems/cairo-1.8.0/src/rb_cairo_surface.c:1169: warning: implicit declaration of function 'cairo_quartz_image_surface_get_image'
/Library/Ruby/Gems/1.8/gems/cairo-1.8.0/src/rb_cairo_surface.c:1169: warning: assignment makes pointer from integer without a cast
/Library/Ruby/Gems/1.8/gems/cairo-1.8.0/src/rb_cairo_surface.c: In function 'cr_quartz_image_surface_initialize':
/Library/Ruby/Gems/1.8/gems/cairo-1.8.0/src/rb_cairo_surface.c:1156: warning: implicit declaration of function 'cairo_quartz_image_surface_create'
/Library/Ruby/Gems/1.8/gems/cairo-1.8.0/src/rb_cairo_surface.c:1156: warning: assignment makes pointer from integer without a cast
/Library/Ruby/Gems/1.8/gems/cairo-1.8.0/src/rb_cairo_surface.c: In function 'cr_quartz_image_surface_get_image':
/Library/Ruby/Gems/1.8/gems/cairo-1.8.0/src/rb_cairo_surface.c:1169: warning: implicit declaration of function 'cairo_quartz_image_surface_get_image'
/Library/Ruby/Gems/1.8/gems/cairo-1.8.0/src/rb_cairo_surface.c:1169: warning: assignment makes pointer from integer without a cast
gcc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0 -I. -DHAVE_RUBY_COCOA -DRB_CAIRO_COMPILATION  -fno-common -arch ppc -arch i386 -Os -pipe -fno-common -Wall -DPNG_NO_MMX_CODE -DXTHREADS -I/opt/local/include/cairo -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include -I/sw/include/libpng12 -I/usr/X11/include  -c /Library/Ruby/Gems/1.8/gems/cairo-1.8.0/src/rb_cairo_text_cluster.c -osrc/rb_cairo_text_cluster.o
/usr/bin/../libexec/gcc/darwin/ppc/as: Flag option -o has already been seen!
/usr/bin/../libexec/gcc/darwin/i386/as: Flag option -o has already been seen!
gcc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0 -I. -DHAVE_RUBY_COCOA -DRB_CAIRO_COMPILATION  -fno-common -arch ppc -arch i386 -Os -pipe -fno-common -Wall -DPNG_NO_MMX_CODE -DXTHREADS -I/opt/local/include/cairo -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include -I/sw/include/libpng12 -I/usr/X11/include  -c /Library/Ruby/Gems/1.8/gems/cairo-1.8.0/src/rb_cairo_text_extents.c -osrc/rb_cairo_text_extents.o
/usr/bin/../libexec/gcc/darwin/i386/as: Flag option -o has already been seen!
/usr/bin/../libexec/gcc/darwin/ppc/as: Flag option -o has already been seen!
cc -arch ppc -arch i386 -pipe -bundle -undefined dynamic_lookup -o src/cairo.bundle src/rb_cairo.o src/rb_cairo_constants.o src/rb_cairo_context.o src/rb_cairo_exception.o src/rb_cairo_font_extents.o src/rb_cairo_font_face.o src/rb_cairo_font_options.o src/rb_cairo_glyph.o src/rb_cairo_matrix.o src/rb_cairo_path.o src/rb_cairo_pattern.o src/rb_cairo_private.o src/rb_cairo_scaled_font.o src/rb_cairo_surface.o src/rb_cairo_text_cluster.o src/rb_cairo_text_extents.o -L"." -L"/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib" -L. -arch ppc -arch i386 -L/opt/local/lib  -Wl,-framework,RubyCocoa   -lruby  -lcairo -lpthread -ldl -lm  
powerpc-apple-darwin9-gcc-4.0.1: src/rb_cairo.o: No such file or directory
powerpc-apple-darwin9-gcc-4.0.1: src/rb_cairo_constants.o: No such file or directory
powerpc-apple-darwin9-gcc-4.0.1: src/rb_cairo_context.o: No such file or directory
powerpc-apple-darwin9-gcc-4.0.1: src/rb_cairo_exception.o: No such file or directory
powerpc-apple-darwin9-gcc-4.0.1: src/rb_cairo_font_extents.o: No such file or directory
powerpc-apple-darwin9-gcc-4.0.1: src/rb_cairo_font_face.o: No such file or directory
powerpc-apple-darwin9-gcc-4.0.1: src/rb_cairo_font_options.o: No such file or directory
powerpc-apple-darwin9-gcc-4.0.1: src/rb_cairo_glyph.o: No such file or directory
powerpc-apple-darwin9-gcc-4.0.1: src/rb_cairo_matrix.o: No such file or directory
powerpc-apple-darwin9-gcc-4.0.1: src/rb_cairo_path.o: No such file or directory
powerpc-apple-darwin9-gcc-4.0.1: src/rb_cairo_pattern.o: No such file or directory
powerpc-apple-darwin9-gcc-4.0.1: src/rb_cairo_private.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: powerpc-apple-darwin9-gcc-4.0.1: src/rb_cairo.o: No such file or directorysrc/rb_cairo_scaled_font.o: No such file or directory

i686-apple-darwin9-gcc-4.0.1: powerpc-apple-darwin9-gcc-4.0.1: src/rb_cairo_surface.o: No such file or directory
src/rb_cairo_constants.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: powerpc-apple-darwin9-gcc-4.0.1: src/rb_cairo_context.o: No such file or directory
src/rb_cairo_text_cluster.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: src/rb_cairo_exception.o: No such file or directorypowerpc-apple-darwin9-gcc-4.0.1: src/rb_cairo_text_extents.o: No such file or directory

i686-apple-darwin9-gcc-4.0.1: src/rb_cairo_font_extents.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: src/rb_cairo_font_face.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: src/rb_cairo_font_options.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: src/rb_cairo_glyph.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: src/rb_cairo_matrix.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: src/rb_cairo_path.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: src/rb_cairo_pattern.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: src/rb_cairo_private.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: src/rb_cairo_scaled_font.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: src/rb_cairo_surface.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: src/rb_cairo_text_cluster.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: src/rb_cairo_text_extents.o: No such file or directory
lipo: can't figure out the architecture type of: /var/tmp//ccZJneD1.out
make: *** [src/cairo.bundle] Error 1


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/cairo-1.8.0 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/cairo-1.8.0/gem_make.out
Comment 1 mcveat 2010-03-03 00:39:34 UTC
Solution works for me.
Comment 2 Uli Schlachter 2012-02-10 12:42:57 UTC
Google says that rcairo can be found at github.com/rcairo/rcairo. At least it's not part of cairo.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.