Page 1 of 1

libstdc++.so? How?

Posted: Fri Jun 20, 2008 12:30 pm
by c0x
Hi!

I've built a native GCC successfully to my OS. It works without problems.

Now i decided to add support for C++ as well. I just changed the --enable-languages configure parameter from "c" to "c,c++" when i'm compiling the native GCC. All the stuff compiled without errors and the g++ works well on my OS. After compiling a simple hello world i just noticed that g++ uses the static version of libstdc++ instead of the shared version. My OS supports 32bit ELF shared libraries and they're OK with the previously mentioned native GCC.

I just checked the configure output from the libstdc++-v3 directory and i saw the following:

Code: Select all

checking if libtool supports shared libraries... no
checking whether to build shared libraries... no
checking whether to build static libraries... yes
The full configure line that i'm using is the following:

Code: Select all

./configure --prefix=YYY --target=XXX --host=XXX --build=i686-pc-linux-gnu --enable-languages=c,c++ --disable-nls
I'm not using the "--enable-shared" option for configure because as i saw from its help, "--enable-shared" is the default :)

What should I do/change to build the shared version of libstdc++ as well?

c0x

Re: libstdc++.so? How?

Posted: Fri Jun 20, 2008 3:09 pm
by jnc100
Hmm, sounds like libtool is not recognising your os as one that supports shared libraries? Have you managed to get other shared libraries to compile via libtool or are you manually passing the relevant options to gcc/ld?

Regards,
John.

Re: libstdc++.so? How?

Posted: Fri Jun 20, 2008 3:20 pm
by c0x
jnc100 wrote:Have you managed to get other shared libraries to compile via libtool or are you manually passing the relevant options to gcc/ld?
I'm using my own Makefiles with custom CFLAGS to build my shared libraries, so no, i'm not using libtool :)

Re: libstdc++.so? How?

Posted: Sat Jun 21, 2008 3:44 am
by JamesM
I would look in the config.log. Autoconf runs test programs to check for most things, it'll tell you the test program and why it failed in there.

Re: libstdc++.so? How?

Posted: Sat Jun 21, 2008 6:07 am
by c0x
JamesM wrote:I would look in the config.log. Autoconf runs test programs to check for most things, it'll tell you the test program and why it failed in there.
I just checked config.log in libstdc++-v3 directory but i didn't see too much "shared" or "libtool" related stuff in it.

When i searched for "shared" string i found the following line:

Code: Select all

enable_shared='yes'
So for me this means that shared support may be enabled.

I also tried to search for "libtool" and I found two lines that doesn't help either.

Re: libstdc++.so? How?

Posted: Sun Jun 22, 2008 11:53 pm
by jnc100
Hmm, what is the name of the target you're trying to compile for? I still believe the reason its not using shared libraries is because libtool doesn't recognise your target as one that supports shared libraries (I think the build system only generates shared libraries by default on systems that support it). The gcc documentation for porting libtool is woefully inadequate, but there's a slightly more helpful page on getting it to work with osx here (check the contents of the patch file).

Regards,
John.

Re: libstdc++.so? How?

Posted: Mon Jun 23, 2008 3:16 am
by Jeko
c0x wrote:My OS supports 32bit ELF shared libraries and they're OK with the previously mentioned native GCC.
Can you share source code of shared libraries handling?