Strange behaviour in GCC 2.95.3

Raúl Núñez de Arenas Coronado dervishd@linuxfreak.com
Tue Apr 3 06:01:00 GMT 2001


    Hello everybody :)

    I've found what I think is a somewhat strange behaviour in the C
compiler, GCC, version 2.95.3, arch i586-pc-gnu-linux.

    When compiling using the following command line:

    gcc -r -nostdlib -o foo foo.c -lgcc

    The answer I have is: `ld: cannot find -lgcc'. I know: with the
switch '-nostdlib' the standard library directories are not searched.
The matter is that this doesn't happen in the standard GCC
installation, that is, is not a bug, don't worry about it.

    I'll try to explain my problem: I have at home a kind of embedded
Linux distribution, and for some reasons I need it to have a
filesystem with a hierarchy as flat as possible and as small as
possible. I've achieved this by configuring by hand most of the
programs, and I've fit this distro in a very flat and small
hierarchy.

    Since a directory called '/usr/lib/gcc-lib/i586-pc-gnu-linux/2.95.3/...'
didn't fit on this filesystem, I decided to flat it. I cannot do it
by passing args to configure (is there any way to do that?), so I
decided to try to move all files to other locations and see the 'what
if' results. The result is that I have all the files in their
'proper' location (startup files in /usr/lib, headers in
/usr/include, binaries in /usr/bin, etc...), and all compiles OK,
except glibc.

    The reason is that gcc, when passed -nostdlib, still searchs the
directory called $(lib)/gcc-lib/$(target-arch)/$(version), and some
programs rely on this behaviour (glibc, for example). I think that if
'-nostdlib' is passed to gcc, the compiler shouldn't search for
library files only in location explicitly expressed through '-L'
switch. That way the caller is forced to provide the search
directories. I don't find the current behaviour correct. But it's
just an oppinion O:)

    I have asked for this issue in the past: gcc should provide a way
to install just ONE compiler version with an abbreviated install
path, so simpler hierarchies are supported.

    So many developers in the system where I develop and which I
admin have made the same question to me: why GCC has this strange
hierarchy?. I use to tell them that this is for supporting multiple
archs and versions of the compiler at the same time in the same
machine (for example, a file server), but I always think the same:
and, what happens when you have only one compiler?

    I know that this may violate the FHS, that I'm surely the only
user with this problem, etc... but it cannot be difficult to give the
user the option of flatting the GCC hierarchy. I've tried to hack the
Makefile, but I don't feel comfortable with that, because I'm not
sure about having fucked up something elsewhere in the compiler O:)

    Thanks a lot for GCC (I will never use other compiler), thanks a
lot for GNU project and thanks a lot for reading this. Please, take
into account my suggestion, at least a few minutes ;)))))

    Thanks again :)
    Raúl



More information about the Gcc-bugs mailing list