-
Notifications
You must be signed in to change notification settings - Fork 24
JNI: unable to compile self-contained library, or a wrapper that works in tandem with the C library #16
Comments
The Maven artifact should still link to the underlying C++ library, it is not self-contained. Can you do me a favor and run
|
And:
My thinking is that |
It does not look like the JNI library (
My guess is that my Maven config has goofed up the compilation path in some way or is otherwise not playing nice with OpenJDK. I'll keep digging. |
Would you please detail your testing setup so that I can duplicate it on a VM? My best guess based on your blog posts was a 32-bit Ubuntu 11.10 VM. |
You are correct. My Ubuntu setup is a VMWare image started fresh for this with no history.
In my case I installed GCC and the Oracle JDK. I then installed the base library:
Note that there have been some I then set
|
Okay, so you're using 11.04. (For anyone reading's benefit.) |
I was able to compile a working version of the library using the following steps. I will follow up later as to whether I can reproduce on Ubuntu 12.04 64-bit. There is one modification necessary for running on amd64 - adding the
To test the final result from the command line, note that the The test string, to be executed from You should get the following output: |
I am unable to build a properly linked The generated library is linked like so:
|
An additional detail: building with |
Second this, cannot build a properly linked JNI when using gcc-4.8 on Ubuntu 17, If i try the same with Docker on Centos7 I am able to get a properly linked so file. |
I'm trying to build the Java port of cld on Ubuntu 12.04 64-bit, using OpenJDK 6. The shared object file built by Maven contains the JNI bindings, but the
CompactLangDet::DetectLanguage
symbol is undefined. (Bit of a C++ newbie) I can't tell if the intent is for the Maven-built wrapper to be used alongside the make-builtlibcld
, or whether Maven is supposed to be generating an "all-in-one" library.I am encountering a symbol lookup error when running CompactLanguageDetector's main method from the command line, with the Maven-generated shared object being loaded as
libcld
, like so:I'm setting the
JAVA_HOME
andLD_LIBRARY_PATH
variables via an export statement:Examining the shared object produced by Maven (
libcld-0.0.1-SNAPSHOT.so
) usingnm -gC
shows that theCompactLangDet:DetectLanguage
symbol is undefined.I've also tried writing code that loads the Maven-generated wrapper then
libcld
from/usr/local/lib/cld/
and vice-versa, but it hasn't helped.Could someone please tell me:
a) is the Maven-generated artifact supposed to be self-contained? (i.e. provides
libcld
and the JNI wrappers in the same file)and
b) am I building incorrectly?
Thanks!
Here's the
mvn install
output fornative:compile
andnative:link
for reference:The text was updated successfully, but these errors were encountered: