无法使用-m32使用gcc进行编译

时间:2017-06-01 10:56:00

标签: gcc

amar @ pc:/ local / mnt / workspace / amarn $ gcc -m32 a.c

/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
collect2: error: ld returned 1 exit status

amar @ pc:/ local / mnt / workspace / amarn $ cat a.c

#include <stdio.h>
 int
 main ()
 {
long z; 
printf("Long int size is %d bytes long!\n", sizeof(z));
   ;
   return 0;
 }

amarn @ hyd-tbsbld01:/ local / mnt / workspace / amarn $ uname -a

Linux mypc 4.4.0-78-generic #99-Ubuntu SMP Thu Apr 27 15:29:09 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

我为gcc做了以下更改。 gcc被映射到gcc-5。 我将gcc映射到gcc-4.8。

amar@mypc:/usr/bin$ ll | grep gcc
-rwxr-xr-x  1 root   root         428 May  7  2006 c89-gcc
-rwxr-xr-x  1 root   root         454 Apr 11  2011 c99-gcc
lrwxrwxrwx  1 root   root           7 Jun  1 11:54 gcc -> gcc-4.8
-rwxr-xr-x  1 root   root      776344 Jan 26  2016 gcc-4.8
-rwxr-xr-x  1 root   root      915736 Nov  3  2016 gcc-5
lrwxrwxrwx  1 root   root          10 Jun  1 11:55 gcc-ar -> gcc-ar-4.8
-rwxr-xr-x  1 root   root       27032 Jan 26  2016 gcc-ar-4.8
-rwxr-xr-x  1 root   root       31136 Nov  3  2016 gcc-ar-5
lrwxrwxrwx  1 root   root          10 Jun  1 11:56 gcc-nm -> gcc-nm-4.8
-rwxr-xr-x  1 root   root       27032 Jan 26  2016 gcc-nm-4.8
-rwxr-xr-x  1 root   root       31136 Nov  3  2016 gcc-nm-5
lrwxrwxrwx  1 root   root          14 Jun  1 11:56 gcc-ranlib -> gcc-ranlib-4.8
-rwxr-xr-x  1 root   root       27032 Jan 26  2016 gcc-ranlib-4.8
-rwxr-xr-x  1 root   root       31136 Nov  3  2016 gcc-ranlib-5
lrwxrwxrwx  1 root   root           7 Jun  1 12:32 x86_64-linux-gnu-gcc -> gcc-4.8
lrwxrwxrwx  1 root   root           7 Jan 26  2016 x86_64-linux-gnu-gcc-4.8 -> gcc-4.8
lrwxrwxrwx  1 root   root           5 Nov  3  2016 x86_64-linux-gnu-gcc-5 -> gcc-5
lrwxrwxrwx  1 root   root          10 Jun  1 12:34 x86_64-linux-gnu-gcc-ar -> gcc-ar-4.8
lrwxrwxrwx  1 root   root          10 Jan 26  2016 x86_64-linux-gnu-gcc-ar-4.8 -> gcc-ar-4.8
lrwxrwxrwx  1 root   root           8 Nov  3  2016 x86_64-linux-gnu-gcc-ar-5 -> gcc-ar-5
lrwxrwxrwx  1 root   root          10 Jun  1 12:34 x86_64-linux-gnu-gcc-nm -> gcc-nm-4.8
lrwxrwxrwx  1 root   root          10 Jan 26  2016 x86_64-linux-gnu-gcc-nm-4.8 -> gcc-nm-4.8
lrwxrwxrwx  1 root   root           8 Nov  3  2016 x86_64-linux-gnu-gcc-nm-5 -> gcc-nm-5
lrwxrwxrwx  1 root   root          14 Jun  1 12:35 x86_64-linux-gnu-gcc-ranlib -> gcc-ranlib-4.8
lrwxrwxrwx  1 root   root          14 Jan 26  2016 x86_64-linux-gnu-gcc-ranlib-4.8 -> gcc-ranlib-4.8
lrwxrwxrwx  1 root   root          12 Nov  3  2016 x86_64-linux-gnu-gcc-ranlib-5 -> gcc-ranlib-5

0 个答案:

没有答案