V3: Problem on Solaris

Alexandre Oliva aoliva@redhat.com
Sun Nov 12 15:32:00 GMT 2000


On Nov 12, 2000, Mark Mitchell <mark@codesourcery.com> wrote:

> What goes wrong if we add `--tag CXX' to the CXXLINK command?  Well,
> we do use -shared, now, but we link in libstdc++, which doesn't exist
> yet.

> It's hard to say what the right thing is here.  I can't resist quoting
> the libtool manual:

>   The conclusion is that libtool is not ready for general use for C++
>   libraries.  You should avoid any global or static variable
>   initializations that would cause an "initializer element is not
>   constant" error if you compiled them with a standard C compiler.

> :-)

:-)

This quote pre-dates the development of the multi-language libtool,
which is the yet-to-be-released version of libtool that we're using
now.  Supporting C++ initializers is the very feature that triggered
the development of the multi-language libtool.

> Since libstdc++ assumes that it is being compiled with G++ already, it
> would seem that we could just have used g++ -shared, rather than the
> libtool bits, and maybe someday libstdc++ will be compiled with other
> compilers.

Unfortunately, it's not that simple.  Ask David Edelsohn, for one :-)

> In any case, we are where we are.  We could have a new libtool tag for
> "C++ without stanard libraries".

How about just adding `-Wl,-nodefaultlibs,-lgcc,-lc,-lgcc' to the
command line that links libstdc++.la?  Then, we can use --tag CXX, as
we should.

(`-Wl' will prevent libtool from checking whether libgcc and libc are
static libraries and falling back to a static-only version of
libstdc++ on platforms on which you can't link non-PIC code into a
shared library)

> I am favoring changing libtool's C configuration to use `gcc -shared'
> on Solaris

I don't know why libtool doesn't use gcc -shared on Solaris even when
the linker is GNU ld, but it must certainly have failed for someone,
at some time, otherwise libtool would use the default.  Unfortunately,
this change pre-dates my becoming one of the maintainers of libtool,
so I have no idea of why it was done :-(

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me


More information about the Gcc-bugs mailing list