“undefined reference to JNI_GetCreatedJavaVM”和“File format not recognized”错误原因分析

如果编译时,报如下所示错误:
../../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.

再次执行,一切正常,需要升级GCC了,或者降低JRE或JDK的版本试试:
./nm libjvm.so | grep JNI_CreateJavaVM
00000000006307c0 T JNI_CreateJavaVM

转载于:https://www.cnblogs.com/aquester/p/9891603.html

“undefined reference to JNI_GetCreatedJavaVM”和“File format not recognized”错误原因分析...相关推荐

  1. win7 vscode mingw c++ 报错 file format not recognized treating as linker script

    问题:file format not recognized; treating as linker script 原因:是自己写了其他的头文件和cpp,然后在test.cpp中包含调用,发现自己写的其 ...

  2. libopencv_core.so: file not recognized: File format not recognized

    /dependencies/OpenCV348/lib/libopencv_core.so: file not recognized: File format not recognized 解决方法: ...

  3. ubuntu makefile交叉编译报错:file not recognized: file format not recognized

    在linux ubuntu上编译netkit-ftp的时候报错:file not recognized: file format not recognized [root@ubuntu /arnold ...

  4. linux交叉编译时报错:file not recognized: File format not recognized

    版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/u011113596/article/d ...

  5. Linux_Qt:-1: error: cannot find xxx/lib: file format not recognized

    给QT工程 pro文件添加zmq的项目lib时,编译出现: :-1: error: cannot find /opt/toolschain/zeroMQ/zeromq_gcc/lib: file fo ...

  6. /lib//libclntsh.so: file format not recognized; treating as linker script

    centos7.7+oracle19.3 建库过程报错:预检查都是通过的 /oracle/product/19.3.0/db_1/lib/libasmperl19.a -Wl,--no-whole-a ...

  7. C++:错误:File format not recognized

    文章目录 错误 原因 错误 源文件后缀要是合法的规则.cpp/cxx/hpp/ g++ a.sh .: file not recognized: File format not recognized ...

  8. file not recognized: File format not recognized

    当我编译一段代码时,编译出现了file not recognized: File format not recognized的错误,但是代码本身也没有问题,最后发现问题出在程序的名字上,我最初给程序命 ...

  9. QT调试的时候提示not in executable format:file format not recognized

    刚开始学习Qt,在调试程序时提示not in executable format:file format not recognized 在查找资料后发现是因为编译器(Compiler)使用了32 位版 ...

最新文章

  1. IplImage 类型和 CvMat 类型转换为 Mat 类型
  2. 双线性内插怎么缩小_汗蒸桶怎么选择才是最好的
  3. Consul etcd ZooKeeper euerka 对比
  4. 问:关于上升沿和下降沿触发的讨论
  5. 总线全称_一篇文章讲透I2C总线协议
  6. 浅谈人工智能搜索技术论文
  7. C语言冒泡排序代码示例
  8. Android网络编程之——文件断点下载(暂停/继续/重新下载)
  9. linux天气软件,桌面天气插件 Gis Weather 0.7.9
  10. 获取随机经纬度、经纬度范围
  11. 从谷歌搜索结果页中提取url与域名
  12. 以喷管雷诺数,当地大气压及射流有效温度计算所需质量流量,静温
  13. 审慎 合宜与慈善三种学派的分类与核心思想
  14. 怎样让照片变得更清晰,这几个方法真的好用!
  15. groupByKey与reduceByKey区别
  16. VSFTPD + NGINX
  17. html实现画板的基本操作,javascript实现画板功能
  18. 2019最新计算机毕业设计-题目汇总大全-系列4
  19. 感觉各种知道,问答,百科的真实性和可信性都被网络营销给搞坏了
  20. 这10本Python新书,推荐给你

热门文章

  1. java中定义类的关键字为_在Java中,定义类的关键字是__________________.
  2. aop springboot 传入参数_java相关:springboot配置aop切面日志打印过程解析
  3. 【FPGA】SRIO中的关键问题总结(一)SRIO中的关键数据包格式总结
  4. FPGA 控制 FLASH 之 Startup 原语使用相关链接
  5. Moore状态机和Mealy状态机的区别
  6. 《基于PLL分频计数的LED灯闪烁实例》实验记录
  7. 浅析FPGA时序相关问题
  8. ZStack源码剖析之核心库鉴赏——FlowChain
  9. 基于MSM 的tomcat session 共享
  10. 什么是ECS以及如何使用登陆