louismullie / treat

Natural language processing framework for Ruby.
Other
1.37k stars 128 forks source link

Ruby 2.2 ERROR: Failed to build gem native extension #91

Closed Ch4s3 closed 7 years ago

Ch4s3 commented 9 years ago

I get the following tring to install with Ruby 2.2.

  ERROR:  Error installing treat:
    ERROR: Failed to build gem native extension.

      /Users/chase/.rvm/rubies/ruby-2.2.0/bin/ruby -r ./siteconf20150115-38059-17qul84.rb extconf.rb
  creating Makefile

  make "DESTDIR=" clean

  make "DESTDIR="
  compiling native.c
  native.c:39:8: warning: unused variable 'node_a' [-Wunused-variable]
          VALUE node_a;
                ^
  native.c:40:8: warning: unused variable 'node_b' [-Wunused-variable]
          VALUE node_b;
                ^
  native.c:41:8: warning: unused variable 'directed' [-Wunused-variable]
          VALUE directed;
                ^
  native.c:42:8: warning: unused variable 'direction' [-Wunused-variable]
          VALUE direction;
                ^
  native.c:58:1: warning: control may reach end of non-void function [-Wreturn-type]
  }
  ^
  native.c:272:8: warning: implicit declaration of function 'RHASH' is invalid in C99 [-Wimplicit-function-declaration]
    if (!RHASH(features)->ntbl) {
         ^
  native.c:272:25: error: member reference type 'int' is not a pointer
    if (!RHASH(features)->ntbl) {
         ~~~~~~~~~~~~~~~  ^
  6 warnings and 1 error generated.
  make: *** [native.o] Error 1

  make failed, exit code 2
shawn42 commented 9 years ago

I can confirm this error as well. It looks like the hash internals changed in 2.2; these will need to conditionally be used:

define RHASH_TBL(h) rb_hash_tbl(h)

define RHASH_SIZE(h) NUM2SIZET(rb_hash_size(h))

instead of the RHASH(xxx)->ntbl calls.

faustoct1 commented 9 years ago

I did a patch for that but is unofficial one. https://github.com/faustoct/birch/

More details in:

alexed1 commented 9 years ago

would love to see a fix for this. can't use treat as a result. I was able eto build a treat gem using faustoct's fork, but I can't figure out how to get my 2.2 project to use that gem instead of trying to build a new one in the 2.2. world

kylekyle commented 9 years ago

@faustoct: thanks for the birch fork. It saved the day.

agarie commented 9 years ago

@alexed1 you can link to a specific git repository via your Gemfile.

louismullie commented 9 years ago

@faustoct Can you submit a PR for your fork to the main birch repository?

faustoct1 commented 9 years ago

@louismullie PR submitted

Ch4s3 commented 9 years ago

:+1:

sepastian commented 9 years ago

:+1:

If you are using rbenv, you can also do:

$ cd your_project
$ rbenv local 2.1.5
$ bundle

The build works in Ruby 2.1.x.

wired00 commented 9 years ago

Based on the details gleaned above, here are the exact steps I followed to get treat working with ruby 2.2 on osx yosemite

zibs commented 9 years ago

Thank you so much @wired00!

ludoplex commented 9 years ago

boy_1106034a

@wired00! YOU ARE AWESOME!

wired00 commented 9 years ago

@ludoplex @zibs Glad it helped you guys! :)

naltun commented 8 years ago

@wired00 I am running Ubuntu 14.04.2 and this worked perfectly. Cheers!! :+1:

travispearl commented 8 years ago

For those still struggling with treat gem installation in Ruby - here is the workaround to modify your Gemfile:

Gemfile

add birch gem installation first with path to faustoct version

gem "birch", :git => 'https://github.com/faustoct/birch.git' gem "treat"

Then 'bundle install' will work as expected

louismullie commented 7 years ago

Fixed in most recent birch release