Code Monkey home page Code Monkey logo

Comments (13)

aurelian avatar aurelian commented on June 14, 2024

Hi ababich,

Thanks for reporting this.

Somehow it works for me under Mac OS X 10.6.6 with ruby 1.9.2p136 under rvm 1.2.7:

$ rvm use ruby-1.9.2-p136
$ ruby -v
ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.5.0]
$ gem -v
1.3.7
$ gem install ruby-stemmer
Building native extensions.  This could take a while...
Successfully installed ruby-stemmer-0.8.2
1 gem installed
$ irb 
ruby-1.9.2-p136 :002 > require 'lingua/stemmer'
 => true 
ruby-1.9.2-p136 :003 > Lingua.stemmer( %w(incontestabil nendoielnic), :language => "ro" )
 => ["incontest", "nendoieln"] 
$ rvm -v
rvm 1.2.7 by Wayne E. Seguin

There must be some particularity of you system, can you please post more details?

  1. What's the exact failure?
  2. What gives you: %x[file #{File.expand_path(File.join(Config::CONFIG['bindir'], Config::CONFIG['RUBY_INSTALL_NAME']))}] if you run it in an irb session?
  3. What's the output of echo $ARCHFLAGS (in bash or in your shell)?
  4. Can you post (e.g. in a gist / pull request) your changes?

For a history of issues related with compilation problems on Mac OS X, please check: issue 3, issue 5 and issue 6.

from ruby-stemmer.

ababich avatar ababich commented on June 14, 2024
1.

Your way didn't work for me and no solution was found, so what I did to solve the problem

https://gist.github.com/860186

This was caused by failing compilation of comptest.c using libstemmer.o in includes

https://gist.github.com/860194

This can be fixed using ranlib:

$ ranlib libstemmer_c/libstemmer.o

I've added a patch to extconf.rb:
# make libstemmer_c. unless we're cross-compiling.
unless RUBY_PLATFORM =~ /i386-mingw32/
system "cd #{LIBSTEMMER}; #{make} libstemmer.o; cd #{ROOT};"
exit unless $? == 0
end
if RUBY_PLATFORM =~ /darwin/
system "ranlib #{File.expand_path(File.join(LIBSTEMMER, 'libstemmer.o'))}"
end

last three lines - is my addition

after that it was almost work but compiling fails with ld message:
archive member '' with length 0 is not mach-o or bitcode

with exact empty '' - I found that this should hint to wrong arch when compiling internals of libstemmer.o

So, I have to provide ARCHFLAGS.

2.

The expression you have provided fails:

$ irb ruby-1.9.2-p136 :001 > %x[file #{File.expand_path(File.join(Config::CONFIG['bindir'], Config::CONFIG['RUBY_INSTALL_NAME']))}]
NameError: uninitialized constant Object::Config
        from (irb):1
        from /Users/coyote/.rvm/rubies/ruby-1.9.2-p136/bin/irb:16:in `<main>'

And I didn't resolve this.

3.

$ echo $ARCHFLAGS
    <- EMPTY

So, I've noticed that logic is a bit wrong and changed clause in your code in extconf.rb:
- ENV['ARCHFLAGS']= "-arch " + %x[file #{File.expand_path(File.join(Config::CONFIG['bindir'], Config::CONFIG['RUBY_INSTALL_NAME']))}].strip!.match(/executable (.+)$/)[1] unless ENV['ARCHFLAGS'].nil?
+ ENV['ARCHFLAGS']= "-arch " + %x[file #{File.expand_path(File.join(Config::CONFIG['bindir'], Config::CONFIG['RUBY_INSTALL_NAME']))}].strip!.match(/executable (.+)$/)[1] if ENV['ARCHFLAGS'].nil?

in fact changed unless to if which allows me to provide external ARCHFLAGS

which makes me successful execution:

https://gist.github.com/860210

Making
$ gem build ruby-stemmer.gemspec
Successfully built RubyGem
Name: ruby-stemmer
Version: 0.8.5
File: ruby-stemmer-0.8.5.gem

this resulted gem was installed successfully.

Please, investigate :)

from ruby-stemmer.

ababich avatar ababich commented on June 14, 2024

Yeah, some issues like foo.txt I've sorted out too, but yesterday it was 0.8.2 and today a 0.8.5 :)

from ruby-stemmer.

aurelian avatar aurelian commented on June 14, 2024

Hi ababich,

Thanks for providing those details.
One more thing, what's the value of your COMMAND_MODE?

You can get it by running:

$ echo $COMMAND_MODE

in your shell. If is not unix2003 can you change it with:

$ export COMMAND_MODE=unix2003

and then try to compile it again? ( gem install ruby-stemmer should do it )

Does it work?

Thanks again.

ps. yeah, bumped the version number earlier today.

from ruby-stemmer.

aurelian avatar aurelian commented on June 14, 2024

NameError: uninitialized constant Object::Config #---> forgot to add but most likely you'll need require 'mkmf' before :|

from ruby-stemmer.

ababich avatar ababich commented on June 14, 2024
ruby-1.9.2-p136 :001 > require 'mkmf'
 => true 
ruby-1.9.2-p136 :002 > %x[file #{File.expand_path(File.join(Config::CONFIG['bindir'], Config::CONFIG['RUBY_INSTALL_NAME']))}]
 => "/Users/coyote/.rvm/rubies/ruby-1.9.2-p136/bin/ruby: Mach-O 64-bit executable\n" 

from ruby-stemmer.

aurelian avatar aurelian commented on June 14, 2024

Hi ababich,

So, what's the value of your COMMAND_MODE? (see this comment: https://github.com/aurelian/ruby-stemmer/issues#issue/9/comment/847166 )

I'm trying to figure-out a solution for your problem without forcing -arch flag (rumors that Apple compilers will drop it).

from ruby-stemmer.

ababich avatar ababich commented on June 14, 2024

Oh, sorry - few moments

from ruby-stemmer.

ababich avatar ababich commented on June 14, 2024
$ echo $COMMAND_MODE
legacy
$ export COMMAND_MODE=unix2003
$ echo $COMMAND_MODE
unix2003

$ ruby -v #to ensure correct environment
ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10]

$ gem uninstall ruby-stemmer
$ gem install ruby-stemmer

Fetching: ruby-stemmer-0.9.0.gem (100%)
Building native extensions.  This could take a while...
Successfully installed ruby-stemmer-0.9.0
1 gem installed
Installing ri documentation for ruby-stemmer-0.9.0...
Installing RDoc documentation for ruby-stemmer-0.9.0...

Like a charm!! Many thanks!

from ruby-stemmer.

ababich avatar ababich commented on June 14, 2024

Without setting COMMAND_MODE still does not work with the same errors

from ruby-stemmer.

ababich avatar ababich commented on June 14, 2024

Looks like everybody who uses iTerm instead of system Terminal.app may be affected by COMMAND_MODE issue and should add this export to ~/.profile by default

from ruby-stemmer.

aurelian avatar aurelian commented on June 14, 2024

Great!

Will try to come up with a proper fix soon (like exporting unix2003 in extconf.rb).

from ruby-stemmer.

aurelian avatar aurelian commented on June 14, 2024

bump to 0.9.1 (closed by b124b72)

from ruby-stemmer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.