0

I barely new on using mac and I got some problems when I tried running a tool from a command-line. I am trying to run a software that required a CRF++. Here is the errors;

Cannot load the example native code.
Make sure your LD_LIBRARY_PATH contains '.'
java.lang.UnsatisfiedLinkError: no CRFPP in java.library.path

I have installed the CRF++-058 on my machine. I used brew to install the CRF++ 0.58.

  /usr/local/Cellar/crf++/0.58: 11 files, 784K, built in 32 seconds

here is the output of the brew doctor

Warning: Unbrewed .la files were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .la files:
    /usr/local/lib/libcrfpp.la

Does anyone know how to solve this? Any help would be really appreciated. Thanks

bohr
  • 631
  • 2
  • 9
  • 29

2 Answers2

0

As with any homebrew problems, try:

brew doctor

first and follow the good doctor's advice.

Failing that, try

echo $LD_LIBRARY_PATH

and see if it contains the dot that it wants. If not, try editing $HOME/.profile and add a line like

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.

then logout and login again and try running your program.

Mark Setchell
  • 191,897
  • 31
  • 273
  • 432
  • Thank you for your response. I edited my question so you can see the output of the brew doctor. Honestly, since I am barely new on using this machine, i am afraid I could not really understand how to edit $HOME/.profile. by the way, when I echo $LD_LIBRARY_PATH, I got nothing (empty perhaps). @Mark Setchell – bohr Jul 03 '15 at 22:04
  • I deleted the .la on my /usr/local/lib, then when I ran the brew doctor, it says that my system is ready to brew – bohr Jul 03 '15 at 22:08
  • Try just typing `export LD_LIBRARY_PATH=.` and then running your program. If that works, we can work on setting it permanently by starting 'Textedit` and editing `.profile` in your Home directory. – Mark Setchell Jul 03 '15 at 22:18
  • Thanks Mark. I just did both. First, I tried to use export LD_LIBRARY_PATH=. and ran my program. Yet, it did not work. Then I tried to create the ~/.bash_profile, and add export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. Yet, it did not work either :( – bohr Jul 03 '15 at 22:23
0

I met the same problem when using crfpp with java.

my original code like this.

static {
    try {
        sf_model="/~/java";
        sf_tagger = new Tagger(String.format("-m %s -v 3 -n2", sf_model+"/crfmodel"));
    } catch (UnsatisfiedLinkError e) {
        System.err.println("Cannot load the example native code.\nMake sure your LD_LIBRARY_PATH contains \'.\'\n" + e);
        System.exit(1);
    }
}

but I added one line and the problem solved

static {
    try {
        sf_model="/~/java";
        System.load(sf_model + "/libCRFPP.so");
        sf_tagger = new Tagger(String.format("-m %s -v 3 -n2", sf_model+"/crfmodel"));
    } catch (UnsatisfiedLinkError e) {
        System.err.println("Cannot load the example native code.\nMake sure your LD_LIBRARY_PATH contains \'.\'\n" + e);
        System.exit(1);
    }
}