Skip to content

can't install R with *local* gcc

3 messages · Peter Dalgaard, Oliver Kullmann

#
Hello,

we re-distribute R with our open-source platform http://www.ok-sat-library.org/
where we use R mainly for evaluation of computational experiments.
Due to the various platforms, we build everything from source, and that works fine.
Until now, that is: there are circumstances (for example in computer-science computer labs)
where no Fortran-compiler is provided, and the users (students) can't change that.
Thus we now try to build gfortran as part of the GCC version 4.2.4 suite, and building
R using that local gcc.
We already use the local C and C++ compiler of the suite extensively, and that
all works. But we don't have any experience with using gfortran.
The gcc-build works fine, everything seems alright --- only R (version 2.11.0) won't build with it:

We use the configuration

F77=/home/csoliver/SAT-Algorithmen/OKplatform/ExternalSources/Installations/Gcc/4.2.4/bin/gfortran 
FC=${F77} 
CC=/home/csoliver/SAT-Algorithmen/OKplatform/ExternalSources/Installations/Gcc/4.2.4/bin/gcc 
CXX=/home/csoliver/SAT-Algorithmen/OKplatform/ExternalSources/Installations/Gcc/4.2.4/bin/g++ 
LDFLAGS="-L /home/csoliver/SAT-Algorithmen/OKplatform/ExternalSources/Installations/Gcc/4.2.4/lib" 
./configure --prefix=/home/csoliver/SAT-Algorithmen/OKplatform/ExternalSources/Installations/R/2.11.0

(the same problems with "lib64" instead of "lib", by the way)

which yields

checking for Fortran 77 libraries of /home/csoliver/SAT-Algorithmen/OKplatform/ExternalSources/Installations/Gcc/4.2.4/bin/gfortran...  -L/home/csoliver/SAT-Algorithmen/OKplatform/ExternalSources/Installations/Gcc/4.2.4/lib -L/home/csoliver/SAT-Algorithmen/OKplatform/ExternalSources/Installations/Gcc/4.2.4/lib/gcc/x86_64-unknown-linux-gnu/4.2.4 -L/home/csoliver/SAT-Algorithmen/OKplatform/ExternalSources/Installations/Gcc/4.2.4/lib/gcc/x86_64-unknown-linux-gnu/4.2.4/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/home/csoliver/SAT-Algorithmen/OKplatform/ExternalSources/Installations/Gcc/4.2.4/lib/gcc/x86_64-unknown-linux-gnu/4.2.4/../../.. -lgfortranbegin -lgfortran -lm /home/csoliver/SAT-Algorithmen/OKplatform/ExternalSources/Installations/Gcc/4.2.4/lib/libgfortran.a

which looks alright to me (but I don't know Fortran), but then we get

checking for dummy main to link with Fortran 77 libraries... none
checking for Fortran 77 name-mangling scheme... lower case, underscore, no extra underscore
checking whether /home/csoliver/SAT-Algorithmen/OKplatform/ExternalSources/Installations/Gcc/4.2.4/bin/gfortran appends underscores to external names... yes
checking whether /home/csoliver/SAT-Algorithmen/OKplatform/ExternalSources/Installations/Gcc/4.2.4/bin/gfortran appends extra underscores to external names... no
checking whether mixed C/Fortran code can be run... configure: WARNING: cannot run mixed C/Fortran code
configure: error: Maybe check LDFLAGS for paths to Fortran libraries?
make: *** [R_base] Error 1

The R installation-documentation doesn't say much on using local compilers (more or less nothing), and everything we could
get from it are the above settings of environment variables.

Internet search reveals old stuff on "libg2c" which appears not to exist anymore, some recommendations
not to build from sources (which is not an option for us), an open Sage ticket (apparently without any
further work on it), and a request to the R-list with apparently no reply.

Since we are working in a well-defined setting (gcc is fully under our control), and apparently
all the libraries needed are build by gcc (though this is nowhere said or (dream) specified),
it should be possible to solve that problem.

I very hope to get some hints (we can't get R running (for our system!) otherwise).
The error is exactly the same on various systems (all 64-bit machines, Intel and AMD).
If we use the system-gcc (4.5.0 or 4.1.2) then the installation of R works without problems;
here (for one of the machines) some data
platform       x86_64-unknown-linux-gnu     
arch           x86_64                       
os             linux-gnu                    
system         x86_64, linux-gnu            
status                                      
major          2                            
minor          11.0                         
year           2010                         
month          04                           
day            22                           
svn rev        51801                        
language       R                            
version.string R version 2.11.0 (2010-04-22)

Thanks for you help in any case!

Oliver
#
On Dec 26, 2010, at 17:50 , Oliver Kullmann wrote:

            
I suppose r-devel would be a better mailing list for this sort of thing, but since we're here:

Hint #1: Expect the process to be somewhat painful...
Hint #2: Study the configure script and config.log to the level where you can reproduce the  mixed C/Fortran code that it is trying to build and run and with which commands it is trying to build it
Hint #3: Figure out what it really should have done to build such code

An alternative hint is first to try setting up a very simple Fortran function to, say, double a number, and a C main program that calls it. Then try figuring out the compiler/linker options to make it work. (That is of course what configure was trying to do in the first place, but doing it by hand might be less prone to getting multiple toolchains mixed up.)

  
    
#
Hello,

I infer from your answer that piece of information which
is most important for us now: That my configuration instructions
for R should work (should be correct).

Given all these unspecified build-systems we have to fight (at least
Gmp, Mpfr, Gcc with everything in it, R, and finally our own)
one first wants to know where obvious errors are.

Thanks!

Once I know more (we are in the middle of it) I move to
the devel-list.

Oliver

P.S. Currently it seems that the Gcc-build is not correct (still the same with 4.4.5),
not propagating linker-information to the building of libraries (while the compiler-builds
seem alright).