This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

strange gcc behavior (not sure if it's a bug)


hello gcc wozards,

my apologies for not posting this to the gcc bug database, but i'm
really not sure if this is a bug or me being stupid. this is output
from a freebsd 4.8 machine with gcc 3.3.2 and binutils 2.14. gcc
was configured with --disable-nls --prefix=/usr/local/test
--with-as=/usr/local/test/bin/as --with-ld=/usr/local/test/bin/ld.

stitch:~ > cat hello.cpp
#include <cstdio>
int main(void) {
	printf("Hello World!\n");
}
stitch:~ > g++ hello.cpp -o hello
stitch:~ > ldd hello
hello:
        libstdc++.so.5 => not found (0x0)
        libm.so.2 => /usr/lib/libm.so.2 (0x28066000)
        libgcc_s.so.1 => not found (0x0)
        libc.so.4 => /usr/lib/libc.so.4 (0x28081000)

no surprise. if i set an LD_RUN_PATH or use rpath to point to the
location of the gcc libraries, I get this:

stitch:~ > setenv LD_RUN_PATH /usr/local/test/lib
stitch:~ > g++ hello.cpp -o hello
stitch:~ > ldd hello
hello:
        libstdc++.so.5 => /usr/local/test/lib/libstdc++.so.5 (0x28066000)
        libm.so.2 => /usr/lib/libm.so.2 (0x280d2000)
        libgcc_s.so.1 => /usr/local/test/lib/libgcc_s.so.1 (0x280ed000)
        libc.so.4 => /usr/lib/libc.so.4 (0x280f4000)
        libgcc_s.so.1 => not found (0x0)

why is libgcc_s both found and not found? i have never seen this
before, on any platform. the only way i can get hello to find all
of its libraries is to use an LD_LIBRARY_PATH:

stitch:~ > setenv LD_LIBRARY_PATH /usr/local/test/lib
stitch:~ > ldd hello
hello:
        libstdc++.so.5 => /usr/local/test/lib/libstdc++.so.5 (0x28066000)
        libm.so.2 => /usr/lib/libm.so.2 (0x280d2000)
        libgcc_s.so.1 => /usr/local/test/lib/libgcc_s.so.1 (0x280ed000)
        libc.so.4 => /usr/lib/libc.so.4 (0x280f4000)

i can't duplicate this behavior on red hat linux, solaris 8 and 9,
and osf, but i get this consistently on freebsd 4.7 and 4.8. is
there something quirky about freebsd that i'm not aware of?

thanks in advance,

Jesse


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]