关于libjnotify.so的版本在linux上不兼容的问题解决

来源:互联网 发布:湘北 陵南 数据 编辑:程序博客网 时间:2024/06/05 10:55

一、问题描述

SEVERE: Servlet [InitServlet] in web application [] threw load() exception
java.lang.UnsatisfiedLinkError:/payment/tomcats/tomcat-payment-gateway/lib/libjnotify.so:/lib64/libc.so.6:version`GLIBC_2.12’not found (required by /payment/tomcats/tomcat-payment-gateway/lib/libjnotify.so)

二、解决办法

方法一:重新编译jnotify生成libjnotify.so

1、使用[strings /lib64/libc.so.6 | grep GLIBC] 查看支持系统中的GLIBC版本
payment@test1:~/tomcats/tomcat-payment-gateway/logs>
strings /lib64/libc.so.6 | grep GLIBC

GLIBC_2.2.5
GLIBC_2.2.6
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_2.11
GLIBC_PRIVATE

发现系统的glibc比较老旧,最新的为GLIBC_2.11。

2、为了安全和稳定起见,自己编译jnotify的代码生成libjnotify.so

3、执行 gcc -I /usr/java/jdk1.7.0_80/include/ -I
/usr/java/jdk1.7.0_80/include/linux/ -fPIC -g -c
net_contentobjects_jnotify_linux_JNotify_linux.c -o libjnotify.o

会看到多个libjnotify.o

4、执行 gcc -g -shared -W1 -o libjnotify.so libjnotify.o -lc
就会看到 libjnotify.so

5、然后把 libjnotify.so复制到java.library.path下面去就行了

方法二:升级GLIBC

1、glibc下载地址:http://ftp.gnu.org/gnu/glibc/
2、解压
$ mv glibc-ports-2.15 glibc-2.15/ports
$ mkdir glibc-build-2.15 &&cd glibc-build-2.15
$ ./glibc-2.15/configure
--prefix=/usr/local/glibc_mips CC=mipsel-linux-gcc
--host=mipsel-linux
--build=i686-pc-linux-gnu
--enable-add-on=nptl
libc_cv_forced_unwind=yes
libc_cv_c_cleanup=yes
libc_cv_mips_tls=yes
libc_cv_gnu99_inline=yes

3、第2步没问题执行
$ make &&make install
4、查看是否升级完成
$ ls -l /lib/libc.so.6
输出:lrwxrwxrwx 1 root root 14 Jun 16 11:24 /lib/libc.so.6 -> libc-2.12.3.so
说明升级完成。

三、参考链接:

http://blog.csdn.net/akon_vm/article/details/9329089
http://blog.csdn.net/ldl22847/article/details/18702645

PS:
1、64位linux系统可以运行32位和64位程序,32位系统只能运行32位程序
2、file topas可以检查这个文件是32位还是64位
3、ldd topas可以检查这个文件需要哪些依赖库文件,可能依赖的库文件libG4processes.so是32位不满足需求

阅读全文
0 0
原创粉丝点击