newbie questions about using libsdtc++

Byron Amerson byronea@u.washington.edu
Mon Dec 8 18:00:00 GMT 2003


Hello There,

I am new to the list and pretty much a unix newbie also.  I have several
questions related to libstdc++ and shared libs in general.  If I can
report a bit on why I am even writing to this list in the first place it
will give my questions some context - I will keep to the salient bits.

I am on a mac w/ osx10.3.1 & mac's gcc3.3. I also have fink installed.

libstdc++ is required by geos & postgis for use with postgresql.  That is,
geos and postgis require postgresql to be built linked against libstdc++.
>From the postgis readme:

  In order to use the GEOS support, you *must* specially compile
  your version of PostgreSQL to link the C++ runtime library.
  To do this, invoke the PgSQL configuration script this way:

  LDFLAGS=-lstdc++ ./configure --your-options-go-here

  The initial LDFLAGS variable is passed through to the Makefile and
  adds the C++ library to the linking stage.

also:

...This is a workaround for bogus C++ exceptions interaction with older
development tools. If you experience weird problems (backend unexpectedly
closed or similar things) try that...

So, I built as directed and things went smoothly until it came time to add
the postgis bits to a database. It did not work with complaints of not
being able to link against postgis shared libs.

After some emails to the postgis list, and snooping on my box, it turns
out that mac's gcc does not include shared libs for libstdc++, only static
libs, and that postgesql's configure/make process is not actually linking
to any libstdc++ libs.

I thought I could build 'em myself and move them into /usr/lib where mac
keeps the others, and go from there.  Or not.

Following the excellent documentation included with gcc and libstdc++ I
did the following:

tectonic% sudo ../gcc-3.3.2/configure --prefix=/usr/local/gcc-3.3.2
--enable-shared=libstdc++ --enable-languages=c++

tectonic% sudo make all-target-libstdc++-v3

tectonic% sudo make install

resulting in these libs:

charset.alias   libiberty.a     libstdc++.la    libsupc++.la
gcc-lib         libstdc++.a     libsupc++.a     soft-float

I expected to see some with a .so extension because I enabled shared libs.
I understand that libtool creates the extension .la, and also is used to
link libraries (dynamically?) at runtime.

OK, now for the questions:

1.  What is the hey is runtime?
2.  Can one build libs or other bits in one directory and then simply
move(i.e. cp) them to directories that will be referenced by programs that
want to build against them? Or must they be built in situ?
3.  If indeed question 2 is true and/or the libs with the .la extensions
are the shared libs I need, how do I use libtool to get postgresql to
build against these shared libs?  The documentation for libtool is beyond
my novice/goober level of understanding.  It seems that libtool is used to
set up config and makefiles for distribution.  Can one use libtool any
time to link against static or shared libs before or as one configures a
program of interest?
4.  Where can I read more about ld and shared libs in general?  The
admonishment in the libstdc++ documentation to "Be certain that you
understand all of the other implications and behavior of LD_LIBRARY_PATH
first" goes over my head.  I understand that this is about setting a flag
for use with configure, but that's about it. Mac has no manpage for ld and
ld --help is no help.

Thanks to anyone who takes on my novie question and inqueries.  Cheers!

Byron Amerson
MS student
University of Washington
Department of Earth and Space Sciences



More information about the Libstdc++ mailing list