Hi all,

I'm still trying to build the Java bindings with OB 2.4.1.  I've tried
everything at this point.  Building OB static does not build with the
bindings.  Here are some of the things I've tried on 3 CentOS-7 boxes and 1
Ubuntu (v14) box.

Swig:
2.0.10
2.8.2
3.0.9
3.0.11

JAVA:
OpenJDK 1.8
OpenJDK 1.7
Jave (Oracle) 1.8

Cmake:
2.8
3.0

Does someone have a recipe?  I can't stand to see this error anymore:

/usr/bin/ld:
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libz.a(inffast.o):
relocation R_X86_64_32S against `.rodata.str1.1' can not be used when
making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libopenbabel_java.so] Error 1
make[1]: *** [scripts/CMakeFiles/bindings_java.dir/all] Error 2
make: *** [all] Error 2

Here is the cmake line I am using:
cmake3 -DBUILD_SHARED=OFF
-DJAVA_AWT_LIBRARY=$JAVA_HOME/lib/amd64/libjawt.so
-DJAVA_JVM_LIBRARY=$JAVA_HOME/jre/lib/amd64/server/libjvm.so
-DCMAKE_C_FLAGS="-fPIC -Wall -O3 -std=c++11" -DCMAKE_CXX_FLAGS="-fPIC -Wall
-O3 -std=c++11" -DPYTHON_BINDINGS=ON -DJAVA_BINDINGS=ON -DRUN_SWIG=ON ..

It doesn't appear that compiling OB automatically hardens on the compile.
fPIC isn't in the default compilation instructions, but as you can see I've
added it.  I also had to add the c++11, I don't know why but without it OB
will not build.

Also, the dynamic build works but the resulting jar file is broken.

Thanks in advance!
Matt
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to