RelEx Issue: "no link-grammar-jar in java.library.path"

18 കാഴ്‌ചകൾ
വായിക്കാത്ത ആദ്യ സന്ദേശത്തിലേക്ക് പോവുക

Jack Park

വായിക്കാത്തത്,
2019, മേയ് 29 9:35:56 PM29/5/19
സ്വീകർത്താവ് opencog
That's the error message in a small testbed to feed RelEx sentences and learn how to process the results.
Context:
Simple Eclipse project on an Ubuntu box with LinkGrammar parser 5.6.1 installed and RelEx did run its simple test, which, I believe, means it's working. 
This project is not that RelEx but instead, uses the entire RelEx library of jars in the Eclipse project, including the linkgrammar.5.6.1.jar; it's all in there.

I create a copy of RelationExtractor and then ask it getVersion() - that's when the error occurs; it's not finding the parser.

Is there a simple explanation for that error message?

BTW: I posted this question in the OpenCog slack as well.

Jack Park

വായിക്കാത്തത്,
2019, മേയ് 29 11:14:24 PM29/5/19
സ്വീകർത്താവ് opencog
Correction: no link-grammar-java

Linas Vepstas

വായിക്കാത്തത്,
2019, മേയ് 29 11:23:51 PM29/5/19
സ്വീകർത്താവ് opencog


On Wed, May 29, 2019 at 10:14 PM Jack Park <jack...@topicquests.org> wrote:
Correction: no link-grammar-java

Well, that just says that something somewhere is not finding the link-grammar java bindings.  I cannot speculate why. Maybe some CLASSPATH doesn't point to the where the link-grammar jar file is.  Normally, I think it ends up in /usr/local/share/java/linkgrammar.jar

viz. java -classpath /usr/local/share/java/linkgrammar.jar relex.RelationExtractor -h

If that doesn't fix it try adding

-Djava.library.path=/usr/local/lib:/usr/local/lib/jni

I assume it's something like that.

-- Linas

--
You received this message because you are subscribed to the Google Groups "opencog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opencog+u...@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
Visit this group at https://groups.google.com/group/opencog.
To view this discussion on the web visit https://groups.google.com/d/msgid/opencog/8c05b715-a4ed-4540-b696-20f0997575c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
cassette tapes - analog TV - film cameras - you

Jack Park

വായിക്കാത്തത്,
2019, മേയ് 30 12:43:07 AM30/5/19
സ്വീകർത്താവ് opencog
Thank you. I did some other experiments and managed to make this deduction:
I did not have Ant installed when I built the platform. I only discovered that when I went in to hand build the linkgrammar.jar
But, that led to this: it apparently did not install the JNI stuff; there is no /usr/lib/jni or /usr/local/lib/jni directory.

With Ant installed, I tried to run make install again on LinkGrammar - you can tell I'm not a *nix pro - and it says 'nothing to do'

So, I am wondering what is the work around to coax it to install the java-jni bindings - if, indeed, they are needed.

Many thanks
-jack


On Wednesday, May 29, 2019 at 8:23:51 PM UTC-7, linas wrote:
On Wed, May 29, 2019 at 10:14 PM Jack Park <jack...@topicquests.org> wrote:
Correction: no link-grammar-java

Well, that just says that something somewhere is not finding the link-grammar java bindings.  I cannot speculate why. Maybe some CLASSPATH doesn't point to the where the link-grammar jar file is.  Normally, I think it ends up in /usr/local/share/java/linkgrammar.jar

viz. java -classpath /usr/local/share/java/linkgrammar.jar relex.RelationExtractor -h

If that doesn't fix it try adding

-Djava.library.path=/usr/local/lib:/usr/local/lib/jni

I assume it's something like that.

-- Linas


On Wednesday, May 29, 2019 at 6:35:56 PM UTC-7, Jack Park wrote:
That's the error message in a small testbed to feed RelEx sentences and learn how to process the results.
Context:
Simple Eclipse project on an Ubuntu box with LinkGrammar parser 5.6.1 installed and RelEx did run its simple test, which, I believe, means it's working. 
This project is not that RelEx but instead, uses the entire RelEx library of jars in the Eclipse project, including the linkgrammar.5.6.1.jar; it's all in there.

I create a copy of RelationExtractor and then ask it getVersion() - that's when the error occurs; it's not finding the parser.

Is there a simple explanation for that error message?

BTW: I posted this question in the OpenCog slack as well.

--
You received this message because you are subscribed to the Google Groups "opencog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ope...@googlegroups.com.

To post to this group, send email to ope...@googlegroups.com.
Visit this group at https://groups.google.com/group/opencog.
To view this discussion on the web visit https://groups.google.com/d/msgid/opencog/8c05b715-a4ed-4540-b696-20f0997575c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Linas Vepstas

വായിക്കാത്തത്,
2019, മേയ് 30 1:02:13 AM30/5/19
സ്വീകർത്താവ് opencog
On Wed, May 29, 2019 at 11:43 PM Jack Park <jack...@topicquests.org> wrote:
Thank you. I did some other experiments and managed to make this deduction:
I did not have Ant installed when I built the platform. I only discovered that when I went in to hand build the linkgrammar.jar
But, that led to this: it apparently did not install the JNI stuff; there is no /usr/lib/jni or /usr/local/lib/jni directory.

With Ant installed, I tried to run make install again on LinkGrammar - you can tell I'm not a *nix pro - and it says 'nothing to do'

I believe that  it is `configure` that searches for `ant`; so you have to run configure again, then make, then make install.

Sometimes saying `make clean` before you restart helps, as an extra magic incantation.

I guess I'm wrong about /usr/local/lib/jni -- its not on my system either. java has about a million different favorite places to install things, it is hard to guess what the flavor of the month is. 

--linas

To unsubscribe from this group and stop receiving emails from it, send an email to opencog+u...@googlegroups.com.

To post to this group, send email to ope...@googlegroups.com.
Visit this group at https://groups.google.com/group/opencog.

For more options, visit https://groups.google.com/d/optout.

Vitaly Bogdanov

വായിക്കാത്തത്,
2019, മേയ് 30 8:17:00 AM30/5/19
സ്വീകർത്താവ് opencog
Hi Jack,

If Java complains that something is not in "java.library.path" it means that ".jar" package you loaded tries to load native (JNI) shared library and cannot find it.
In the case it complains that it cannot find "liblink-grammar-java.so" library.

First of all you may check if this file is built, just execute `find -name liblink-grammar-java.so` in link-grammar build directory. If you cannot find the file, try to re-run `./configure` and check if it says that java bindings will be build. Ant is necessary to build java bindings so as Linas said above probably `./configure` and `make` will build them after ant is installed.

Next `make install` should copy library into standard directory to make loading possible without additional effort. List of such places is located at `/etc/ld.so.conf` and `/etc/ld.so.conf.d/*`. You may need to run `sudo ldconfig` after install to add links to the specific library version.

If library installed in non-standard place then it still possible to load it adding installation directory to shell `LD_LIBRARY_PATH` variable or java `java.library.path` variable. If you are using Eclipse you should be able to modify `java.library.path` in the project settings.

Best regards,
  Vitaly

Jack Park

വായിക്കാത്തത്,
2019, മേയ് 30 12:03:59 PM30/5/19
സ്വീകർത്താവ് opencog
Hi Vitali and Linus
Ran configure, then make clean. Here's the trace for java-jni

make[2]: Entering directory '/home/jackpark/Downloads/link-grammar-5.6.1/bindings/java-jni'

CC jni-client.lo

CXXLD liblink-grammar-java.la

ar: `u' modifier ignored since `D' is the default (see `U')

make[2]: Leaving directory '/home/jackpark/Downloads/link-grammar-5.6.1/bindings/java-jni'

Not sure it did anything. Here is the trace for make install after that:

make[1]: Entering directory '/home/jackpark/Downloads/link-grammar-5.6.1/bindings'

Making install in java-jni

make[2]: Entering directory '/home/jackpark/Downloads/link-grammar-5.6.1/bindings/java-jni'

make[3]: Entering directory '/home/jackpark/Downloads/link-grammar-5.6.1/bindings/java-jni'

/bin/mkdir -p '/usr/local/lib'

/bin/bash ../../libtool --mode=install /usr/bin/install -c liblink-grammar-java.la '/usr/local/lib'

libtool: warning: relinking 'liblink-grammar-java.la'

libtool: install: (cd /home/jackpark/Downloads/link-grammar-5.6.1/bindings/java-jni; /bin/bash "/home/jackpark/Downloads/link-grammar-5.6.1/libtool" --silent --tag CXX --mode=relink g++ -D_DEFAULT_SOURCE -std=c++11 -g -O2 -O3 -Wall -version-info 11:1:6 -export-dynamic -no-undefined -export-symbols ./link-grammar-java.def -o liblink-grammar-java.la -rpath /usr/local/lib jni-client.lo ../../link-grammar/liblink-grammar.la ../../link-grammar/minisat/libminisat.la -lm )

libtool: install: /usr/bin/install -c .libs/liblink-grammar-java.so.5.6.1T /usr/local/lib/liblink-grammar-java.so.5.6.1

libtool: install: (cd /usr/local/lib && { ln -s -f liblink-grammar-java.so.5.6.1 liblink-grammar-java.so.5 || { rm -f liblink-grammar-java.so.5 && ln -s liblink-grammar-java.so.5.6.1 liblink-grammar-java.so.5; }; })

libtool: install: (cd /usr/local/lib && { ln -s -f liblink-grammar-java.so.5.6.1 liblink-grammar-java.so || { rm -f liblink-grammar-java.so && ln -s liblink-grammar-java.so.5.6.1 liblink-grammar-java.so; }; })

libtool: install: /usr/bin/install -c .libs/liblink-grammar-java.lai /usr/local/lib/liblink-grammar-java.la

libtool: install: /usr/bin/install -c .libs/liblink-grammar-java.a /usr/local/lib/liblink-grammar-java.a

libtool: install: chmod 644 /usr/local/lib/liblink-grammar-java.a

libtool: install: ranlib /usr/local/lib/liblink-grammar-java.a

libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/sbin" ldconfig -n /usr/local/lib

----------------------------------------------------------------------

Libraries have been installed in:

/usr/local/lib


If you ever happen to want to link against installed libraries

in a given directory, LIBDIR, you must either use libtool, and

specify the full pathname of the library, or use the '-LLIBDIR'

flag during linking and do at least one of the following:

- add LIBDIR to the 'LD_LIBRARY_PATH' environment variable

during execution

- add LIBDIR to the 'LD_RUN_PATH' environment variable

during linking

- use the '-Wl,-rpath -Wl,LIBDIR' linker flag

- have your system administrator add LIBDIR to '/etc/ld.so.conf'


See any operating system documentation about shared libraries for

more information, such as the ld(1) and ld.so(8) manual pages.

----------------------------------------------------------------------

make[3]: Nothing to be done for 'install-data-am'.

make[3]: Leaving directory '/home/jackpark/Downloads/link-grammar-5.6.1/bindings/java-jni'

make[2]: Leaving directory '/home/jackpark/Downloads/link-grammar-5.6.1/bindings/java-jni'

So, perhaps it is the case that I must force a link to objects in /usr/local/lib as Linus suggested earlier
I shall experiment.
In any case, there is no /usr/local/lib/jni or /usr/lib/jni

Many thanks, -Jack
 

Jack Park

വായിക്കാത്തത്,
2019, മേയ് 30 12:32:35 PM30/5/19
സ്വീകർത്താവ് opencog
Hah! After the clean make, Linus's suggestion to add -Djava.library.path=/usr/local/lib to the VM args in Eclipse did the trick.
I have exercises which pass the same sentence directly to the parser and to RelEx; both exercises run just fine.

In a different thread, I'll explain what I am working on.

Many thanks,
-Jack
എല്ലാവർക്കും മറുപടി നൽകുക
എഴുതിയ ആൾക്ക് മറുപടി അയയ്ക്കുക
കൈമാറുക
പുതിയ 0 സന്ദേശങ്ങൾ