nymo1 / java-simple-serial-connector

Automatically exported from code.google.com/p/java-simple-serial-connector
0 stars 0 forks source link

GLIBC_2.15 not found #38

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
We are using jSSC 2.5.0 on Debian Wheezy which has Libc 2.13. 

Creating a new instance of a SerialPort gives this exception:

Exception in thread "Thread1" java.lang.UnsatisfiedLinkError: 
/home/telcred/.jssc/linux/libjSSC-2.5_x86_64.so: 
/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.15' not found (required by 
/home/telcred/.jssc/linux/libjSSC-2.5_x86_64.so)
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1750)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1646)
        at java.lang.Runtime.load0(Runtime.java:787)
        at java.lang.System.load(System.java:1022)
        at jssc.SerialNativeInterface.<clinit>(SerialNativeInterface.java:159)
        at jssc.SerialPort.<init>(SerialPort.java:113)

We tried to force jSSC to use a newer libc6 by using libc6-2.15 and libc6-2.17 
from various other sources (add conf to /etc/ld.so.conf.d/ and do ldconfig, run 
JVM with "-Djava.library.path=<path to libc6>") but libjSSC-2.5_x86_64.so 
always looks in only one place for libc.so.6, namely /lib/x86_64-linux-gnu/
We also tried to set the search path with LD_PRELOAD and LD_LIBRARY_PATH 
environment variables but the former just gave an error ("couldn't load 
<libname>, ignoring it") and the latter did nothing at all. Both variables were 
exported OK.

Do you know of any way we could force jSSC to search for libc.so.6 on a custom 
path?

We do not want to upgrade our OS, nor force-update the libc6 used by the OS, so 
the only option for us would be to recompile the jSSC native libs from source 
against libc6-2.13. It would help a lot if we could get hold of the build 
scripts you use. Could you make the build scripts available here?

Original issue reported on code.google.com by telc...@gmail.com on 10 May 2013 at 2:06

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Same problem on CentOS 5.9

2013-05-11 08:28:05,012 [main] INFO  
net.dfware.asterisk.cdr2serial.Cdr2SerialConf - Serial to use: /dev/ttyUSB0 
9600,8,1,none
Exception in thread "main" java.lang.UnsatisfiedLinkError: 
/root/.jssc/linux/libjSSC-2.5_x86_64.so: /lib64/libc.so.6: version `GLIBC_2.15' 
not found (required by /root/.jssc/linux/libjSSC-2.5_x86_64.so)
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1939)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1864)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1825)
        at java.lang.Runtime.load0(Runtime.java:792)
        at java.lang.System.load(System.java:1059)
        at jssc.SerialNativeInterface.<clinit>(SerialNativeInterface.java:159)
        at jssc.SerialPortList.<clinit>(SerialPortList.java:43)
        at net.dfware.asterisk.cdr2serial.SerialUtil.exist(SerialUtil.java:16)
        at net.dfware.asterisk.cdr2serial.Main.init(Main.java:55)
        at net.dfware.asterisk.cdr2serial.Main.main(Main.java:36)

Original comment by pdi...@gmail.com on 11 May 2013 at 6:31

GoogleCodeExporter commented 8 years ago
Yes, jSSC-2.5.0 builded with GCC-4.6 on Xubuntu-12.04 and use glibc-2.15. In 
this situation the simplest and correct way is to recompile native libs. You 
can do it by these strings:

g++ -m32 -O3 -s -I/usr/local/java/jdk1.6.0_45/include 
-I/usr/local/java/jdk1.6.0_45/include/linux -fPIC jssc.cpp -shared -o 
libjSSC-2.5_x86.so
g++ -m64 -O3 -s -I/usr/local/java/jdk1.6.0_45/include 
-I/usr/local/java/jdk1.6.0_45/include/linux -fPIC jssc.cpp -shared -o 
libjSSC-2.5_x86_64.so

As I see it could be a frequently problem, I will rebuild jSSC in a few days.

Original comment by scream3r.org@gmail.com on 11 May 2013 at 7:09

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
You recompiled jSSC native lib, or place other version of glibc into 
~/.jssc/linux ?

Original comment by scream3r.org@gmail.com on 11 May 2013 at 12:00

GoogleCodeExporter commented 8 years ago
I have recompiled jSSC native lib and put it into ~/.jssc/linux. Sorry for my 
poor English.

I ask you if I must remove native libs from jar for avoiding conflits.

Original comment by pdi...@gmail.com on 11 May 2013 at 2:37

GoogleCodeExporter commented 8 years ago
No, you don't, jSSC check native lib in ~/.jssc/linux and load it if find. You 
can just replace original Linux native 2.5 lib in jSSC.jar archive by lib that 
you compiled.

Original comment by scream3r.org@gmail.com on 11 May 2013 at 3:20

GoogleCodeExporter commented 8 years ago
We recompiled the native lib as instructed and it works perfectly. Thanks!

Original comment by telc...@gmail.com on 13 May 2013 at 2:16

GoogleCodeExporter commented 8 years ago
PS. We are using openJDK and it compiled without a problem once we found the 
right include path.

Original comment by telc...@gmail.com on 13 May 2013 at 2:17

GoogleCodeExporter commented 8 years ago
Fixed in 2.6.0 The new jSSC-2.6.0 version builded with Ubuntu 10.04 and don't 
depends GLIBC-2.15

Original comment by scream3r.org@gmail.com on 1 Jun 2013 at 11:50