Skip to content

Problems compiling R65.0 (PR#262)

2 messages · Patrick Lindsey, Peter Dalgaard

#
Hi,
I appear to have a slight problem compiling R0.65.0 under Linux
(slackware) using g77. By simply typing configure then make, I obtain
a binary which when "ldd" does not contain the f2c library. I
therefore cannot load any libraries containing fortran code (I obtain
unresolved symbol messages from R.X11 and an unable to load shared
library from dyn.load(file)).
If I change the "-lf2c" flag on the FLIBS line of the Makeconf to
"-L/usr/lib/libf2c", I then obtain the following error when R.X11 is
being created:

gcc -export-dynamic  -o ../../bin/R.X11 arithmetic.o array.o attrib.o bind.o builtin.o character.o coerce.o colors.o complex.o context.o cov.o cum.o debug.o devPS.o devPicTeX.o deparse.o deriv.o devices.o dotcode.o dstruct.o duplicate.o envir.o errors.o eval.o format.o fourier.o gram.o gram-ex.o graphics.o iosupport.o list.o logic.o main.o match.o memory.o model.o names.o objects.o optimize.o options.o par.o paste.o platform.o plot.o plot3d.o plotmath.o print.o printarray.o printvector.o printutils.o random.o relop.o saveload.o scan.o seq.o sort.o source.o split.o subassign.o subscript.o subset.o summary.o unique.o util.o version.o ../unix/libunix.a ../appl/libappl.a ../nmath/libmath.a -lSM -lICE -L/usr/X11R6/lib -lX11  -L/usr/lib/libf2c -lm -L/usr/lib/gcc-lib/i486-unknown-linux-gnulibc1/2.7.2.3 -L/usr/i486-unknown-linux-gnulibc1/lib -lm  -lreadline -lz -ldl -lncurses -lm 
../appl/libappl.a(uncmin.o): In function `optchk_':
/usr/local/src/R/src/appl/uncmin.f:1848: undefined reference to `d_lg10'
make[3]: *** [../../bin/R.X11] Error 1

Does anyone have an idea how I could get my libraries working?
Thank you,
Patrick.

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
plindsey@alpha.luc.ac.be writes:
Yes, this is a bit of a pain. The issue is that libf2c is not a
dynamic library on all systems, and hence does not show on ldd, and
only the routines that are actually used by R get loaded into the
binary. 

What should happen in that case is that R SHLIB/INSTALL would generate
so files with the relevant Fortran linked in, e.g. if that doesn't
happen for you, there's a bug in the configure script. With egsc/g77 I
get the following:

# R INSTALL multiv
Installing package `multiv' ...
 libs
g77  -fPIC -g -O2 -c bea.f -o bea.o
g77  -fPIC -g -O2 -c ca.f -o ca.o
g77  -fPIC -g -O2 -c hc.f -o hc.o
g77  -fPIC -g -O2 -c hcmovie.f -o hcmovie.o
g77  -fPIC -g -O2 -c members.f -o members.o
g77  -fPIC -g -O2 -c partition.f -o partition.o
g77  -fPIC -g -O2 -c pca.f -o pca.o
g77  -fPIC -g -O2 -c sammon.f -o sammon.o
gcc -shared  -o /usr/local/lib/R/library/multiv/libs/multiv.so bea.o ca.o hc.o hcmovie.o members.o partition.o pca.o sammon.o -L/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66 -L/usr/i386-redhat-linux/lib -lg2c -lm

# R SHLIB ca.f 
gcc -shared  -o ca.so ca.o -L/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66 -L/usr/i386-redhat-linux/lib -lg2c -lm
That couldn't possibly work. '-L' specifies a directory to search, so
you get the same effect as if you had just removed -lf2c.