我使用的是雪豹10.6.4,英特尔架构。
我已经安装了rvm和ruby 1.9.2:
$ rvm list
rvm rubies
=> ruby-1.9.2-p0 [ x86_64 ]我是这样安装oniguruma5的:
port install oniguruma5然后,按照传统的智慧,我尝试这样安装oniguruma gem:
sudo gem install oniguruma -- --with-opt-dir=/opt/local但是我得到了一个编译错误:
Julie:lender bhaupt$ sudo gem install oniguruma -- --with-opt-dir=/opt/local
Building native extensions. This could take a while...
ERROR: Error installing oniguruma:
ERROR: Failed to build gem native extension.
/Users/bhaupt/.rvm/rubies/ruby-1.9.2-p0/bin/ruby extconf.rb --with-opt-dir=/opt/local
checking for main() in -lonig... yes
creating Makefile
make
gcc -I. -I/Users/bhaupt/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/x86_64-darwin10.4.0 -I/Users/bhaupt/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/ruby/backward -I/Users/bhaupt/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -Wall -o oregexp.o -c oregexp.c
oregexp.c: In function ‘name_callback’:
oregexp.c:111: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
oregexp.c:111: warning: pointer targets in passing argument 1 of ‘rb_intern2’ differ in signedness
oregexp.c:111: warning: pointer targets in passing argument 1 of ‘rb_intern’ differ in signedness
oregexp.c: In function ‘oregexp_initialize’:
oregexp.c:123: error: ‘struct RString’ has no member named ‘ptr’
oregexp.c:124: error: ‘struct RString’ has no member named ‘len’
oregexp.c:138: warning: pointer targets in passing argument 1 of ‘onig_error_code_to_str’ differ in signedness
oregexp.c: In function ‘oregexp_make_match_data’:
oregexp.c:176: warning: passing argument 2 of ‘onig_foreach_name’ from incompatible pointer type
oregexp.c: In function ‘oregexp_match’:
oregexp.c:211: warning: statement with no effect
oregexp.c:215: error: ‘struct RString’ has no member named ‘ptr’
oregexp.c:216: error: ‘struct RString’ has no member named ‘len’
oregexp.c:244: warning: pointer targets in passing argument 1 of ‘onig_error_code_to_str’ differ in signedness
oregexp.c: In function ‘oregexp_append_replacement’:
oregexp.c:267: error: ‘struct RString’ has no member named ‘len’
oregexp.c:268: error: ‘struct RString’ has no member named ‘ptr’
oregexp.c:277: error: ‘struct RString’ has no member named ‘ptr’
oregexp.c:278: error: ‘struct RString’ has no member named ‘len’
oregexp.c:286: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘OnigCodePoint’
oregexp.c:293: warning: pointer targets in passing argument 2 of ‘rb_str_buf_cat’ differ in signedness
oregexp.c:297: warning: pointer targets in passing argument 2 of ‘rb_str_buf_cat’ differ in signedness
oregexp.c:328: warning: pointer targets in passing argument 2 of ‘rb_str_buf_cat’ differ in signedness
oregexp.c:332: warning: pointer targets in passing argument 2 of ‘rb_str_buf_cat’ differ in signedness
oregexp.c:336: warning: pointer targets in passing argument 2 of ‘rb_str_buf_cat’ differ in signedness
oregexp.c:341: warning: pointer targets in passing argument 2 of ‘rb_str_buf_cat’ differ in signedness
oregexp.c:350: warning: pointer targets in passing argument 2 of ‘rb_str_buf_cat’ differ in signedness
oregexp.c:371: warning: pointer targets in passing argument 2 of ‘rb_str_buf_cat’ differ in signedness
oregexp.c:379: warning: pointer targets in passing argument 2 of ‘rb_str_buf_cat’ differ in signedness
oregexp.c:385: warning: pointer targets in passing argument 2 of ‘rb_str_buf_cat’ differ in signedness
oregexp.c:392: warning: pointer targets in passing argument 2 of ‘rb_str_buf_cat’ differ in signedness
oregexp.c: In function ‘str_mod_check’:
oregexp.c:405: error: ‘struct RString’ has no member named ‘ptr’
oregexp.c:405: error: ‘struct RString’ has no member named ‘len’
oregexp.c: In function ‘oregexp_gsub’:
oregexp.c:444: error: ‘struct RString’ has no member named ‘ptr’
oregexp.c:445: error: ‘struct RString’ has no member named ‘len’
oregexp.c:462: warning: pointer targets in passing argument 2 of ‘rb_str_buf_cat’ differ in signedness
oregexp.c:484: warning: pointer targets in passing argument 2 of ‘rb_str_buf_cat’ differ in signedness
oregexp.c:491: warning: pointer targets in passing argument 2 of ‘rb_str_buf_cat’ differ in signedness
oregexp.c: In function ‘oregexp_safe_gsub’:
oregexp.c:527: warning: passing argument 3 of ‘rb_ensure’ from incompatible pointer type
oregexp.c: In function ‘oregexp_scan’:
oregexp.c:614: error: ‘struct RString’ has no member named ‘ptr’
oregexp.c:615: error: ‘struct RString’ has no member named ‘len’
oregexp.c: In function ‘oregexp_m_scan’:
oregexp.c:671: warning: passing argument 3 of ‘rb_ensure’ from incompatible pointer type
make: *** [oregexp.o] Error 1
Gem files will remain installed in /Users/bhaupt/.rvm/gems/ruby-1.9.2-p0/gems/oniguruma-1.1.0 for inspection.
Results logged to /Users/bhaupt/.rvm/gems/ruby-1.9.2-p0/gems/oniguruma-1.1.0/ext/gem_make.out想法?
我已确认/opt/local/include包含oniggnu.h、onigposix.h和oniguruma.h
发布于 2011-10-26 22:21:36
我的解决方案是最简单的(如果你是mac用户):
brew install oniguruma发布于 2011-01-07 13:26:01
我是Dizan,oniguruma和紫外线的主要开发者,很抱歉花了这么长时间来回答这个问题!
正如Jo Liss所说,oniguruma绑定的目的是提供对一些高级正则表达式功能的访问,这些功能现在是Ruby1.9的标准功能。因此,原则上,在1.9上不需要这样做。
编译1.9的oniguruma绑定,它是完全未经测试的,所以您或多或少可以使用自己的绑定,但是,原则上,在1.9中使用标准的regexp可以很容易地修补to和textpow。当然,这在我的待办事项列表中,但不幸的是,现在我几乎没有时间做这些事情。另一方面,一些人已经表达了对分叉或接管项目的兴趣,这将使事情变得更快。我会让你随时关注这件事。
最后一种选择是自己做补丁,这并不像听起来那么可怕:据我所知,你所要做的就是用标准的Regexp#new替换所有对ORegexp#new的调用,如果你决定这样做,我很乐意提供一个辅助,以便在下一个版本的紫外线/文本电源中包含你的补丁。
发布于 2010-12-31 09:37:00
(当我尝试在Debian上安装带有Ruby1.9的oniguruma-ruby时,我遇到了同样的问题。)
所以,http://oniguruma.rubyforge.org/说:
这个库提供了到Oniguruma的绑定,这是Ruby1.9的标准正则表达式库。它允许Ruby 1.8的用户访问扩展功能,而无需重新编译或升级Ruby。
听起来根本不像oniguruma-ruby可以安装在1.9上。
问迪赞(我已经给他发了一个这个问题的指针):但是即使Oniguruma是ruby1.9的标准,如果我想运行一个有require 'origuruma'的模块,我仍然需要origuruma- Ruby,对吧?因此,让它与Ruby 1.9兼容仍然是有意义的,因为没有其他方法可以在Ruby 1.9上运行Textpow或am -或者我错过了什么?
https://stackoverflow.com/questions/4103355
复制相似问题