Ruby cairo gem 无法在 Mac OS X Yosemite 上安装

Posted

技术标签:

【中文标题】Ruby cairo gem 无法在 Mac OS X Yosemite 上安装【英文标题】:Ruby cairo gem failing to install on Mac OS X Yosemite 【发布时间】:2014-11-10 19:49:16 【问题描述】:

我完全坚持这一点。在依赖于 cairo 的 Rails 应用程序上工作 ruby​​。从 Mac OS X Mavericks 升级到 Yosemite 并进行捆绑安装后,它无法安装 cairo gem。我尝试过使用 4.2(苹果的捆绑补丁版本)与 4.8 和 4.9 之间的 gcc 版本,但没有运气。欢迎任何想法...

sudo gem install cairo 密码:

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

制作失败,退出代码 2

Gem 文件将继续安装在 /Users/Ben/.rvm/rubies/ruby-1.9.3-p550/lib/ruby/gems/1.9.1/gems/cairo-1.12.9 以供检查。 结果记录到 /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

【问题讨论】:

在这里讨论它github.com/luite/hfsevents/issues/9#issuecomment-62440670 【参考方案1】:

我可以通过安装 macports 解决这个问题

https://www.macports.org/install.php

然后直接安装cairo http://cairographics.org/download/

sudo port install cairo

然后 gem install cairo 工作。

【讨论】:

这对我不起作用,只是用 macport 安装 cairo。我现在在 ruby​​ 2.1 和 rails 3.2 上也有不同的编译问题.. 编译 rb_cairo_surface.c 在 /usr/include/dispatch/dispatch.h:51:0 包含的文件中,来自 /System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:15 ,

以上是关于Ruby cairo gem 无法在 Mac OS X Yosemite 上安装的主要内容,如果未能解决你的问题,请参考以下文章

Ruby gem rmagick 不会安装在 Mac OS X 上

Ruby:mysql2-Gem 不工作(Mac OS X Snow Leopard,Ruby 1.9.2)

无法在 Mac 上安装 Ruby gem libxslt-ruby,因为它找不到 libxml2

Mac os 10.11 更新ruby

Mac中gem安装与移除

gem install rmagick -v 2.13.1 错误无法在 Mac OS 10.9.1 上构建 gem 本机扩展