“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

“undefined reference to JNI_GetCreatedJavaVM”和“File format not recognized”错误原因分析的更多相关文章

  1. “undefined JNI_GetCreatedJavaVM”和“File format not recognized”错误原因分析

    如果编译时,报如下所示错误:../../third-party/hadoop/lib/libhdfs.a(jni_helper.c.o): In function `getGlobalJNIEnv': ...

  2. could not read symbols: File format not recognized

    arm-linux-gnueabi-readelf工具解决问题 编译一个32位平台的内核时,出现如下错误提示: libschw.a: could not read symbols: File form ...

  3. pandas.read_csv() 报错 OSError: Initializing from file failed,报错原因分析和解决方法

    今天调用pandas读取csv文件时,突然报错“ OSError: Initializing from file failed ”,我是有点奇怪的,以前用的好好的,read_csv(path)方法不是 ...

  4. "undefined reference to" 问题解决方法 -链接问题

    最近在Linux下编程发现一个诡异的现象,就是在链接一个静态库的时候总是报错,类似下面这样的错误: (.text+0x13): undefined reference to `func' 关于unde ...

  5. [转]undefined reference问题总结

    转自http://ticktick.blog.51cto.com/823160/431329 最近在Linux下编程发现一个诡异的现象,就是在链接一个静态库的时候总是报错,类似下面这样的错误: (.t ...

  6. "undefined reference to" 问题解决方法

    近期在Linux下编程发现一个诡异的现象,就是在链接一个静态库的时候总是报错,类似以下这种错误: (.text+0x13): undefined reference to `func' 关于undef ...

  7. undefined reference to `_sbrk', `_write', `_lseek', `_read'

    现象: 在用GCC编译嵌入式MCU程序时,由于使用了第三方的库,出现了类似undefined reference to `_sbrk', `_write', `_lseek', `_read'的连接错 ...

  8. Qt错误:类中使用Q_OBJECT宏导致undefined reference to vtable for "xxx::xxx"错误的原因和解决方法

    在进行Qt编程的时候,有时候会将类的定义和实现都写在源文件中,如果同时在该类中使用信号/槽,那么可能就会遇到 undefined reference to vtable for "xxx:: ...

  9. undefined reference 问题各种情况分析

    扒自网友文章 关于undefined reference这样的问题,大家其实经常会遇到,在此,我以详细地示例给出常见错误的各种原因以及解决方法,希望对初学者有所帮助. 1.  链接时缺失了相关目标文件 ...

随机推荐

  1. 缓存varnish的管理及配置详解

    一 工作原理 在当前主流的Web服务架构体系中,Cache担任着越来越重要的作用.常见的基于浏览器的C/S架构,Web Cache更是节约服务器资源的关键.而最近几年由FreeBSD创始人之一Kamp ...

  2. 查询oracle安装过补丁没有

    [oracle@root ~]$ opatch lsinventoryInvoking OPatch 10.2.0.1.0 Oracle interim Patch Installer version ...

  3. kafka 高可靠

    1.集群高可靠 ①搭建kafka集群(略) ②重点配置项(每个broker配置相同,只有broker.id不一样) broker.id=1     当前机器在集群中的唯一标识,和zookeeper的m ...

  4. Nginx压力测试工具之WebBench

    Nginx压力测试工具之WebBench   在Apache中有自带的ab命令可以测试服务的压力,而nginx没有自带的命令,必须要采用第三方软件来测试,今天就简单介绍一下webbench对nginx ...

  5. Mongo db change datadir

    To change the location used by MongoDB to store its data, you need to: Edit /etc/mongodb.conf and ch ...

  6. linux tcp调优

    Linux TCP Performance Tuning News Linux Performance Tuning Recommended Books Recommended Links Linux ...

  7. 检测客户端系统-PHP

    if(isset($_SERVER['HTTP_USER_AGENT'])) { $userAgent = strtolower($_SERVER['HTTP_USER_AGENT']); $clie ...

  8. Python实践练习目录

    缘由 做中学才是最好的方法,通过这些项目来加强自己的Python掌握程度. 原则 成体系地学,不搞"题海战术" 通所有不如精一物,精一物方可通所有 走心学,忌浮躁 项目列表 字符串 ...

  9. Visual Studio 进行Excel相关开发,Microsoft.Office.Interop.Excel.dll库

    1. Interop.Excel.dll 的查找 本文中将 Microsoft.Office.Interop.Excel.dll库简称为Interop.Excel.dll库 其实在使用Visual S ...

  10. 常用经典SQL语句大全完整版--详解+实例 (存)

    常用经典SQL语句大全完整版--详解+实例 转 傻豆儿的博客 http://blog.sina.com.cn/shadou2012  http://blog.sina.com.cn/s/blog_84 ...