[R-SIG-Mac] Installing or Compiling EDGE

Simon Urbanek simon.urbanek at r-project.org
Tue Oct 11 16:47:00 CEST 2011


On Oct 11, 2011, at 6:49 AM, Morri Feldman wrote:

> Hello,
> 
> I hope this is an appropriate mailing list for my question.  If not, please
> excuse me and point me towards another forum if possible.
> 
> I'm trying to install a microarray analysis software package called EDGE
> which relies on R.  The package is available as binaries or source code
> from http://www.genomine.org/edge/ .  I'm using R from R-2.13.2.pkg,
> and tcltk-8.5.5-x11.dmg.  I am running OSX Lion and when I tried to install
> the binaries from edge_intel_1.1.290.tar.tar.gz, I had several failures.
> After working through some trivial problems I found out that knnimpute.so,
> one of the two precompiled binaries in this package, is for PPC not intel.
> 
> Next, I decided to try and compile the package myself.  I installed Xcode
> Version 4.1 (4B103), MacTeX-2011.mpkg and gfortran-lion-5666-3.pkg.  After
> cd to the src/ directory I run make and get the following error.
> 
> **********************************
> g++-4.2 -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include
> -I/Library/Frameworks/R.framework/Resources/include/x86_64
> -I/usr/local/include   -DMAC_OS_X -Dassert\(expr\)= -fPIC
> -I/Library/Frameworks/R.framework/Resources -I./threads -I./cluster
> -I/Library/Frameworks/R.framework/Resources/include -I.
> -DEDGE_LIBRARY_VERSION=\"1.0.\"  -D__STDC_LIMIT_MACROS -Wall -fPIC  -g -O2
> -c Rintf_threads.cpp -o Rintf_threads.o
> Rintf_threads.cpp: In function ŒSEXPREC* GetProgressValues(SEXPREC*)‚:
> Rintf_threads.cpp:66: error: cast from Œ_opaque_pthread_t*‚ to Œint‚ loses
> precision
> make[2]: *** [Rintf_threads.o] Error 1
> build failed
> make[1]: *** [edge.so] Error 1
> make: *** [all] Error 2
> **********************************
> 
> The relevant section of code in Rintf_threads.ccp is:
> 
> **********************************
>    PROTECT(sval=NEW_INTEGER(1));
>    INTEGER_POINTER(sval)[0] = (int)ppt->GetThreadId();  // This line is the
> problem
>    SET_STRING_ELT(snames, i, CREATE_STRING_VECTOR("threadid"));
>    SET_VECTOR_ELT(slist, i, sval);
>    i++;
> **********************************
> 
> This same construction, converting THREAD_ID_T to int, is also used at line
> 525 of RInterfaces.cpp and line 179 of Rintf_cluster.cpp.
> 
> My guess is that the problem is caused by compiling as x86_64,

You, you can't store 64-bit pointer into a 32-bit integer so that code won't work in 64-bit mode. 


> but I can't figure out how to edit the Makefile to force compilation as i386.

The package is a bit of a mess - for several reasons. In has no global CC definition (and always overrides the system one), so you'll need to edit src/Makevars as well as all other Makefiles and add -arch i386 to the compiler lines. Also you'll need to edit src/Makevars and replace the RCMD=R line for Darwin with RCMD=R --arch i386

Once you have done that, you're almost there - you can compile it, but you'll also need to edit edge.r and fix the version check (it is so old that it considers only one digit of the minor number so 2.14 < 2.4 in that logic).

That's it. Below is the diff of all needed changes.

Cheers,
Simon


diff -ru edge_1.1.290/edge.r edge_1.1.290-i386/edge.r
--- edge_1.1.290/edge.r	2007-07-06 15:12:38.000000000 -0400
+++ edge_1.1.290-i386/edge.r	2011-10-11 10:43:40.000000000 -0400
@@ -8,7 +8,7 @@
 ## this or any files in this software package.
 #########################################################
 Rversion <- R.Version()
-if(Rversion$major < "2" || as.numeric(substring(Rversion$minor, 0, 1)) < 4)
+if(Rversion$major < "2" || as.numeric(gsub("\\..*","",Rversion$minor)) < 4)
 {
   stop("R version greater than or equal to 2.4.0 required")
 }
diff -ru edge_1.1.290/src/Makevars edge_1.1.290-i386/src/Makevars
--- edge_1.1.290/src/Makevars	2006-03-07 12:50:29.000000000 -0500
+++ edge_1.1.290-i386/src/Makevars	2011-10-11 10:24:48.000000000 -0400
@@ -28,7 +28,7 @@
 OS_FLAGS=-DMAC_OS_X -Dassert\(expr\)= -fPIC
 PKG_KNNLIBS=-L/sw/lib
 SOEXT=.so
-RCMD=R
+RCMD=R --arch i386
 RCMD_CMD=CMD
 endif

@@ -58,8 +58,8 @@
 PKG_CXXFLAGS=$(OS_FLAGS) $(INCLUDEDIRS) $(EDGELIBVERSION) $(DEBUG) -D__STDC_LIMIT_MACROS -Wall
 PKG_CFLAGS=$(OS_FLAGS) $(INCLUDEDIRS) $(EDGELIBVERSION) $(DEBUG) -D__STDC_LIMIT_MACROS -Wall

-CC=gcc 
+CC=gcc -arch i386
 CCOPTS=-c -g 
-CXX=g++ 
+CXX=g++ -arch i386
 CXXOPTS=-c -g 

diff -ru edge_1.1.290/src/cluster/TestFramework/Makefile edge_1.1.290-i386/src/cluster/TestFramework/Makefile
--- edge_1.1.290/src/cluster/TestFramework/Makefile	2005-09-23 18:22:56.000000000 -0400
+++ edge_1.1.290-i386/src/cluster/TestFramework/Makefile	2011-10-11 10:27:13.000000000 -0400
@@ -1,5 +1,5 @@
 SRCBASE=../..
-CC=g++
+CC=g++ -arch i386
 CCOPTS=-c -g

 LIBOBJECTS=UnitTestRunner.o UnitTestClass.o
diff -ru edge_1.1.290/src/cluster/Tests/Makefile edge_1.1.290-i386/src/cluster/Tests/Makefile
--- edge_1.1.290/src/cluster/Tests/Makefile	2006-03-02 14:50:12.000000000 -0500
+++ edge_1.1.290-i386/src/cluster/Tests/Makefile	2011-10-11 10:26:12.000000000 -0400
@@ -1,7 +1,7 @@
 SRCBASE=../..
 include ../../Makevars

-CC=g++
+CC=g++ -arch i386
 CCOPTS=-I.. -I../TestFramework -I../../threads -D__STDC_LIMIT_MACROS -ftrapv
 LINKOPTS=-L../TestFramework -L.. -L../../threads

diff -ru edge_1.1.290/src/threads/Tests/Makefile edge_1.1.290-i386/src/threads/Tests/Makefile
--- edge_1.1.290/src/threads/Tests/Makefile	2005-09-23 18:22:56.000000000 -0400
+++ edge_1.1.290-i386/src/threads/Tests/Makefile	2011-10-11 10:27:38.000000000 -0400
@@ -1,7 +1,7 @@
 SRCBASE=../..
 include ../../Makevars

-CC=g++
+CC=g++ -arch i386
 CCOPTS=-c -g

 OBJECTS=main.o




> I've
> contacted one of the authors of the software, but they haven't gotten back
> to me yet.  I will greatly appreciate any help you can provide.
> 
> Best and Thank You,
> Morri Feldman
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac



More information about the R-SIG-Mac mailing list