libstdc++.so? How?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
c0x
Member
Member
Posts: 26
Joined: Sun Apr 20, 2008 2:16 am

libstdc++.so? How?

Post 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
jnc100
Member
Member
Posts: 775
Joined: Mon Apr 09, 2007 12:10 pm
Location: London, UK
Contact:

Re: libstdc++.so? How?

Post 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.
c0x
Member
Member
Posts: 26
Joined: Sun Apr 20, 2008 2:16 am

Re: libstdc++.so? How?

Post 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 :)
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: libstdc++.so? How?

Post 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.
c0x
Member
Member
Posts: 26
Joined: Sun Apr 20, 2008 2:16 am

Re: libstdc++.so? How?

Post 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.
jnc100
Member
Member
Posts: 775
Joined: Mon Apr 09, 2007 12:10 pm
Location: London, UK
Contact:

Re: libstdc++.so? How?

Post 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.
User avatar
Jeko
Member
Member
Posts: 500
Joined: Fri Mar 17, 2006 12:00 am
Location: Napoli, Italy

Re: libstdc++.so? How?

Post 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?
Post Reply