[Rcpp-devel] Installation Problem

Dirk Eddelbuettel edd at debian.org
Wed Mar 23 12:49:50 CET 2011


Hi Sean,

On 23 March 2011 at 00:20, Sean Robert McGuffee wrote:
| Hi,
| I’m new to using C++ inside of R. I got a test program to work, so
| it’s time for me to attach some function to it. I seem to be having
| some issues though. I wonder if anyone out there can help me
| understand the results I am getting. I’ve got to a point where it
| seems to me that everything is installing but then afterwards it

Everything is _compiling_ and _linking_ which is good but...

| segmentation faults. In particular the following are the parts where
| the problem comes up:
| ** testing if installed package can be loaded
|  *** caught segfault ***
| address 0x20, cause 'memory not mapped'

...when the build process tries to load the package you are building you get
a run-time error as is clearly shown by the traceback. Some initalization
goes nelly-up, could be your C++ code or your other library
(libsrm.SeanBenchGcc ?).

Can you reducde the problem to something simpler?

| If anyone has any suggestions, please let me know. The full version of
| the installation command and results is below:

We would need to see what you do in file R/zzz.R and the .onLoad() function
(assuming you use a NAMESPACE).  Else we'd need the equivalent .First.lib()
function. 

Dirk


PS:

| . (trimmed because the group has a ridiculous size limit)

That is the mailman default of 40kb. We usually don't need that much.

| g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include
| -I/Library/Frameworks/R.framework/Resources/include/x86_64
| -I/usr/local/include
| -I/WHITEHOUSE_LAB/WHITEHOUSE_LAB_PROGRAMS/LIBSRM/INC/
| -I"/Library/Frameworks/R.framework/Versions/2.12/Resources/library/Rcpp/include"
|   -fPIC  -g -O2 -c char_traits_specialized_for_srm.cpp -o
| char_traits_specialized_for_srm.o
| g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include
| -I/Library/Frameworks/R.framework/Resources/include/x86_64
| -I/usr/local/include
| -I/WHITEHOUSE_LAB/WHITEHOUSE_LAB_PROGRAMS/LIBSRM/INC/
| -I"/Library/Frameworks/R.framework/Versions/2.12/Resources/library/Rcpp/include"
|   -fPIC  -g -O2 -c colorSpaceToSequenceSpace.cpp -o
| colorSpaceToSequenceSpace.o
| g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include
| -I/Library/Frameworks/R.framework/Resources/include/x86_64
| -I/usr/local/include
| -I/WHITEHOUSE_LAB/WHITEHOUSE_LAB_PROGRAMS/LIBSRM/INC/
| -I"/Library/Frameworks/R.framework/Versions/2.12/Resources/library/Rcpp/include"
|   -fPIC  -g -O2 -c genomeDataBase.cpp -o genomeDataBase.o
| 
| Attaching package: 'utils'
| 
| The following object(s) are masked from 'package:Rcpp':
| 
|     .DollarNames, prompt
| 
| The following object(s) are masked from 'package:inline':
| 
|     package.skeleton
| 
| g++ -arch x86_64 -dynamiclib -Wl,-headerpad_max_install_names
| -undefined dynamic_lookup -single_module -multiply_defined suppress
| -L/usr/local/lib -o alignR.so CAlias.o CBedFileLine.o
| CBiologicalSymbol.o CClusterData.o CComparisonFunctions.o
| CFourLetterChar.o CIndexedSequenceSet.o CLengthMappedSequenceSet.o
| CMappedSequence.o CMappedSequenceSet.o CNucleicAcidChar.o CSRM.o
| CSRMAlignment.o CSRMArgs.o CSRMColorSpace.o CSRMCurveFit.o
| CSRMDNAFeatures.o CSRMFasta.o CSRMFileStuff.o CSRMGenomeDataBase.o
| CSRMMath.o CSRMOverlapStats.o CSRMPDB.o CSRMSharkDataSource.o
| CSRMSharkFFNet.o CSRMString.o CSRMTabbedData.o CSRMThread.o
| CSequence.o CSequenceSet.o CSequenceSetLocation.o CStringDNA.o CTab.o
| CTabData.o CTabDataSet.o C_Atom.o C_BED.o
| C_CategoriesOfExpressionData.o C_Correlation.o C_GFF.o C_GO.o
| C_Histogram.o C_MIX_BED_AND_SGD.o C_Mechanics.o
| C_Mix_Comparison_And_Cluster.o C_Mix_Comparison_And_Fasta.o
| C_Mix_Comparison_And_Sgr.o C_Mix_GFF_And_SGD.o
| C_Mix_GFF_And_Transcript.o C_Mix_GFF_And_TypeOfTranscript.o
| C_Mix_GenomeDataBase_And_SGR.o C_Mix_SGR_FASTA.o
| C_Mix_Transcript_And_TranscriptGroup.o C_MultiHistogram.o
| C_PeriodicTable.o C_RandomNumberGenerator.o C_SGD.o C_SGR.o
| C_SGR_Chromosome.o C_SequenceStats.o C_SizeRange.o C_Superimpose.o
| C_Transcript.o C_TranscriptGroup.o C_TypeOfAtom.o C_TypeOfTranscript.o
| C_XYZ.o CssFASTA.o Sequence.o SequenceSet.o SgrFile.o
| char_traits_specialized_for_srm.o colorSpaceToSequenceSpace.o
| genomeDataBase.o
| /Library/Frameworks/R.framework/Versions/2.12/Resources/library/Rcpp/lib/x86_64/libRcpp.a
| /WHITEHOUSE_LAB/WHITEHOUSE_LAB_PROGRAMS/LIBSRM/LIB/libsrm.SeanBenchGcc.so
| -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework
| -Wl,CoreFoundation
| 
| Attaching package: 'utils'
| 
| The following object(s) are masked from 'package:Rcpp':
| 
|     .DollarNames, prompt
| 
| The following object(s) are masked from 'package:inline':
| 
|     package.skeleton
| 
| installing to /Users/smcguffee/Library/R/2.12/library/alignR/libs/x86_64
| ** R
| ** preparing package for lazy loading
| ** help
| *** installing help indices
| ** building package indices ...
| ** testing if installed package can be loaded
| 
|  *** caught segfault ***
| address 0x20, cause 'memory not mapped'
| 
| Traceback:
|  1: dyn.load(file, DLLpath = DLLpath, ...)
|  2: library.dynam(lib, package, package.lib)
|  3: loadNamespace(package, c(which.lib.loc, lib.loc), keep.source = keep.source)
|  4: doTryCatch(return(expr), name, parentenv, handler)
|  5: tryCatchOne(expr, names, parentenv, handlers[[1L]])
|  6: tryCatchList(expr, classes, parentenv, handlers)
|  7: tryCatch(expr, error = function(e) {    call <- conditionCall(e)
|  if (!is.null(call)) {        if (identical(call[[1L]],
| quote(doTryCatch)))             call <- sys.call(-4L)        dcall <-
| deparse(call)[1L]        prefix <- paste("Error in", dcall, ": ")
|   LONG <- 75L        msg <- conditionMessage(e)        sm <-
| strsplit(msg, "\n")[[1L]]        w <- 14L + nchar(dcall, type = "w") +
| nchar(sm[1L], type = "w")        if (is.na(w))             w <- 14L +
| nchar(dcall, type = "b") + nchar(sm[1L],                 type = "b")
|      if (w > LONG)             prefix <- paste(prefix, "\n  ", sep =
| "")    }    else prefix <- "Error : "    msg <- paste(prefix,
| conditionMessage(e), "\n", sep = "")
| .Internal(seterrmessage(msg[1L]))    if (!silent &&
| identical(getOption("show.error.messages"),         TRUE)) {
| cat(msg, file = stderr())        .Internal(printDeferredWarnings())
| }    invisible(structure(msg, class = "try-error"))})
|  8: 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,         deps)})
|  9: library(pkg_name, lib.loc = lib, character.only = TRUE,
| logical.return = TRUE)
| 10: withCallingHandlers(expr, packageStartupMessage = function(c)
| invokeRestart("muffleMessage"))
| 11: suppressPackageStartupMessages(library(pkg_name, lib.loc = lib,
|  character.only = TRUE, logical.return = TRUE))
| 12: doTryCatch(return(expr), name, parentenv, handler)
| 13: tryCatchOne(expr, names, parentenv, handlers[[1L]])
| 14: tryCatchList(expr, classes, parentenv, handlers)
| 15: tryCatch(expr, error = function(e) {    call <- conditionCall(e)
|  if (!is.null(call)) {        if (identical(call[[1L]],
| quote(doTryCatch)))             call <- sys.call(-4L)        dcall <-
| deparse(call)[1L]        prefix <- paste("Error in", dcall, ": ")
|   LONG <- 75L        msg <- conditionMessage(e)        sm <-
| strsplit(msg, "\n")[[1L]]        w <- 14L + nchar(dcall, type = "w") +
| nchar(sm[1L], type = "w")        if (is.na(w))             w <- 14L +
| nchar(dcall, type = "b") + nchar(sm[1L],                 type = "b")
|      if (w > LONG)             prefix <- paste(prefix, "\n  ", sep =
| "")    }    else prefix <- "Error : "    msg <- paste(prefix,
| conditionMessage(e), "\n", sep = "")
| .Internal(seterrmessage(msg[1L]))    if (!silent &&
| identical(getOption("show.error.messages"),         TRUE)) {
| cat(msg, file = stderr())        .Internal(printDeferredWarnings())
| }    invisible(structure(msg, class = "try-error"))})
| 16: try(suppressPackageStartupMessages(library(pkg_name, lib.loc =
| lib,     character.only = TRUE, logical.return = TRUE)))
| 17: do_install_source(pkg_name, instdir, pkg, desc)
| 18: do_install(pkg)
| 19: tools:::.install_packages()
| aborting ...
| /Library/Frameworks/R.framework/Resources/bin/INSTALL: line 34: 24298
| Done                    echo 'tools:::.install_packages()'
|      24299 Segmentation fault      | R_DEFAULT_PACKAGES= LC_COLLATE=C
| "${R_HOME}/bin/R" $myArgs --slave --args ${args}
| Warning message:
| In install.packages("/Users/smcguffee/WHITEHOUSE_LAB/WHITEHOUSE_LAB_PROGRAMS_HOME/R_PACKAGES/alignR_1.0.tar.gz",
|  :
|   installation of package
| '/Users/smcguffee/WHITEHOUSE_LAB/WHITEHOUSE_LAB_PROGRAMS_HOME/R_PACKAGES/alignR_1.0.tar.gz'
| had non-zero exit status


-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com


More information about the Rcpp-devel mailing list