64-bit Linux Compiling Program Error:could not read symbols: File in wrong format

When compiling a 64-bit program on a Centos 6.5 64-bit machine, I get an error:

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

You can see that the compiler corresponds to the 32-bit lib directory

Try to solve

  1. Check the crt1.o file format:

    # 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

    is 32-bit

  2. Check the package of crt1.o file belong to :

    # rpm -qf /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../crt1.o
    glibc-devel-2.12-1.212.el6.i686

    belonging to 32-bit Glibc-devel package

  3. Check the installation of glibc-devel

    # yum list glibc-devel
    Loaded plugins: fastestmirror, refresh-packagekit, security
    Loading mirror speeds from cached hostfile
    * base: mirrors.aliyun.com
    * extras: mirrors.aliyun.com
    * updates: mirrors.huaweicloud.com
    Installed Packages
    glibc-devel.i686                2.12-1.212.el6             @base
    Available Packages
    glibc-devel.i686                2.12-1.212.el6_10.3        updates
    glibc-devel.x86_64              2.12-1.212.el6_10.3        updates

    As you can see, glibc-devel with 32-bit installed and no 64-bit installed

  4. Install 64-bit glibc-devel:

    # yum install glibc-devel.x86_64
  5. When finished, recompile the 64-bit program, everything is ok!

0 0 votes
Article Rating
赞(0) 打赏
未经允许不得转载:iemblog » 64-bit Linux Compiling Program Error:could not read symbols: File in wrong format
Subscribe
Notify of
guest

0 COMMENTS
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
免责声明:本站大部分下载资源收集于网络,只做学习和交流使用,版权归原作者所有,请在下载后24小时之内自觉删除,若作商业用途,请购买正版,由于未及时购买和付费发生的侵权行为,与本站无关。本站发布的内容若侵犯到您的权益,请联系站长删除,我们将及时处理! Disclaimer: Most of the download resources on this site are collected on the Internet, and are only used for learning and communication. The copyright belongs to the original author. Please consciously delete within 24 hours after downloading. If you use it for commercial purposes, please purchase the original version. If the content posted on this site violates your rights, please contact us to delete it, and we will deal with it in time!

联系我们 Contact us

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏

0
Would love your thoughts, please comment.x
()
x