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
-
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
-
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 -
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
with32-bit
installed and no64-bit
installed -
Install
64-bit
glibc-devel:# yum install glibc-devel.x86_64
-
When finished, recompile the
64-bit
program, everything is ok!