From Kurt.Hornik@ci.tuwien.ac.at  Mon Aug 16 08:19:59 1999
From: Kurt.Hornik@ci.tuwien.ac.at (Kurt Hornik)
Date: Mon, 16 Aug 1999 09:19:59 +0200 (CEST)
Subject: configure / linking problem when using hdf5
In-Reply-To: <199908160705.JAA04507@sophie.ethz.ch>
References: <199908160705.JAA04507@sophie.ethz.ch>
Message-ID: <14263.48031.406276.341146@fangorn.ci.tuwien.ac.at>

>>>>> Martin Maechler writes:

> I've installed hdf5 [library & includes] here locally, last week.
> [see ?hdf5save in R]

> There is a remaining compilation / linking problem  for me:

> The hdf5 library uses "compress2" a routine defined in Gnu's zlib,
> but not available in the zlib that comes with X11R6.3 (which we have installed).

> Now unfortunately,
> the final link statement for R (0.65) [for me, with hdf5 enabled] is 

>  gcc -o ../../bin/R.X11 arithmetic.o ....[omitted]  version.o  \
>  ../unix/libunix.a ../appl/libappl.a ../nmath/libmath.a -lSM -lICE -L/usr/local/X11R6.3/lib -R/usr/local/X11R6.3/lib -lX11 -lsocket  -lnsl -R/opt/SUNWspro/lib  -L/opt/SUNWspro/lib -L/opt/SUNWspro/SC4.2/lib -L/usr/ccs/lib -L/usr/lib /opt/SUNWspro/SC4.2/lib/libM77.a -lF77 -lsunmath -lm -lcx  -lreadline -lhdf5 -lz -ldl -ltermcap -lm

> Undefined			first referenced
>  symbol  			    in file
> compress2                           /usr/local/lib/libhdf5.a(H5Z.o)
> ld: fatal: Symbol referencing errors. No output written to ../../bin/R.X11

> -------------
> Which happens because there was an  -L/usr/local/X11R6.3/lib 
> before the "-lhdf5 -lz".
> In the local LD_LIBRARY_PATH,  
>    /usr/local/lib (which has the proper libz.a  *with* compress2)
>    comes before the X11/lib (which has the wrong  libz.a).

> Of course, I can manually 
> put -L/usr/local/lib  BEFORE the -L/usr/local/X11R6.3/lib,
> but I wonder what would be recommended, "officially".

> Putting " -lhdf5 -lz "  BEFORE  "-L/usr/local/X11R6.3/lib"
> simply fails as well [undefined symbol "compress2"].

> Having two different "libz.a" in LD_LIBRARY_PATH doesn't make sense
> anyway.  Would any of you know if I can safely get rid of X11's one
> now that I have GNU's ?

We currently have

  ALL_LIBS = $(RLIBS) $(ALL_X_LIBS) $(FLIBS) $(R_XTRA_LIBS) $(LIBS)

I assume that the order is mostly for historic reasons.  You could try
putting ALL_X_LIBS last and see what happens ...e.g.,

  ALL_LIBS = $(RLIBS) $(R_XTRA_LIBS) $(FLIBS) $(LIBS) $(ALL_X_LIBS)

-k
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


configure / linking problem when using hdf5
Kurt Hornik