“undefined JNI_GetCreatedJavaVM”和“File format not recognized”错误原因分析
来源:互联网 发布:凸优化求解算法 编辑:程序博客网 时间:2024/05/19 16:06
如果编译时,报如下所示错误:
../../third-party/hadoop/lib/libhdfs.a(jni_helper.c.o): In function `getGlobalJNIEnv':
/root/hadoop-2.4.0-src/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/jni_helper.c:446: undefined reference to `JNI_GetCreatedJavaVMs'
/root/hadoop-2.4.0-src/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/jni_helper.c:505: undefined reference to `JNI_CreateJavaVM'
/root/hadoop-2.4.0-src/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/jni_helper.c:505: undefined reference to `JNI_CreateJavaVM'
是因为链接时,没有加上库文件libjvm.so。加上libjvm.so重编译,如果又遇到如下所示的错误:
../../third-party/libjvm.so: file not recognized: File format not recognized
这问题是因为libjvm.so不能被识别,libjvm.so的版本过高导致的
nm ../../third-party/libjvm.so | grep JNI_CreateJavaVM
nm: ../../third-party/libjvm.so: 不可识别的文件格式
查看nm的版本:
nm --version
GNU nm 2.16.91.0.5 20051219 (SUSE Linux)
Copyright 2005 Free Software Foundation, Inc.
本程序是自由软件;您可以按照 GNU 通用公共许可证
的条款对其进行再发行。本程序没有任何担保。
现在换成高一点的版本试试:
./nm --version
GNU nm 2.17.50.0.6-20.el5 20061020
Copyright 2005 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License. This program has absolutely no warranty.
再次执行,一切正常,需要升级ld了,或者降低JRE或JDK的版本试试:
./nm libjvm.so | grep JNI_CreateJavaVM
00000000006307c0 T JNI_CreateJavaVM
实际应用中,编译虽然存在此问题,但运行时,可以使用更高版本的libjvm.so。
ld下载地址:http://ftp.gnu.org/gnu/binutils/(ld和nm均是GNU binutils的成员之一)。
../../third-party/hadoop/lib/libhdfs.a(jni_helper.c.o): In function `getGlobalJNIEnv':
/root/hadoop-2.4.0-src/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/jni_helper.c:446: undefined reference to `JNI_GetCreatedJavaVMs'
/root/hadoop-2.4.0-src/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/jni_helper.c:505: undefined reference to `JNI_CreateJavaVM'
/root/hadoop-2.4.0-src/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/jni_helper.c:505: undefined reference to `JNI_CreateJavaVM'
是因为链接时,没有加上库文件libjvm.so。加上libjvm.so重编译,如果又遇到如下所示的错误:
../../third-party/libjvm.so: file not recognized: File format not recognized
这问题是因为libjvm.so不能被识别,libjvm.so的版本过高导致的
nm ../../third-party/libjvm.so | grep JNI_CreateJavaVM
nm: ../../third-party/libjvm.so: 不可识别的文件格式
查看nm的版本:
nm --version
GNU nm 2.16.91.0.5 20051219 (SUSE Linux)
Copyright 2005 Free Software Foundation, Inc.
本程序是自由软件;您可以按照 GNU 通用公共许可证
的条款对其进行再发行。本程序没有任何担保。
现在换成高一点的版本试试:
./nm --version
GNU nm 2.17.50.0.6-20.el5 20061020
Copyright 2005 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License. This program has absolutely no warranty.
再次执行,一切正常,需要升级ld了,或者降低JRE或JDK的版本试试:
./nm libjvm.so | grep JNI_CreateJavaVM
00000000006307c0 T JNI_CreateJavaVM
实际应用中,编译虽然存在此问题,但运行时,可以使用更高版本的libjvm.so。
ld下载地址:http://ftp.gnu.org/gnu/binutils/(ld和nm均是GNU binutils的成员之一)。
0 0
- “undefined JNI_GetCreatedJavaVM”和“File format not recognized”错误原因分析
- “undefined reference to JNI_GetCreatedJavaVM”和“File format not recognized”错误原因分析
- file not recognized:file format not recognized
- file not recognized: File format not recognized
- nm: test.o: File format not recognized的原因和解决方案
- File format not recognized||strip
- strip error: file format not recognized
- android-vs Error: file format not recognized
- “is not a core dump: File format not recognized”错误解决
- gdb not in executable format file format not recognized
- core文件出现“is not a core dump: File format not recognized”的原因和解决方法(看/proc/pid/limits)
- could not read symbols: File format not recognized
- /lib/libmatrix.a: file not recognized: File format not recognized collect2: ld returned 1 exit statu
- QT5 cannot find usr/local/lib, file format not recognized
- gcc File format not recognized 问题的解决
- 神奇的错误:file not recognized: File truncated
- file not recognized: File truncated【yocto编译错误】
- file not recognized: File truncated编译错误总结
- JavaScript基础——面向对象的程序设计
- Go 语言项目管理
- 操作系统7- shell
- oto餐饮app实时订单物流追踪系统架构设计(一)
- C++学习第二课
- “undefined JNI_GetCreatedJavaVM”和“File format not recognized”错误原因分析
- zoj 1395 可行遍性问题
- 网络 思科
- zabbix采集软件指标实现方法
- ios NSString md5 base64 urlEncode isEmail
- 修改项目名称
- 浅谈strtok函数的使用心得
- [Leetcode]Add Two Numbers
- BeanPropertyRowMapper小错误