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

gcc-3.x and C programs with some C++ objects linked in


I'm having a bit of a problem here.  brltty is a C program,
but some of it's code is written in C++.  Until gcc-2.95 it
was perfectly possible to compile the .cc files with g++ into .o files,
and link the whole program with gcc into a binary which did not
dynamicly link against libstdc++.

In gcc-3.x, this appears to no longer work.  I tried compiling
the c++ code with -fno-exceptions, and link it together with gcc, but
I always get a bunch of unresolved symbols.

If I link with g++, it works, but I get a binary which looks like this:

lexx:~/tmp/c/brltty-3.1% ldd Programs/brltty
        libdl.so.2 => /lib/libdl.so.2 (0x4001e000)
        libstdc++-libc6.2-2.so.3 => /usr/lib/libstdc++-libc6.2-2.so.3 (0x40021000)
        libm.so.6 => /lib/libm.so.6 (0x4006a000)
        libc.so.6 => /lib/libc.so.6 (0x4008b000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

It used to be like this with gcc-2.95:

lexx:~/tmp/c/brltty-3.1% ldd /sbin/brltty
        libdl.so.2 => /lib/libdl.so.2 (0x4001e000)
        libm.so.6 => /lib/libm.so.6 (0x40021000)
        libc.so.6 => /lib/libc.so.6 (0x40042000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

Does anyone have an idea why this is no longer working, and if
there is a way to circumvent the problem?

P.S.: Why is this a problem?  Well, brltty needs to be started
very early at system startup.  All it's files are on the root
partition to make this more save.  But libstdc++,
ahem, is in /usr.  Besides that, d-i doesn't like C++ linked
code too.


Reply to: