#59 MeCab not working on Snow Leopard RubyCocoa App

kimura wataru
crash (13)

I've been trying to use MeCab from RubyCocoa application on Snow Leopard. I installed the latest MeCab-Ruby (0.98) and I can use it from Ruby scripts, but not from RubyCocoa application. The same application runs fine on Leopard.

A simple script (sample on MeCab site) like the following ends up crashing the application.

require 'MeCab'
m = MeCab::Tagger.new("-Ochasen")
print m.parse("今日もしないとね")

The error message is the following:

dyld: lazy symbol binding failed: Symbol not found: __ZN5MeCab12createTaggerEPKc
Referenced from: /Library/Ruby/Site/1.8/universal-darwin10.0/MeCab.bundle
Expected in: flat namespace

dyld: Symbol not found: __ZN5MeCab12createTaggerEPKc
Referenced from: /Library/Ruby/Site/1.8/universal-darwin10.0/MeCab.bundle
Expected in: flat namespace

Could this be a bug or is there anything wrong with MeCab-Ruby on Snow Leopard? Considering it works fine with Ruby 1.8.7, it could be a RubyCocoa bug, though. Or is this fixed on the latest build?. Or should I blame MeCab-Ruby? I'm using 0.13.2, which I believe comes with Snow Leopard



  • kimura wataru
    kimura wataru

    this problem might cause architecture conflicts between libmecab.dylib and your app, such as x86_64 and i386.
    please tell me results of running ruby with command line like the following list.

    $ arch -i386 ruby -rMeCab -e "m = MeCab::Tagger.new('-Ochasen')"
    $ arch -x86_64 ruby -rMeCab -e "m = MeCab::Tagger.new('-Ochasen')"

  • kimura wataru
    kimura wataru

    • assigned_to: nobody --> kimuraw
    • status: open --> open-accepted
  • Sassoku no komento do-mo arigato gozaimasu.

    I checked both commands and the first returned error and the second didin't. So I changed the build target to x86_64 and the application run without error. Then I run the same application on CoreDuo Leopard machine and it didn't run, obviously.

    I set the application architecture to Standard (32/64-bit Universal) and valid architecture includes i386 on Xcode, but it looks like the built application only includes x86_64 if I select x86_64 as the active architecture (build only for the active architecture NOT ckecked), according to the error report on Leopard (it says Code Type: x86-64 (Native)). Is there anything that can be done on RubyCocoa? Or is there any setting on Xcode so I can include both (am I missing something?)? Or should I just build the app for each architecture?

    Again, thank you very much for your comment.