“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. android.support.v4.app.Fragment vs android.app.Fragment 的区别

    android.support.v4.app.Fragment vs android.app.Fragment 的区别 我开过平板相关应用,用了Fragment来处理.后来重新开发另外一个应用,直接引 ...

  2. angularJS开发时用到的命令

    node --version && npm --version 查看nodejs版本号和npm版本号 yo --version && bower --version & ...

  3. 优化笔记:jsyhjkzqxx_D_20140916.gz

    有几张表没有权限,所以跑不起来. 目测黄色部分比较坑爹,死了n多脑细胞才看懂,又死了n多脑细胞才改出来.对5034进行了2次扫描,并多次分组排序求和.(分组和排序算法相对来说比较耗性能) 改为只扫描一 ...

  4. 数据库设计不推荐使用Bool类型

    参见博文:http://blog.csdn.net/zhang_xinxiu/article/details/8521673

  5. 常见的HTTP Header

    文件信息: Content-Type: application/x-javascript Content-Length: 2000 Content-Type:指定请求和响应的内容类型,如果未指定即为t ...

  6. nginx代理socket tcp/udp

    准备一台linux服务器.nginx官网:http://nginx.org/ .在网上搜到大致用的是 ngx_stream_core_module 这个模块,这里你也可以关注一下官方文档中的其他模块都 ...

  7. 一个简单的异常/条件重试类(C#)

    单个类,简单好用 using System; using System.Linq.Expressions; using System.Threading; using System.Threading ...

  8. 使用ssh client与bash scripts轻松管理多台主机

    当我们需要控制一个局域网中的很多台服务器时,一个简单的全局操作可能会被放大地异常繁琐,这时我们就会需要新的工具来快速完成这种工作. 我们将使用ssh客户端提供的一些工具来快速完成这一开发工作,我们的开 ...

  9. e8000051

    Unable to install package (e8000051). Please check used certificate validity and provisioning.. Unab ...

  10. C++Primer笔记-----day02

    ====================================================================day02=========================== ...