Re: building gcc 4.4.5 from source on Fedora 13

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> [zeek@test1 t]$ gcc -o hello -m32 hello.c
> [zeek@test1 t]$ file hello
> hello: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped
>
> That's OK, though when I execute this:
>
> 1.
> [zeek@test1 t]$ gcc -o hello -march=i686 hello.c
> hello.c:1: error: CPU you selected does not support x86-64 instruction set

You need to use -m32 otherwise you're asking for a 64-bit program
using the i686 instruction set, which is impossible.

> 2.
> [zeek@test1 t]$ gcc -o hello -march=pentium2 hello.c
> hello.c:1: error: CPU you selected does not support x86-64 instruction set
> hello.c:1: error: CPU you selected does not support x86-64 instruction set

Ditto

> 3.
> [zeek@test1 t]$ gcc -o hello -march=pentium2 --32 hello.c
> cc1: error: unrecognized command line option "-f32"
> hello.c:1: error: CPU you selected does not support x86-64 instruction set
> hello.c:1: error: CPU you selected does not support x86-64 instruction set

Ditto.  --32 is not a valid GCC option.

> 4.
> [zeek@test1 t]$ gcc -o hello -march=pentium4 -m32 hello.c

Bingo.

> [zeek@test1 t]$ file hello
> hello: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped
>
> For the last statement I was expecting the CPU to be Pentium 4 (i686) and not "Intel 80386".

Your expectation is wrong, file(1) does not examine all instructions
in the executable to determine the minimum supported architecture.  It
only tells you it's an x86 file (as opposed to x86_64, sparc, arm or
something else.

>>You shouldn't get any errors. Are you sure all the dependencies are
>>installed?
>>
>> sudo yum-builddep gcc
>
> I had to *manually* install glibc.i686 and glibc-devel.i686 - these packages should have been picked up as a dependencies automatically by Fedora - they were NOT!

Talk to Fedora about that, this list is for gcc help.

> When I successfully compiled the whole GCC package (see below) the above 2 packages were not compiled/built either!

Right, glibc is a separate package to GCC, so isn't built as part of GCC.

> None of the rpm or manual built of GCC picked the dependency on libgcc.i686 either (executing yum-builddep gcc-4.4.5-2.fc13.src.rpm lists all the dependencies EXCEPT for libgcc.i686).

Again, talk to Fedora.

> There is another problem though -
>
> [root@test1 ~]# ls -las /usr/lib/gcc/x86_64-redhat-linux/4.4.4/32/
> total 3464
>  4 drwxr-xr-x. 2 root root    4096 Nov 26 23:40 .
>  4 drwxr-xr-x. 4 root root    4096 Nov 26 23:40 ..
>  4 -rw-r--r--. 1 root root    1740 Nov 26 20:46 crtbegin.o
>  4 -rw-r--r--. 1 root root    2164 Nov 26 20:46 crtbeginS.o
>  4 -rw-r--r--. 1 root root    2048 Nov 26 20:46 crtbeginT.o
>  4 -rw-r--r--. 1 root root    1312 Nov 26 20:46 crtend.o
>  4 -rw-r--r--. 1 root root    1568 Nov 26 20:46 crtendS.o
>  4 -rw-r--r--. 1 root root    4088 Nov 26 20:46 crtfastmath.o
>  4 -rw-r--r--. 1 root root    2100 Nov 26 20:46 crtprec32.o
>  4 -rw-r--r--. 1 root root    2108 Nov 26 20:46 crtprec64.o
>  4 -rw-r--r--. 1 root root    2100 Nov 26 20:46 crtprec80.o
> 3236 -rw-r--r--. 1 root root 3311740 Nov 26 20:46 libgcc.a
>  48 -rw-r--r--. 1 root root   45148 Nov 26 20:46 libgcc_eh.a
>  0 lrwxrwxrwx. 1 root root      18 Nov 26 23:40 libgcc_s.so -> /lib/libgcc_s.so.1
>  36 -rw-r--r--. 1 root root   33982 Nov 26 20:46 libgcov.a
>  92 -rw-r--r--. 1 root root   92262 Nov 26 20:46 libgomp.a
> -->-----
>  0 lrwxrwxrwx. 1 root root      28 Nov 26 23:40 libgomp.so -> ../../../../libgomp.so.1.0.0
>  0 lrwxrwxrwx. 1 root root      45 Nov 26 23:40 libmudflap.a -> ../../../i686-redhat-linux/4.4.5/libmudflap.a
> ---<-----
>  4 -rw-r--r--. 1 root root      39 Nov 26 20:46 libmudflap.so
> -->-----
>  0 lrwxrwxrwx. 1 root root      47 Nov 26 23:40 libmudflapth.a -> ../../../i686-redhat-linux/4.4.5/libmudflapth.a
> ---<-----
>  4 -rw-r--r--. 1 root root      41 Nov 26 20:46 libmudflapth.so
> -->-----
>  0 lrwxrwxrwx. 1 root root      44 Nov 26 23:40 libstdc++.a -> ../../../i686-redhat-linux/4.4.5/libstdc++.a
>  0 lrwxrwxrwx. 1 root root      31 Nov 26 23:40 libstdc++.so -> ../../../../libstdc++.so.6.0.13
>  0 lrwxrwxrwx. 1 root root      44 Nov 26 23:40 libsupc++.a -> ../../../i686-redhat-linux/4.4.5/libsupc++.a
> ---<-----
>
> The symlinks above (with the exception of libgcc_s.so.1 which is OK once I MANUALLY install libgcc.i686) are all DEAD - none of these files are installed by gcc or any other package, nor are they picked up as a required dependency. I do not think that's right.

Those files come from glibc, specifically the glibc-devel.i686 package.

> Oh, and don't start me on the gcc.spec file itself - I haven't seen so badly organised spec file for quite a while (and I am in IT for more than 17 years): whoever was involved in creating this file  should stop sniffing glue!

This has nothing to do with GCC, the spec file for the gcc package in
Fedora is written by Fedora people.

> For starters who's bright spark's idea was it that I would definitely NEED ada or GCC-Java installed/built by default, occupying/wasting an additional couple of megabytes (not to mention the compile time needed to build these - GCC-Java in particular)? Unless I manually edit and disable the ada and gcc-java stuff there is no way this is not getting compiled.

That was someone at Fedora's idea.  When they use the spec file they
want it to build those components so they can ship the relevant
packages.  If you don't want all of them, edit the spec file.

> Not to mention the fact that 2/3 of the time needed to build the GCC package is wasted on running the tests (that is 2 hours WASTED on my x86_64 machine!) - again, without an easy option to disable these (the only way I can do that is to find and comment the lines in the gcc.spec file where these tests get executed - absolute madness!).

Talk to Fedora about that too.

> Now, for the reason why the compilation failed (and why I created this thread) - as I was using one shell instance and have experimented quite a bit before deciding to manually try and build GCC I have wrongly inserted ARCH=i386 environment variable (and forgot about it) so I presume that is why everything was falling apart.

Don't do that then ;-)

IIRC the Fedora spec file is quite specific to the use-case of
building all GCC packages, for the Fedora distro.  It possibly assumes
that to build the i686 packages you will build on i686, which might be
why the 32bit glibc packages aren't listed as build dependencies.  In
any case, this list is the wrong place to report problems with it.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux