Skip to content
Prev 3809 / 15075 Next

Compiling 2.5.1 on OSX Panther (James Kyle)

Thank you for the input, I'm a bit new to this level of compiling,  
but here's my best efforts.
I read the gcc documentation and the only package not compiled as a  
shared lib by default is libobjc. So I first compiled gcc-3.3.6  
(without the --enable-shared=libobjc), installed it in /usr/local/ 
gcc36, and then ln -sf /usr/local/gcc36/bin/gcc ~/bin/gcc and ln -sf / 
usr/local/gcc36/bin/g77 ~/bin/g77.
Compiling R against this build produced:

$ ./configure --with-blas='-framework vecLib' --enable-BLAS-shlib &&  
make all
g77  -fPIC -fno-common  -g -O2 -c blas.f -o blas.o
g77  -fPIC -fno-common  -g -O2 -c cmplxblas.f -o cmplxblas.ogcc - 
std=gnu99 -dynamiclib -L/sw/lib -L/usr/local/lib -o libRblas.dylib  
blas.o -install_name libRblas.dylib -headerpad_max_install_names  - 
lg2c  cmplxblas.o
ld: for architecture ppc
ld: Undefined symbols:
_xerbla_
_z_abs
/usr/bin/libtool: internal link edit command failed
make[4]: *** [libRblas.dylib] Error 1
make[4]: Leaving directory `/opt/sandbox/R-2.5.1/src/extra/blas'
make[3]: *** [R] Error 2
make[3]: Leaving directory `/opt/sandbox/R-2.5.1/src/extra/blas'
make[2]: *** [R] Error 1
make[2]: Leaving directory `/opt/sandbox/R-2.5.1/src/extra'
make[1]: *** [R] Error 1
make[1]: Leaving directory `/opt/sandbox/R-2.5.1/src'
make: *** [R] Error 1

Next, I attempted to compile gcc36 with --enable-shared=libobjc
(after all this is OSX, so I figured this might do it). Compiling  
against this build produces the same errors as above.
This seemed the most straight forward solution, but it too produces  
errors

$ ./configure --without-lapack && make all
gcc -std=gnu99 -I../../src/extra/zlib -I../../src/extra/bzip2 -I../../ 
src/extra/pcre  -I. -I../../src/include -I../../src/include -I/sw/ 
include -I/usr/local/include -DHAVE_CONFIG_H   -fPIC -fno-common  -g - 
O2 -c complex.c -o complex.o
complex.c: In function `do_cmathfuns':
complex.c:332: error: incompatible type for argument 1 of `cabs'
make[3]: *** [complex.o] Error 1
make[3]: Leaving directory `/opt/sandbox/R-2.5.1/src/main'
make[2]: *** [R] Error 2
make[2]: Leaving directory `/opt/sandbox/R-2.5.1/src/main'
make[1]: *** [R] Error 1
make[1]: Leaving directory `/opt/sandbox/R-2.5.1/src'
make: *** [R] Error 1

and:

$ ./configure --without-lapack --without-blas && make all

gcc -std=gnu99 -I../../src/extra/zlib -I../../src/extra/bzip2 -I../../ 
src/extra/pcre  -I. -I../../src/include -I../../src/include -I/sw/ 
include -I/usr/local/include -DHAVE_CONFIG_H   -fPIC -fno-common  -g - 
O2 -c complex.c -o complex.o
complex.c: In function `do_cmathfuns':
complex.c:332: error: incompatible type for argument 1 of `cabs'
make[3]: *** [complex.o] Error 1
make[3]: Leaving directory `/opt/sandbox/R-2.5.1/src/main'
make[2]: *** [R] Error 2
make[2]: Leaving directory `/opt/sandbox/R-2.5.1/src/main'
make[1]: *** [R] Error 1
make[1]: Leaving directory `/opt/sandbox/R-2.5.1/src'
make: *** [R] Error 1

Same errors were produced with the --enable-shared=libobjc build of  
gcc as well.
I'm not entirely sure how to go about this. I found the  
libRlapack.dylib compile command in the $R/src/modules/lapack/ 
Makefile on line #81

$(DYLIB_LINK) -o $@ $(LIBOBJECTS) -install_name libRlapack.dylib - 
compatibility_version 2.5.0 -current_version 2.5.1  - 
headerpad_max_install_names -L$(R_HOME)/lib$(R_ARCH) -lRblas $ 
(Rlapack_la_LIBADD)

This is expanded to:

gcc -std=gnu99 -dynamiclib -L/sw/lib -L/usr/local/lib -o  
libRlapack.dylib dlamch.o dlapack0.o dlapack1.o dlapack2.o dlapack3.o  
dlapack4.o cmplx.o -install_name libRlapack.dylib - 
compatibility_version 2.5.0 -current_version 2.5.1  - 
headerpad_max_install_names -L../../../lib -lRblas -lg2c -L../../../ 
lib -lR -dylib_file libRblas.dylib:../../../lib/libRblas.dylib

I attempted to remove the -lg2c, which threw and error on not finding  
-lRblas. Removing that throws an error on not finding -lR. So I must  
not be going about this correctly.
Thanks for the suggestions, Simon. Much appreciated. :)

James A. Kyle