Fortran vs C, easing using Fortran
On Mon, 12 Apr 1999, Prof Brian Ripley wrote:
Date: Mon, 12 Apr 1999 11:30:20 +0200 (MET DST) From: Albrecht Gebhardt <albrecht.gebhardt@uni-klu.ac.at>
I think in R we can do better than at present, if only I knew exactly how. One idea is to have (effectively) a `hints' file that configure uses to add a base set of libraries to FLIBS, but on Solaris at least, using the Fortran command (f77 or g77) to link a dynamic library does the job. For linking with ld the base FLIBS would need to be -lF77 -lM77 -lV77 -lsunmath -lm _if_ f77 is used. How viable is `use FC to link' on other platforms?
I'm not sure if it does matter here, but the only way to build R on my Alphas currently is using Fortran as LDCMD: in config.site: LDCMD="f77 " SHLIBLD is "ld -shared -expect_unresolved '*'".
I would have expected LDCMD=f77 LDFLAGS="-g -nofor_main -fpe3" SHLIBLD=ld SHLIBLDFLAGS="-shared -expect_unresolved '*'" as the way to encode that. Now my question amounts to Does SHLIBLD=f77 work with those SHLIBLDFLAGS? If not, can SHLIBLDFLAGS be modified to make it work?
splitting LDCMD="f77 -g -nofor_main -fpe3 " into LDCMD=f77 LDFLAGS="-g -nofor_main -fpe3" results in root@delta[R]# ./configure loading cache ./config.cache checking for a BSD compatible install... (cached) /usr/local/bin/install -c checking whether ln -s works... (cached) yes checking for ranlib... (cached) ranlib checking for bison... (cached) bison -y checking for ar... (cached) ar checking for latex... (cached) /usr/local/bin/latex checking for dvips... (cached) /usr/local/bin/dvips checking for makeindex... (cached) /usr/local/bin/makeindex checking for perl... (cached) /usr/local/bin/perl checking whether perl is perl 5... yes checking for cc... (cached) cc checking for underscore after Fortran symbols... configure: error: Nothing worked - cannot use FORTRAN setting SHLIBLD to f77 and SHLIBLDFLAGS="-shared" works. (SHLIBLDFLAGS="-shared -expect_unresolved '*'" fails, f77 doesn't understand this linker option, but no matter: it would only suppress some warnings) BTW, the value of SHLIBLDFLAGS specified in config.site gets never used: it will be overwritten from the configure script with the host specific versions of SHLIBLDFLAGS. The same thing for SHLIBLD, this is hardcoded to "ld" in configure.in. But I think there is no difference between SHLIBLD=ld SHLIBLDFLAGS="-shared -expect_unresolved '*'" and SHLIBLD=f77 SHLIBLDFLAGS="-shared" because f77 also calls ld (ok, with the correct Fortran libraries, libUfor.so, libFutil.so, libots.so). I guess this works because I link R with LDCMD="f77 -nofor_main", so it already contains the symbols of the Fortran libraries. Albrecht ------------------------------------------------------------------------------- Albrecht Gebhardt email : albrecht.gebhardt@uni-klu.ac.at Institut fuer Mathematik Tel. : (++43 463) 2700/837 Universitaet Klagenfurt Fax : (++43 463) 2700/834 Villacher Str. 161 A-9020 Klagenfurt, Austria ------------------------------------------------------------------------------- -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._