[Rd] package compile error on RHEL x86_64

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Jun 15 11:33:19 CEST 2006


This is a problem with your compiler: it should be linking against a 
shared version of libstdc++.  Please take this up with your OS support.

On Wed, 14 Jun 2006, Dan Lipsitt wrote:

> I am unable to install the gmp package on an x86_64 (Xeon) machine. I
> have had the same problem with other packages (eg. MCMCpack) as well.
> I am running Red Hat Enterprise Linux 4.1.
> I get the following error:
>
> g++ -shared -L/usr/local/lib64 -o gmp.so biginteger.o
> biginteger_operator.o bigintegerR.o bigrational.o
> bigrational_operator.o bigrationalR.o factor.o -L/usr/local/lib/ -lgmp
> /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/3.4.3/libstdc++.a(functexcept.o):
> relocation R_X86_64_32 against `std::bad_exception::~bad_exception()'
> can not be used when making a shared object; recompile with -fPIC
> /usr/lib/gcc/x86_64-redhat-linux/3.4.3/libstdc++.a: could not read
> symbols: Bad value
>
> However, I have found that if I run "R CMD SHLIB" twice in the src/
> directory, once to build the .o files, and once to link, I can build
> the shared library. If I run it on the .o files instead of the .cc
> files it uses gcc instead of g++. This appears to be the change that
> allows the lib to build. "-fPIC" seems to have nothing to do with it.
>
> So my question is: How do I get "R CMD INSTALL" to link with gcc
> instead of g++? I have tried adding "LINK.cc = $(LINK.c)" to the top
> of src/Makevars.in and then running "R CMD check" in the top dir of
> the package, but it uses g++ anyway. Any other fix or workaround
> suggestions would be appreciated as well.
>
> A commandline transcript follows below.
>
> Thanks,
> Dan
>
> $ sudo R CMD INSTALL gmp_0.3-4.tar.gz
> * Installing *source* package 'gmp' ...
> creating cache ./config.cache
> checking for __gmpz_ui_sub in -lgmp... yes
> updating cache ./config.cache
> creating ./config.status
> creating src/Makevars
> ** libs
> g++ -I/usr/lib/R/include -I/usr/local/include/  -Wno-conversion
> -I/usr/local/include   -fPIC  -O2 -g -c biginteger.cc -o biginteger.o
> g++ -I/usr/lib/R/include -I/usr/local/include/  -Wno-conversion
> -I/usr/local/include   -fPIC  -O2 -g -c biginteger_operator.cc -o
> biginteger_operator.o
> g++ -I/usr/lib/R/include -I/usr/local/include/  -Wno-conversion
> -I/usr/local/include   -fPIC  -O2 -g -c bigintegerR.cc -o
> bigintegerR.o
> g++ -I/usr/lib/R/include -I/usr/local/include/  -Wno-conversion
> -I/usr/local/include   -fPIC  -O2 -g -c bigrational.cc -o
> bigrational.o
> g++ -I/usr/lib/R/include -I/usr/local/include/  -Wno-conversion
> -I/usr/local/include   -fPIC  -O2 -g -c bigrational_operator.cc -o
> bigrational_operator.o
> g++ -I/usr/lib/R/include -I/usr/local/include/  -Wno-conversion
> -I/usr/local/include   -fPIC  -O2 -g -c bigrationalR.cc -o
> bigrationalR.o
> g++ -I/usr/lib/R/include -I/usr/local/include/  -Wno-conversion
> -I/usr/local/include   -fPIC  -O2 -g -c factor.cc -o factor.o
> g++ -shared -L/usr/local/lib64 -o gmp.so biginteger.o
> biginteger_operator.o bigintegerR.o bigrational.o
> bigrational_operator.o bigrationalR.o factor.o -L/usr/local/lib/ -lgmp
> /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/3.4.3/libstdc++.a(functexcept.o):
> relocation R_X86_64_32 against `std::bad_exception::~bad_exception()'
> can not be used when making a shared object; recompile with -fPIC
> /usr/lib/gcc/x86_64-redhat-linux/3.4.3/libstdc++.a: could not read
> symbols: Bad value
> collect2: ld returned 1 exit status
> make: *** [gmp.so] Error 1
> ERROR: compilation failed for package 'gmp'
>
> $ tar xzf gmp_0.3-4.tar.gz
> $ cd gmp/src
> $ R CMD SHLIB *.cc
> g++ -I/usr/lib/R/include  -I/usr/local/include   -fPIC  -O2 -g -c
> biginteger.cc -o biginteger.o
> g++ -I/usr/lib/R/include  -I/usr/local/include   -fPIC  -O2 -g -c
> biginteger_operator.cc -o biginteger_operator.o
> g++ -I/usr/lib/R/include  -I/usr/local/include   -fPIC  -O2 -g -c
> bigintegerR.cc -o bigintegerR.o
> g++ -I/usr/lib/R/include  -I/usr/local/include   -fPIC  -O2 -g -c
> bigrational.cc -o bigrational.o
> g++ -I/usr/lib/R/include  -I/usr/local/include   -fPIC  -O2 -g -c
> bigrational_operator.cc -o bigrational_operator.o
> g++ -I/usr/lib/R/include  -I/usr/local/include   -fPIC  -O2 -g -c
> bigrationalR.cc -o bigrationalR.o
> g++ -I/usr/lib/R/include  -I/usr/local/include   -fPIC  -O2 -g -c
> factor.cc -o factor.o
> g++ -shared -L/usr/local/lib64 -o biginteger.so biginteger.o
> biginteger_operator.o bigintegerR.o bigrational.o
> bigrational_operator.o bigrationalR.o factor.o
> /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/3.4.3/libstdc++.a(functexcept.o):
> relocation R_X86_64_32 against `std::bad_exception::~bad_exception()'
> can not be used when making a shared object; recompile with -fPIC
> /usr/lib/gcc/x86_64-redhat-linux/3.4.3/libstdc++.a: could not read
> symbols: Bad value
> collect2: ld returned 1 exit status
> make: *** [biginteger.so] Error 1
> $ R CMD SHLIB *.o
> gcc -shared -L/usr/local/lib64 -o biginteger.so biginteger.o
> biginteger_operator.o bigintegerR.o bigrational.o
> bigrational_operator.o bigrationalR.o factor.o
> $
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list