libtool
[Top][All Lists]
Advanced

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

Re: is this a correct use for convenience libraries?


From: Ralf Wildenhues
Subject: Re: is this a correct use for convenience libraries?
Date: Thu, 9 Jun 2005 13:31:56 +0200
User-agent: Mutt/1.4.1i

Hi Ed,

* Ed Hartnett wrote on Tue, Jun 07, 2005 at 05:07:40PM CEST:
> Ralf Wildenhues <address@hidden> writes:
> > * Ed Hartnett wrote on Mon, Jun 06, 2005 at 10:25:53PM CEST:
> >> 
> >> On the AIX, the convenience library doesn't seem to make it into the
> >> final output.
> >
> I'm using libtool 1.5.18.
*snip*
> When run on Linux or SunOS, this works, but on AIX it doesn't. I am
> continuing to investigate.

OK.  I've looked a bit at netcdf (used it myself before).
Here's a patch for a couple of common glitches to get `make distcheck'
mostly working: VPATH builds (source tree != build tree) need this, also
some files need to be cleaned up.  `make check' still fails in the VPATH
setup, I guess you need to make sure where to find your test config and
comparison files.  (I always to VPATH builds, in order to build for more
than one system off the same source tree.)

Please take this patch with a grain of salt, I did it hastily.  The
rules are: if `make' built it, then `make clean' should remove it, (thus
it should end up in CLEANFILES).  If OTOH `configure' created it, it
ought to be in DISTCLEANFILES instead.  For the $(srcdir) paths: if you
do not have built headers in $(builddir)/... you could probably omit the
other include paths.  I did not bother to check.

About your reported issue, see further below.

--- netcdf-4.0-alpha5/Makefile.am       2005-05-23 19:06:42.000000000 +0200
+++ netcdf-4.0-alpha5/Makefile.am       2005-06-09 10:50:12.000000000 +0200
@@ -7,6 +7,7 @@
 #AM_CFLAGS = -DDEBUG
 
 MAINTAINERCLEANFILES = Makefile.in
+DISTCLEANFILES = VERSION my_config.h
 
 # These files get added to the distribution.
 EXTRA_DIST = README COPYRIGHT RELEASE_NOTES VERSION
diff -ru netcdf-4.0-alpha5/fortran/Makefile.am 
../netcdf-4.0-alpha5/fortran/Makefile.am
--- netcdf-4.0-alpha5/fortran/Makefile.am       2005-05-25 23:15:42.000000000 
+0200
+++ netcdf-4.0-alpha5/fortran/Makefile.am       2005-06-09 10:25:25.000000000 
+0200
@@ -6,9 +6,9 @@
 # $Id: Makefile.am,v 1.6 2005/05/25 21:15:42 ed Exp $
 
 if USE_NETCDF4
-AM_CPPFLAGS = -I../libsrc4 -DNO_NETCDF_2
+AM_CPPFLAGS = -I../libsrc4 -I$(srcdir)/../libsrc4 -DNO_NETCDF_2
 else
-AM_CPPFLAGS = -I../libsrc
+AM_CPPFLAGS = -I../libsrc -I$(srcdir)/../libsrc
 endif
 
 # If the user specified a root for HDF5, use it.
@@ -29,4 +29,4 @@
 
 EXTRA_DIST = nfconfig.in
 CLEANFILES = nfconfig1.inc
-DISTCLEANFILES = nfconfig.inc
\ No newline at end of file
+DISTCLEANFILES = nfconfig.inc
--- netcdf-4.0-alpha5/nc_test/Makefile.am       2005-05-24 20:35:36.000000000 
+0200
+++ netcdf-4.0-alpha5/nc_test/Makefile.am       2005-06-09 10:54:13.000000000 
+0200
@@ -17,10 +17,10 @@
 if USE_NETCDF4
 AM_LDFLAGS = -L../libsrc4
 LDADD += -lhdf5
-AM_CPPFLAGS += -DUSE_NETCDF4 -I../libsrc4
+AM_CPPFLAGS += -DUSE_NETCDF4 -I../libsrc4 -I$(srcdir)/../libsrc4
 else
 AM_LDFLAGS = -L../libsrc
-AM_CPPFLAGS += -I../libsrc
+AM_CPPFLAGS += -I../libsrc -I$(srcdir)/../libsrc
 endif
 
 # If the user specified a root for HDF5, use it.
@@ -32,4 +32,4 @@
 TESTS = $(check_PROGRAMS)
 EXTRA_DIST = test_get.c test_put.c
 MAINTAINERCLEANFILES = test_get.c test_put.c
-
+DISTCLEANFILES = test.nc
--- netcdf-4.0-alpha5/ncdump/Makefile.am        2005-05-24 20:35:36.000000000 
+0200
+++ netcdf-4.0-alpha5/ncdump/Makefile.am        2005-06-09 10:43:37.000000000 
+0200
@@ -14,10 +14,10 @@
 if USE_NETCDF4
 AM_LDFLAGS = -L../libsrc4
 LDADD += -lhdf5
-AM_CPPFLAGS += -I../libsrc4
+AM_CPPFLAGS += -I../libsrc4 -I$(srcdir)/../libsrc4
 else
 AM_LDFLAGS = -L../libsrc
-AM_CPPFLAGS += -I../libsrc
+AM_CPPFLAGS += -I../libsrc -I$(srcdir)/../libsrc
 endif
 
 # If the user specified a root for HDF5, use it.
@@ -36,10 +36,10 @@
 EXTRA_DIST = run_tests.sh tst_64bit.sh tst_output.sh test0.cdl
 
 ctest.c:
-       ../ncgen/ncgen -c -o ctest0.nc ../ncgen/c0.cdl > ctest.c
+       ../ncgen/ncgen -c -o $(srcdir)/ctest0.nc $(srcdir)/../ncgen/c0.cdl > 
ctest.c
 
 ctest64.c:
-       ../ncgen/ncgen -v2 -c -o ctest0_64.nc ../ncgen/c0.cdl > ctest64.c
+       ../ncgen/ncgen -v2 -c -o $(srcdir)/ctest0_64.nc 
$(srcdir)/../ncgen/c0.cdl > ctest64.c
 
 TESTS = run_tests.sh tst_64bit.sh ctest ctest64 tst_output.sh
 MAINTAINERCLEANFILES = Makefile.in 
--- netcdf-4.0-alpha5/ncgen/Makefile.am 2005-05-24 20:35:35.000000000 +0200
+++ netcdf-4.0-alpha5/ncgen/Makefile.am 2005-06-09 10:28:29.000000000 +0200
@@ -22,10 +22,10 @@
 if USE_NETCDF4
 AM_LDFLAGS = -L../libsrc4
 LDADD += -lhdf5
-AM_CPPFLAGS += -I../libsrc4
+AM_CPPFLAGS += -I../libsrc4 -I$(srcdir)/../libsrc4
 else
 AM_LDFLAGS = -L../libsrc
-AM_CPPFLAGS += -I../libsrc
+AM_CPPFLAGS += -I../libsrc -I$(srcdir)/../libsrc
 endif
 
 # If the user specified a root for HDF5, use it.




> Here's the somewhat lengthy AIX output:

Here's the condensed version:

*snip*
>  xlc -DHAVE_CONFIG_H -I. -I. -I.. -I. -I../libsrc -g -c -M fort-varsio.c  
> -DPIC -o .libs/fort-varsio.o
>       /bin/sh ../libtool --tag=CC --mode=link xlc  -g    -o libnetcdff.la   
> fort-attio.lo fort-control.lo fort-dim.lo  fort-genatt.lo fort-geninq.lo 
> fort-genvar.lo fort-lib.lo  fort-misc.lo fort-v2compat.lo fort-vario.lo 
> fort-var1io.lo  fort-varaio.lo fort-varmio.lo fort-varsio.lo  
> ar cru .libs/libnetcdff.a .libs/fort-attio.o .libs/fort-control.o 
> .libs/fort-dim.o .libs/fort-genatt.o .libs/fort-geninq.o .libs/fort-genvar.o 
> .libs/fort-lib.o .libs/fort-misc.o .libs/fort-v2compat.o .libs/fort-vario.o 
> .libs/fort-var1io.o .libs/fort-varaio.o .libs/fort-varmio.o 
> .libs/fort-varsio.o
> ranlib .libs/libnetcdff.a
> creating libnetcdff.la
> (cd .libs && rm -f libnetcdff.la && ln -s ../libnetcdff.la libnetcdff.la)
*snip*
>       /bin/sh ../libtool --tag=CC --mode=link xlc  -g    -o libnetcdf.la 
> -rpath /usr/local/lib -version-info 0:0:0 attr.lo ncx.lo putget.lo  dim.lo 
> error.lo libvers.lo nc.lo string.lo  v1hpg.lo var.lo posixio.lo v2i.lo 
> ../fortran/libnetcdff.la 
> generating symbol list for `libnetcdf.la'
> nm -BCpg  .libs/attr.o .libs/ncx.o .libs/putget.o .libs/dim.o .libs/error.o 
> .libs/libvers.o .libs/nc.o .libs/string.o .libs/v1hpg.o .libs/var.o 
> .libs/posixio.o .libs/v2i.o  ../fortran/.libs/libnetcdff.a | awk '{ if ((($2 
> == "T") || ($2 == "D") || ($2 == "B")) && (substr($3,1,1) != ".")) { print $3 
> } }' | sort -u > .libs/libnetcdf.exp
> xlc -Wl,-bM:SRE -o .libs/libnetcdf.so.0  .libs/attr.o .libs/ncx.o 
> .libs/putget.o .libs/dim.o .libs/error.o .libs/libvers.o .libs/nc.o 
> .libs/string.o .libs/v1hpg.o .libs/var.o .libs/posixio.o .libs/v2i.o   -lc  
> -Wl,-bE:.libs/libnetcdf.exp -Wl,-bnoentry ${wl}-berok
> ar cru .libs/libnetcdf.a .libs/libnetcdf.so.0
> creating libnetcdf.la
> (cd .libs && rm -f libnetcdf.la && ln -s ../libnetcdf.la libnetcdf.la)
> Target "check" is up to date.
> Making check in nc_test
>       make  nc_test
*snip*
>       /bin/sh ../libtool --tag=F77 --mode=link xlf   -g -L../libsrc   -o 
> nf_test  test_get.o test_put.o  nf_error.o nf_test.o test_read.o  
> test_write.o util.o fortlib.o -lnetcdf -lm  
> mkdir .libs
> xlf -g -o .libs/nf_test test_get.o test_put.o nf_error.o nf_test.o 
> test_read.o test_write.o util.o fortlib.o  
> -L/home/bluesky/edh/netcdf-4.0-alpha5/libsrc 
> -L/home/bluesky/edh/netcdf-4.0-alpha5/libsrc/.libs -lnetcdf -lm 
> -Wl,-blibpath:/usr/local/lib:/usr/lib:/lib 
> ld: 0711-317 ERROR: Undefined symbol: .nf_create
*snip*
> ld: 0711-317 ERROR: Undefined symbol: .nf_set_default_format
> ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.

OK, I have found more than one issue here:
First, I think this works when netcdf is configured with
  LDFLAGS=-Wl,-brtl
on AIX.  AIX has about the most complex shared library/shared object
design I have ever come across; basically, with -brtl you get SYSV-like
linking which resembles somewhat better how shared libs work on other
(e.g., ELF) platforms.  I have not yet looked closely at the non-brtl
case.  Libtool does not enable this by default; I believe, this is to
allow users the choice, I believe it has a performance impact, and I
honestly do not know whether -brtl and non-brtl object interaction
problems exist.  I also specifically do not want to exclude a possible
Libtool bug here; I don't have the resources to look into this at the
moment, however.

In any case, the created netcdf libraries (both brtl and non-brtl)
do contain the symbols.

Another issue I've found is that over here, linking also fails on x86_64
with icc/ifort.  I believe this is because of Fortran underscore policy
mismatch, but have not looked into this nor your configuration for this
(there are Autoconf macros for this; also note that libtool does not
have proper $FC support yet, but hopefully this changes soon).

By the way: I have done my tests after updating libtool to CVS
branch-1-5, Autoconf/Automake to CVS HEAD.  Note that for some Fortran
compilers (notably on recent Solaris) the latest Autoconf release is not
recent enough (can't think of any relevant changes other than that, but
I wanted to avoid hitting the same bug twice).

Regards,
Ralf




reply via email to

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