“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. 电话号码以185****3547显示demo

    String phone="18678473547"; //String phones = phone.substring(0,phone.length()-(phone.subs ...

  2. AOP 动态织入的.NET实现

    AOP(面向切面编程:Aspect Oriented Programming)为诸如日志记录.性能统计.安全控制.事务处理.异常处理等与具体业务逻辑无关,却需要在全局范围进行执行的功能提供了一种良好重 ...

  3. [OpenCV Qt教程] 如何在内存中压缩图像

    本文译自:http://www.robot-home.it/blog/en/software/tutorial-opencv-qt-comprimere-un-immagine-in-memoria/ ...

  4. mysql数据库忘记密码时如何登录

    1.打开cmd命令提示符,进入上一步mysql.exe所在的文件夹即: 2.输入命令  mysqld --skip-grant-tables  回车,此时就跳过了mysql的用户验证 3.然后直接输入 ...

  5. php502故障处理

    一次打开网站,发现502,第一反应肯定是php-fpm没启动,尝试启动还是502. 1.首先查询Nginx日志发现如下连接PHP失败: 2016/07/29 15:56:04 [error] 2376 ...

  6. letter

    while (cin.eof() != true) //cin.eof判断是否到达文件EOF,如果读取到EOF return true,读取到EOF则无法再次输入 while (cin.fail() ...

  7. C# 鼠标穿透窗体与恢复

    转自原文 C# 鼠标穿透窗体与恢复 引入user32.dll [DllImport("user32.dll")] public static extern uint SetWind ...

  8. java byte to hex

    String str; byte[] bs = null; bs =str.getBytes(); bs =str.getBytes("utf-8") java  byte to ...

  9. GridhEH 选择勾CheckBox

    GridhEH 选择勾CheckBox Grideh>IndicatorOptions>gioShowRowSelCheckbox

  10. 设置Eclipse中的tab键为4个空格

    在工具栏上找到window,点击 window->preference 然后在打开的界面中选择 General->Editors->Text Editors, 再选中右侧的 inse ...