[R] Building R on Sun Solaris 10 (SPARC) using Sun Studio 12

James T Brown brownja at msu.edu
Tue Dec 11 21:07:14 CET 2007


Prof Ripley:

>>
>> Just curious if anyone has successfully built R on a SPARC
>> platform running Sun Solaris 10 using the latest Sun Studio
>> 12 set of compilers.   If so, I would be interested in the
>> compile flags that you used.
>
> Yes, the flags given in the R-admin manual.  (We don't currently have 
> a Solaris 10 Sparc box running, but this was with the current Sun 
> Studio 12 at the time, just after it came out.)
>

Thanks for reply.

Yes, I have tried this, although I had to remove the "-xc99" flag from
the CC environment variable.  When used as shown in the installation
manual, the compile fails:

In file included from regex.c:107:
/usr/include/stdbool.h:42:2: #error "Use of <stdbool.h> is valid only in 
a c99 compilation environment."
*** Error code 1
The following command caused the error:
cpp -M -I../../src/extra/zlib -I../../src/extra/bzip2 
-I../../src/extra/pcre   -I. -I../../src/include -I../../src/include 
-I/usr/local/include -DHAVE_CONFIG_H regex.c > regex.d
make: Fatal error: Command failed for target `regex.d'
Current working directory /apps/local/src/R-2.6.1/src/main
*** Error code 1



By removing the "-xc99" flag and setting the others options as specified
in the installation manual, the R package builds completely, but the
"foreign" package continues to crash when I attempt to load it - all
of the other packages that I have tried seem to work just fine.   I
suspect that since those that have built with GCC are not reporting
any trouble, it would be difficult to point a finger at the "foreign"
code and claim that this is a bug, but yet, I am not having any trouble
with any of the other packages that have been built using Sun Studio 12.

Here are the latest "configure" options that I have tried (as
specified in the manual, minus the "-xc99" flag):

  % ./configure --prefix=/usr/local/R-2.6.1
               CC=/opt/SUNWspro/bin/cc
               CFLAGS="-O -xlibmieee"
               LDFLAGS="-L/usr/local/lib -R/usr/local/lib"
               CXX=/opt/SUNWspro/bin/CC
               CXXFLAGS=-O
               F77=/opt/SUNWspro/bin/f95
               FFLAGS=-O
               FC=/opt/SUNWspro/bin/f95
               FCFLAGS=-O
               CPPFLAGS="-I/usr/local/include"
               SHLIB_CXXLDFLAGS="-G -lCstd"

  % make

  % /usr/local/R-2.6.1/bin/R

    > library(foreign)

 *** caught segfault ***
address fdde9918, cause 'invalid permissions'

Traceback:
 1: .C("spss_init", PACKAGE = "foreign")
 2: fun(...)
 3: doTryCatch(return(expr), name, parentenv, handler)
 4: tryCatchOne(expr, names, parentenv, handlers[[1]])
 5: tryCatchList(expr, classes, parentenv, handlers)
 6: tryCatch(expr, error = function(e) {    call <- conditionCall(e)    
if (!is.null(call)) {        if (identical(call[[1]], 
quote(doTryCatch)))             call <- sys.call(-4)        dcall <- 
deparse(call)[1]        prefix <- paste("Error in", dcall, ": ")        
LONG <- 75        msg <- conditionMessage(e)        sm <- strsplit(msg, 
"\n")[[1]]        if (14 + nchar(dcall, type = "w") + nchar(sm[1], type 
= "w") >             LONG)             prefix <- paste(prefix, "\n  ", 
sep = "")    }    else prefix <- "Error : "    msg <- paste(prefix, 
conditionMessage(e), "\n", sep = "")    
.Internal(seterrmessage(msg[1]))    if (!silent && 
identical(getOption("show.error.messages"),         TRUE)) {        
cat(msg, file = stderr())        .Internal(printDeferredWarnings())    
}    invisible(structure(msg, class = "try-error"))})
 7: try({    fun(...)    NULL})
 8: runHook(".onLoad", package, env, package.lib, package)
 9: loadNamespace(package, c(which.lib.loc, lib.loc), keep.source = 
keep.source)
10: doTryCatch(return(expr), name, parentenv, handler)
11: tryCatchOne(expr, names, parentenv, handlers[[1]])
12: tryCatchList(expr, classes, parentenv, handlers)
13: tryCatch(expr, error = function(e) {    call <- conditionCall(e)    
if (!is.null(call)) {        if (identical(call[[1]], 
quote(doTryCatch)))             call <- sys.call(-4)        dcall <- 
deparse(call)[1]        prefix <- paste("Error in", dcall, ": ")        
LONG <- 75        msg <- conditionMessage(e)        sm <- strsplit(msg, 
"\n")[[1]]        if (14 + nchar(dcall, type = "w") + nchar(sm[1], type 
= "w") >             LONG)             prefix <- paste(prefix, "\n  ", 
sep = "")    }    else prefix <- "Error : "    msg <- paste(prefix, 
conditionMessage(e), "\n", sep = "")    
.Internal(seterrmessage(msg[1]))    if (!silent && 
identical(getOption("show.error.messages"),         TRUE)) {        
cat(msg, file = stderr())        .Internal(printDeferredWarnings())    
}    invisible(structure(msg, class = "try-error"))})
14: try({    ns <- loadNamespace(package, c(which.lib.loc, lib.loc), 
keep.source = keep.source)    dataPath <- file.path(which.lib.loc, 
package, "data")    env <- attachNamespace(ns, pos = pos, dataPath = 
dataPath)})
15: library(foreign)

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace







I have recently applied several patches for Sun Studio 12.   I am
tempted to try Sun Studio 11 to see if there is any difference.

I guess the other alternative would be to grab the R package from
"www.sunfreeware.com".   However, most of the 3rd-party packages
on my system have been built with Sun Studio 12 - was just hoping
to be able to do the same with R.   I was also curious if anyone
else is using the latest (patched) Sun Studio 12 set of compilers
on Sun Solaris 10 (sparc) and had any luck.  I am running out of
different complier flags to try.   I have tried several different
flags and most times, the R packages will build, but everytime
that I attempt to load "foreign", it crashes.  Again, all of the
other R packages that I have tried seem to be fine - I am simply
running into trouble with "foreign" which I believe is needed for
me to install the "maptools" package.


All the best.


Jim










>
>> I have tried several different builds of version 2.5.1, 2.6.0,
>> and 2.6.1 using various different compile flags and I am able
>> to compile and check, but for whatever reason, the "foreign"
>> package crashes whenever it is loaded.   I need the "foreign"
>> package in order to install the "maptools" package.   This is
>> the error that I am getting when attempting to load "foreign":
>>
>>>> library(foreign)
>>>
>>>  *** caught segfault ***
>>> address fbb1dc40, cause 'invalid permissions'
>>>
>>> Traceback:
>>>  1: .C("spss_init", PACKAGE = "foreign")
>>>  2: fun(...)
>>>  3: doTryCatch(return(expr), name, parentenv, handler)
>>>  4: tryCatchOne(expr, names, parentenv, handlers[[1]])
>>>  5: tryCatchList(expr, classes, parentenv, handlers)
>>>  6: tryCatch(expr, error = function(e) {    call <-
>>> conditionCall(e)    if (!is.null(call)) {        if
>>> (identical(call[[1]], quote(doTryCatch)))             call <-
>>> sys.call(-4)        dcall <- deparse(call)[1]        prefix <-
>>> paste("Error in", dcall, ": ")        LONGCALL <- 30        if
>>> (nchar(dcall) > LONGCALL)             prefix <- paste(prefix, "\n\t",
>>> sep = "")    }    else prefix <- "Error : "    msg <- paste(prefix,
>>> conditionMessage(e), "\n", sep = "")
>>> .Internal(seterrmessage(msg[1]))    if (!silent &&
>>> identical(getOption("show.error.messages"),         TRUE)) {
>>> cat(msg, file = stderr())        .Internal(printDeferredWarnings())
>>> }    invisible(structure(msg, class = "try-error"))})
>>>  7: try({    fun(...)    NULL})
>>>  8: runHook(".onLoad", package, env, package.lib, package)
>>>  9: loadNamespace(package, c(which.lib.loc, lib.loc), keep.source =
>>> keep.source)
>>> 10: doTryCatch(return(expr), name, parentenv, handler)
>>> 11: tryCatchOne(expr, names, parentenv, handlers[[1]])
>>> 12: tryCatchList(expr, classes, parentenv, handlers)
>>> 13: tryCatch(expr, error = function(e) {    call <-
>>> conditionCall(e)    if (!is.null(call)) {        if
>>> (identical(call[[1]], quote(doTryCatch)))             call <-
>>> sys.call(-4)        dcall <- deparse(call)[1]        prefix <-
>>> paste("Error in", dcall, ": ")        LONGCALL <- 30        if
>>> (nchar(dcall) > LONGCALL)             prefix <- paste(prefix, "\n\t",
>>> sep = "")    }    else prefix <- "Error : "    msg <- paste(prefix,
>>> conditionMessage(e), "\n", sep = "")
>>> .Internal(seterrmessage(msg[1]))    if (!silent &&
>>> identical(getOption("show.error.messages"),         TRUE)) {
>>> cat(msg, file = stderr())        .Internal(printDeferredWarnings())
>>> }    invisible(structure(msg, class = "try-error"))})
>>> 14: try({    ns <- loadNamespace(package, c(which.lib.loc, lib.loc),
>>> keep.source = keep.source)    dataPath <- file.path(which.lib.loc,
>>> package, "data")    env <- attachNamespace(ns, pos = pos, dataPath =
>>> dataPath)})
>>> 15: library(foreign)
>>>
>>> Possible actions:
>>> 1: abort (with core dump, if enabled)
>>> 2: normal R exit
>>> 3: exit R without saving workspace
>>> 4: exit R saving workspace
>>
>>
>>
>> The latest build was compiled with the following flags:
>>
>>> ./configure --prefix=/usr/local/R-2.5.1
>>>             --with-blas
>>>             --with-lapack
>>>             --with-tcl-config=/usr/local/lib/tclConfig.sh
>>>             --with-tk-config=/usr/local/lib/tkConfig.sh
>>>             --without-iconv
>>>             R_PAPERSIZE=letter
>>>             SHLIB_CXXLDFLAGS="-G /opt/SUNWspro/lib/libCrun.so"
>>>             CC=/opt/SUNWspro/bin/cc CXX=/opt/SUNWspro/bin/CC
>>>             F77=/opt/SUNWspro/bin/f77 F90=/opt/SUNWspro/bin/f95
>>>             FC=/opt/SUNWspro/bin/f95 CFLAGS="-mt -ftrap=%none
>>> -xarch=sparcvis -fPIC -xmemalign=4s"
>>>             CXXFLAGS="-mt -ftrap=%none -xarch=sparcvis -xmemalign=4s"
>>>             FFLAGS="-mt -ftrap=%none -shared -xarch=sparcvis"
>>>             FCFLAGS="-mt -ftrap=%none -shared -xarch=sparcvis"
>>>             LDFLAGS="-V -fPIC -L/usr/local/lib -L/opt/SUNWspro/lib
>>> -L/usr/sfw/lib -L/usr/lib
>>>
>>> -R/usr/local/lib:/opt/SUNWspro/lib:/usr/sfw/lib:/usr/lib"
>>
>>
>> I have been messing with the "xmemalign" flag, but doesn't seem to 
>> have much
>> of an impact.   I am curious if there may be a simple compile flag in 
>> Sun
>> Studio 12 that can be set to fix this problem.
>>
>>
>> At any rate, if anyone has been able to successfully build on Sun 
>> Solaris 10
>> (SPARC) using Sun Studio 12 and the "foreign" package loads without
>> crashing,
>> I would be most appreciative if you could let me take a look at your
>> ".configure"
>> options.
>>
>>
>> NOTE: So far, the only package that I am having trouble with is
>> "foreign".   Everything
>> else seems to build and check ok.  In fact, when "foreign" is built,
>> there are no errors
>> reported during the compile.   Also, I have tried
>> "install.packages("foreign") from
>> within R to upgrade to the latest version of "foreign".  It compiles and
>> installs, but
>> once again, it crashes when R attempts to use it producing the
>> "segfault" error.
>>
>>
>> Any help would be most welcome.
>>
>>
>> Thanks.
>>
>>
>>
>> Jim
>>
>>
>>
>


-- 
=========================================
James T Brown
UNIX System Administrator
Depts. of Geography/Fisheries & Wildlife
107 Geography Bldg.
Michigan State University
East Lansing, MI   48824

email:  brownja at msu.edu



More information about the R-help mailing list