今天在某台64位LInux下编译一个简单的hello world的C程序,报错:

/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../crt1.o: could not read symbols: File in wrong format

查看该文件的格式,竟然是32位的:

# file /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../crt1.o
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../crt1.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.18, not stripped

查看glibc-devel版本:

# yum info glibc-devel
Installed Packages
Name : glibc-devel
Arch : i686
Version : 2.12
Release : 1.149.el6_6.5
Size : 955 k
Repo : installed
From repo : 6ASU5-updates
Summary : Object files for development using standard C libraries.
URL : http://sources.redhat.com/glibc/
License : LGPLv2+ and LGPLv2+ with exceptions and GPLv2+
Description : The glibc-devel package contains the object files necessary
: for developing programs which use the standard C libraries (which are
: used by nearly all programs). If you are developing programs which
: will use the standard C libraries, your system needs to have these
: standard object files available in order to create the
: executables.
:
: Install glibc-devel if you are going to develop programs which will
: use the standard C libraries. Available Packages
Name : glibc-devel
Arch : x86_64
Version : 2.12
Release : 1.149.el6_6.5
Size : 983 k
Repo : 6ASU5-updates
Summary : Object files for development using standard C libraries.
URL : http://sources.redhat.com/glibc/
License : LGPLv2+ and LGPLv2+ with exceptions and GPLv2+
Description : The glibc-devel package contains the object files necessary
: for developing programs which use the standard C libraries (which are
: used by nearly all programs). If you are developing programs which
: will use the standard C libraries, your system needs to have these
: standard object files available in order to create the
: executables.
:
: Install glibc-devel if you are going to develop programs which will
: use the standard C libraries.

在其他正常的64位机器上,发现是有/usr/lib64/crt1.o文件的,而问题机器却没有改文件,只有/usr/lib/crt1.o文件。

询问牛人,牛人用了以下命令查看正常机器上的crt1.o文件:

# rpm -qf /usr/lib64/crt1.o
glibc-devel-2.12-1.149.el6_6.5.x86_64

原来是问题机器只安装了glibc-devel.i686,没有安装glibc-devel.x86_64,用yum安装即可:

yum install glibc-devel.x86_64

安装成功后,一切正常!!!

64位Linux编译C代码,crt1.o文件格式不对的问题的更多相关文章

  1. 关于64位Linux编译hadoop2

    Apache官方提供hadoop2的安装包是在32位机器下编译的,生产环境一般使用64的Linux,那么需要在64位机器下重新编译可以查看hadoop-2.2.0-src下的BUILDING.txtB ...

  2. 64位linux编译32位程序

    昨天接到的任务,编译64位和32位两个版本的.so动态库给其他部门,我的ubuntu虚拟机是64位的,编译32位时遇到了问题: /usr/bin/ld: cannot find -lstdc++ 最后 ...

  3. 64位Linux编译hadoop-2.5.1

    Apache Hadoop生态系统安装包下载地址:http://archive.apache.org/dist/ 软件安装目录:~/app jdk: jdk-7u45-linux-x64.rpm ha ...

  4. 在64位linux下编译32位程序

    在64位linux下编译32位程序 http://blog.csdn.net/xsckernel/article/details/38045783

  5. linux下hadoop2.6.1源码64位的编译

    linux下hadoop2.6.1源码64位的编译 一. 前言 Apache官网上提供的hadoop本地库是32位的,如果我们的Linux服务器是64位的话,就会现问题.我们在64位服务器执行Hado ...

  6. MiniCRT 64位 linux 系统移植记录:64位gcc的几点注意

    32位未修改源码与修改版的代码下载: git clone git@github.com:youzhonghui/MiniCRT.git MiniCRT 64位 linux 系统移植记录 MiniCRT ...

  7. /usr/local/lib/libz.a: could not read symbols: Bad value(64 位 Linux)

    /usr/local/lib/libz.a: could not read symbols: Bad value(64 位 Linux) /usr/bin/ld: /usr/local/lib/lib ...

  8. 64位linux报错Could not initialize class java.awt.image.BufferedImage

    最近碰到一个问题: 64位linux报错Could not initialize class java.awt.image.BufferedImage 在WIN平台下运行正常BufferedImage ...

  9. class文件无论是32位还是64位jdk编译出来的,都可以通用

    class文件无论是32位还是64位jdk编译出来的,都可以通用 学习了:https://blog.csdn.net/z3111001358/article/details/53364066 java ...

随机推荐

  1. TZ_16_Vue的v-model和v-on

    1.v-model是双向绑定,视图(View)和模型(Model)之间会互相影响. 既然是双向绑定,一定是在视图中可以修改数据,这样就限定了视图的元素类型.目前v-model的可使用元素有: inpu ...

  2. textarea高度自动增高

    <!--随着textarea 输入内容 自动增加高度--> <script type="text/javascript"> $(".input_t ...

  3. How to class-dump iPad apps?

    http://stackoverflow.com/questions/4776593/how-to-class-dump-ipad-apps The issue here is that the bi ...

  4. LAMP环境搭建和配置(2)

    配置httpd 默认虚拟主机 编辑hpptd的主配置文件 搜索httpd-vhost,把行首的#号删除 保存主配置文件,然后编辑虚拟主机配置文件 重新编辑配置段(第一段为默认虚拟主机) ServerA ...

  5. spring boot 的 ApplicationContext 及 getbean

    在spring中,我们通过如下代码取得一个spring托管类: ApplicationContext ac = new FileSystemXmlApplicationContext("ap ...

  6. mybatis中使用包装对象

    在实际的应用中,很多时候我们需要的查询条件都是一个综合的查询条件,因此我们需要对已经存在的实体进行再一次的包装,以方便我们进行查询操作,于是包装对象的作用就很明显了,在这里我举一个简单的例子 1.首先 ...

  7. 让Drewtech的J2534 ToolBox 软件支持任何J2534的设备

    更改windows注册表中的FunctionLibrary和ConfigApplication,将DLL和exe路径替换原来的,其他不要动. 或者 create second key in regis ...

  8. 2019阿里云开年Hi购季基础云产品分会场全攻略!

    2019阿里云云上Hi购季活动已经于2月25日正式开启,从已开放的活动页面来看,活动分为三个阶段: 2月25日-3月04日的活动报名阶段.3月04日-3月16日的新购满返+5折抢购阶段.3月16日-3 ...

  9. Vue-- vue-preview(图片查看器)的使用步骤:

    vue-preview的使用步骤: )下载 )配置:找到配置文件加入: { test: /vue-preview.src.*?js$/, loader: 'babel-loader' }, 在处理ur ...

  10. html DOM(CSS放置位置的问题)

    转载自: http://www.php.cn/div-tutorial-386900.html (本文对读者有帮助的话请移步支持原作者) 笔记: 这样会先加载css的样式,在渲染dom的时候已经知道了 ...