1

I'm on Snow Leopard 10.6.4, Intel architecture.

I've got rvm and ruby 1.9.2 installed:

$ rvm list
rvm rubies

=> ruby-1.9.2-p0 [ x86_64 ]

I installed oniguruma5 like this:

port install oniguruma5

Then, as per Conventional Wisdom, I tried to install the oniguruma gem like this:

sudo gem install oniguruma -- --with-opt-dir=/opt/local

But I get a compile error:

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

Ideas?

I have confirmed that /opt/local/include contains oniggnu.h, onigposix.h, and oniguruma.h

vonconrad
  • 25,227
  • 7
  • 68
  • 69
Bob Haupt
  • 11
  • 2
  • Hey Bob, care to indent the error message so it gets rendered as preformatted text? – Jo Liss Dec 31 '10 at 01:23
  • 1
    "`sudo gem install oniguruma`". You're using RVM: See [DO NOT use sudo...](http://rvm.beginrescueend.com/rubies/rubygems/). – the Tin Man Jan 07 '11 at 07:39

5 Answers5

4

My solution is the simplest (if you are a mac user):

brew install oniguruma
makaroni4
  • 2,281
  • 1
  • 18
  • 26
2

I am Dizan, oniguruma and ultraviolet's main developer, sorry for taking so long to answer this!

As Jo Liss comments, the purpose of the oniguruma bindings was to provide access to some advanced regular expression functionality that is now standard with Ruby 1.9. So, in principle, there is no need for this on 1.9.

Compiling the oniguruma bindings for 1.9, it is completely untested so you're more or less in your own, but, in principle, it would be easy to patch both ultraviolet and textpow to use standard regexps in 1.9. Of course that's in my todo list but, unfortunately, right now I barely have the time for that. On the other hand, some people has expressed interest in forking or taking over the project(s) which would make things faster. I will keep you posted on this.

One last alternative would be to do the patch yourself which is not as daunting as it sounds: as far as I remember, all you have to do is to replace all calls to ORegexp#new by the standard Regexp#new, if you decide to go that way I would be happy to provide assitance an to include your patch in the next release of ultraviolet/textpow.

Nifle
  • 11,745
  • 10
  • 75
  • 100
Dizan
  • 21
  • 3
1

(I'm having the same problem when I try install oniguruma-ruby with Ruby 1.9 on Debian.)

So, http://oniguruma.rubyforge.org/ says:

This library provides bindings to Oniguruma, a regular expression library which is standard with Ruby 1.9. It allows users of Ruby 1.8 to access the extended functionality without the need to recompile or to upgrade Ruby.

It doesn't sound like oniguruma-ruby can be installed on 1.9 at all.

Question to Dizan (to whom I've sent a pointer to this question): But even if Oniguruma is standard in Ruby 1.9, if I want to run a module that has require 'origuruma', I'll still need origuruma-ruby, right? So having it compatible with Ruby 1.9 would still kindof make sense, as there is no other way to get, say, Textpow or Ultraviolet running on Ruby 1.9 -- or am I missing something?

Jo Liss
  • 30,333
  • 19
  • 121
  • 170
  • 1
    This is correct: OP is attempting to install Oniguruma which is already contained within Ruby 1.9. You don't need to re-install it. – Ryan Bigg Dec 31 '10 at 01:40
  • Thanks for clarifying! By "contained", I assume you mean that Ruby 1.9 matches regexes using the Oniguruma library, right? But, what are modules that `require 'oniguruma'` supposed to do? I guess Ruby 1.9 might render using the oniguruma bindings functionally unnecessary (because it has all the Oniguruma features [like named groups?] built-in), but if you have code that needs to run against 1.8 and 1.9, you're in a bit of trouble, no? – Jo Liss Dec 31 '10 at 17:02
0

Oniguruma use Ultraviolet, Ultraviolet uses, Textpow, and you will use Tylenol to get all of these dependencies lined up.

Once you get all of the dependencies lined up make sure you include the library for ultraviolet with config.gem 'oniguruma', :lib => 'ultraviolet'

I will double check that library later, I'm on another computer but not including it was a problem for me.

thenengah
  • 42,557
  • 33
  • 113
  • 157
  • If I revert to ruby 1.8.7 by doing this: – Bob Haupt Nov 05 '10 at 04:09
  • rvm system and then install the oniguruma gem: sudo gem install oniguruma -- --with-opt-dir=/opt/local the compile succeeds. So it's got to be something about rvm and ruby 1.9.2. – Bob Haupt Nov 05 '10 at 04:11
  • It could also be tied to using sudo with a RVM installed ruby. RVM defaults to installing in the ~/.rvm sandbox and warns us to *not* use sudo. See [RVM cannot use ruby with sudo](http://stackoverflow.com/questions/3644897/rvm-cannot-use-ruby-with-sudo) and [installing gems using rvm](http://stackoverflow.com/questions/3853489/installing-gems-using-rvm) – the Tin Man Nov 05 '10 at 14:03
0

I'd had the same error, but I tried

sudo port install oniguruma

and got told

Error: Target org.macports.fetch returned: 

        Please use either 
            oniguruma4 (for ruby support) 
        or 
            oniguruma5 (for unicode support)

since I was trying to build a ruby gem, I installed oniguruma4 instead of oniguruma5. Having done that, the gem installed cleanly except for a warning while generating the documentation (No definition for oregexp_initialize)

Simon
  • 25,468
  • 44
  • 152
  • 266