简体   繁体   中英

CRF++-058 on MAC

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

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.

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);
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM