libtool
[Top][All Lists]
Advanced

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

Re: shared libraries possible with old g++, g77?


From: Ralf Wildenhues
Subject: Re: shared libraries possible with old g++, g77?
Date: Mon, 26 May 2008 23:05:30 +0200
User-agent: Mutt/1.5.17+20080114 (2008-01-14)

Hi Ed,

I'm working my way through a mail backlog.

* Ed Hartnett wrote on Wed, May 14, 2008 at 03:00:58AM CEST:
> 
> I am the maintainer for a freeware scientific software library called
> netcdf. There are C, Fortran, and C++ libraries.

You're so cool in that you reintroduce yourself each time.  Not that I'd
need it because I don't forget names *that* quickly, but really I
appreciate it because it's just nice.  ;-)

> When building shared libraries with older versions of the tools, I get
> problems. gcc works fine, and I get a shared C library, but my fortran
> and C++ programs seg fault instead of working. For example:

Please state which Libtool version you're using.  If not a recent one,
then please update first and retry.  Then proceed as below.

> libtool: link: g++ -shared -o .libs/libnetcdf_c++.so.4  .libs/netcdf.o
> .libs/ncvalues.o
> -Wl,-blibpath:/opt/gnu/gcc/lib:/opt/gnu/bin/../lib/gcc-lib:/opt/gnu/gcc/lib/g\
> cc-lib/powerpc-ibm-aix5.0.0.0/3.2:/opt/gnu/gcc/lib/gcc-lib/powerpc-ibm-aix5.0.0.0/3.2/../../..:/usr/lib:/lib
> -L/opt/gnu/bin/../lib/gcc-lib -L/opt/gnu/gcc/lib/gcc-lib/p\
> owerpc-ibm-aix5.0.0.0/3.2
> -L/opt/gnu/gcc/lib/gcc-lib/powerpc-ibm-aix5.0.0.0/3.2/../../.. 
> -L/opt/gnu/gcc/lib
> -lstdc++ -L/machine/objgcc/powerpc-ibm-aix5.0.0.0/libstdc++\
> -v3/src
> -L/machine/objgcc/powerpc-ibm-aix5.0.0.0/libstdc++-v3/src/.libs
> -L/machine/objgcc/gcc -lm -lc -lgcc_s -Wl,-bnoentry
> -Wl,-bE:.libs/libnetcdf_c++.exp -Wl,-ber\
> ok
> ld: 0711-415 WARNING: Symbol _GLOBAL__I__ZN6NcFileD2Ev is already
> exported.
> ld: 0711-415 WARNING: Symbol _GLOBAL__D__ZN6NcFileD2Ev is already
> exported.
> ld: 0711-415 WARNING: Symbol _GLOBAL__F__ZN6NcFileD2Ev is already
> exported.
> ld: 0711-415 WARNING: Symbol _GLOBAL__I__ZN8NcValuesC2Ev is already
> exported.
> ld: 0711-415 WARNING: Symbol _GLOBAL__D__ZN8NcValuesC2Ev is already
> exported.
> ld: 0711-415 WARNING: Symbol _GLOBAL__F__ZN8NcValuesC2Ev is already
> exported.

These warnings look fishy; apparently GCC changed the naming of the C++
helper symbol format at some point in the past.  Please go into the
directory where this link happens.  Post
  ../libtool --tag=CXX --config

Then edit the ../libtool script, find each of the several lines matching
  ^exclude_expsyms=

they more or less all look like
  exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"

Edit them to each contain
  exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__[FID]_.*"

then remove libnetcdf_c++.la and rebuild your package with
  cd .. && make

Re-test.  If that did not help, then proceed as further below.

> libtool: link: ar cru .libs/libnetcdf_c++.a .libs/libnetcdf_c++.so.4
> libtool: link: ( cd ".libs" && rm -f "libnetcdf_c++.la" && ln -s
> "../libnetcdf_c++.la" "libnetcdf_c++.la" )
>         make  nctst tst_failure
>         depbase=`echo nctst.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`; g++
>         -DHAVE_CONFIG_H -I. -I.. -I../fortran        -I../libsrc   -g
>         -O2 -MT nctst.o -MD -MP -MF $depba\
> se.Tpo -c -o nctst.o nctst.cpp && mv -f $depbase.Tpo $depbase.Po
>         /bin/sh ../libtool --tag=CXX    --mode=link g++  -g -O2
>         -o nctst nctst.o ../cxx/libnetcdf_c++.la
>         ../libsrc/libnetcdf.la
> libtool: link: g++ -g -O2 -o .libs/nctst nctst.o  -L../cxx/.libs
> -lnetcdf_c++ -L/machine/objgcc/powerpc-ibm-aix5.0.0.0/libstdc++-v3/src
> -L/machine/objgcc/powerpc-ibm-a\
> ix5.0.0.0/libstdc++-v3/src/.libs -L/machine/objgcc/gcc
> -L/opt/gnu/gcc/lib -lstdc++ -lm -lc -lgcc_s -L../libsrc/.libs -lnetcdf
> -Wl,-blibpath:/usr/local/lib:/opt/gnu/gcc\
> /lib:/opt/gnu/bin/../lib/gcc-lib:/opt/gnu/gcc/lib/gcc-lib/powerpc-ibm-aix5.0.0.0/3.2:/opt/gnu/gcc/lib/gcc-lib/powerpc-ibm-aix5.0.0.0/3.2/../../..:/usr/lib:/lib
>         depbase=`echo tst_failure.o | sed
>         's|[^/]*$|.deps/&|;s|\.o$||'`; g++ -DHAVE_CONFIG_H
>         -I. -I.. -I../fortran        -I../libsrc   -g -O2 -MT
>         tst_failure.o -MD -M\
> P -MF $depbase.Tpo -c -o tst_failure.o tst_failure.cpp && mv -f
> $depbase.Tpo $depbase.Po
>         /bin/sh ../libtool --tag=CXX    --mode=link g++  -g -O2
>         -o tst_failure tst_failure.o ../cxx/libnetcdf_c++.la
>         ../libsrc/libnetcdf.la
> libtool: link: g++ -g -O2 -o .libs/tst_failure tst_failure.o
> -L../cxx/.libs -lnetcdf_c++
> -L/machine/objgcc/powerpc-ibm-aix5.0.0.0/libstdc++-v3/src
> -L/machine/objgcc/p\
> owerpc-ibm-aix5.0.0.0/libstdc++-v3/src/.libs -L/machine/objgcc/gcc
> -L/opt/gnu/gcc/lib -lstdc++ -lm -lc -lgcc_s -L../libsrc/.libs -lnetcdf
> -Wl,-blibpath:/usr/local/lib:\
> /opt/gnu/gcc/lib:/opt/gnu/bin/../lib/gcc-lib:/opt/gnu/gcc/lib/gcc-lib/powerpc-ibm-aix5.0.0.0/3.2:/opt/gnu/gcc/lib/gcc-lib/powerpc-ibm-aix5.0.0.0/3.2/../../..:/usr/lib:\
> /lib
>         make  check-TESTS
> *** Testing C++ API with 2 different netCDF formats.
> /bin/sh: 14312 Segmentation fault(coredump)

> Is this expected? Or should I be able to build shared libraries with
> version 3.2 of g++ and g77?

I'd say in principle things should work.  Can you try to debug the
segfault, i.e., post a stack trace or so?  Can you post the URL of a
source tarball that exposes this issue?  I just may have the chance of
being able to reproduce this myself.

Cheers,
Ralf




reply via email to

[Prev in Thread] Current Thread [Next in Thread]