[Bioc-devel] Bioc 2.2 versus x86_64-only R 2.7 on OS X

Anand C. Patel acpatel at usa.net
Thu Nov 1 19:22:44 CET 2007


OK.  In the process of running maSigPro on 30 arrays in an affyBatch (output
from combineAffyBatch), my previously happy R 2.6 threw malloc errors --
starting with an inability to allocate a vector of 1.3 gb.  This happened on
multiple occasions, and happened regardless of whether or not other data was
cleared, OS X memory was free and available, etc.  The last time it happened
OS X had 3.4 gb of free physical memory . . .

So, I figured I'd compile a 64-bit version of R 2.7 for OS X 10.5.  After some
issues, that is now working.  The last easily available 64-bit R for OS X is
2.5, and I wanted to use the newer packages from 2.6 (at least).  R 2.6 won't
compile in 64-bit mode with Quartz, but R 2.7 will.

It is compiled specifically for x86_64, as I don't personally need it to run
on all 4 possible architectures.  I did this by declaring multiple flags at
./configure time:

./configure CC='gcc -arch x86_64' CXX='g++ -arch x86_64' \
F77='gfortran -arch x86_64' FC='gfortran -arch x86_64' 'CFLAGS=-g -O3 -m64
-I/readline/include -L/readline/lib' 'OBJCFLAGS=-g -O3 -m64
-I/readline/include -L/readline/lib' 'LDFLAGS=-L/usr/local/lib' 'FFLAGS=-g -O3
-m64 -I/readline/include -L/readline/lib ' 'CXXFLAGS=-g -O3 -m64
-I/readline/include -L/readline/lib' 'FCFLAGS=-g -O3 -m64 -I/readline/include
-L/readline/lib' \
 --with-blas='-framework vecLib' --with-lapack  \
--with-system-zlib --build=x86_64-apple-darwin9.0.0 \
--with-tcl-config=/usr/local/lib/tclConfig.sh
--with-tk-config=/usr/local/lib/tkConfig.sh

However, when I try to install bioc 2.2 packages, there is a significant
problem.  Most packages compile from source just fine.  However, some of the
core packages fail to compile because the packages themselves declare
PKG_CFLAGS and this creates a conflict with the flags above.  affy, affyio,
and preprocessCore all do their own variation of the following:

(excerpt taken from affyio, but the other two do the same thing)

configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -arch x86_64 -std=gnu99 -I/R-devel/include -I/R-devel/include
-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\"
-DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1
-DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1
-DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1
-DHAVE_UNISTD_H=1 -DHAVE_ZLIB=1 -DHAVE_LIBPTHREAD=1 -DUSE_PTHREADS=1
-I/sw/include -I/usr/local/include   -arch ppc -arch ppc64 -arch i386 -arch
x86_64         -isysroot /Developer/SDKs/MacOSX10.4u.sdk
-mmacosx-version-min=10.4   -fPIC  -g -O3 -m64 -I/readline/include
-L/readline/lib -c fread_functions.c -o fread_functions.o
lipo: /var/tmp//ccdPcoay.out and /var/tmp//ccz02Cr2.out have the same
architectures (x86_64) and can't be in the same fat output file

I fixed this by extracting the packages, and individually changing the
PKGS_CFLAGS line in the Makevars.in files in all 3 packages from:
PKG_CFLAGS = @CFLAGS@
to
PKG_CFLAGS = -isysroot /Developer/SDKs/MacOSX10.4u.sdk
-mmacosx-version-min=10.4

I am overly aware that this is an ugly kludge.  However, again using affyio as
an example:
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -arch x86_64 -std=gnu99 -I/R-devel/include -I/R-devel/include
-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\"
-DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1
-DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1
-DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1
-DHAVE_UNISTD_H=1 -DHAVE_ZLIB=1 -DHAVE_LIBPTHREAD=1 -DUSE_PTHREADS=1
-I/sw/include -I/usr/local/include   -isysroot /Developer/SDKs/MacOSX10.4u.sdk
-mmacosx-version-min=10.4   -fPIC  -g -O3 -m64 -I/readline/include
-L/readline/lib -c fread_functions.c -o fread_functions.o

and it successfully builds and installs.

A glance at the problem and the instructions for Mac R building from
R.research.att.com suggests that the root of the problem is that the
architecture specification seems to need to happen at the level of the CC flag
rather than the CFLAGS flag.  When I tried to compile placing the architecture
specification (-arch x86_64) in the CFLAGS (and other compiler flags) the R
compile fails.  Up front it looks like the downside of setting the packages up
to automatically recognize OS X and compile to all 4 possible architectures. 
Is there an easier/better way to do this?

Thanks,
Anand C. Patel, MD
Washington University School of Medicine
acpatel at usa.net



More information about the Bioc-devel mailing list