[Rcpp-devel] Problems on a new Mac

Höfler, Josef josef.hoefler at tum.de
Tue Feb 28 08:30:15 CET 2012


I guess you are using Xcode 4.2 or later. There the new llvm compiler is used for g++ which is causing problems with Rcpp. This compiler is working for some Rcpp things but mainly fails. I had similar errors and couldn't get the llmv compiler to work with Rcpp. It seems that mainly all vector operations fail (like repp sugar and also your example)

You can either downgrade to Xcode 4.1 or install a gnu compiler.
I would recommend installing a gnu compiler. You can find the installation package and a tutorial here:
http://woss.name/2012/01/24/how-to-install-a-working-set-of-compilers-on-mac-os-x-10-7-lion/

for  me after changing the compiler everything worked.

josef


----------------------------------------------------------------------

Message: 1
Date: Mon, 27 Feb 2012 12:01:52 +0100
From: Sacha Epskamp <sacha.epskamp at gmail.com<mailto:sacha.epskamp at gmail.com>>
To: rcpp-devel at r-forge.wu-wien.ac.at<mailto:rcpp-devel at r-forge.wu-wien.ac.at>
Subject: Re: [Rcpp-devel] Problems on a new Mac
Message-ID:
<CAHLDboiym2Oc1-RHpQeULUpOfDbbxr2cjG9v+2uLqvLMMXe9Eg at mail.gmail.com<mailto:CAHLDboiym2Oc1-RHpQeULUpOfDbbxr2cjG9v+2uLqvLMMXe9Eg at mail.gmail.com>>
Content-Type: text/plain; charset=ISO-8859-1

Thanks for the responses. We have tried installing from source and
made sure no other versions are installed. Unfortunately without
success. Could there be anything else missing?

Sacha

Op 31 januari 2012 09:32 heeft Romain Francois
<romain at r-enthusiasts.com<mailto:romain at r-enthusiasts.com>> het volgende geschreven:
Le 30/01/12 21:38, Dirk Eddelbuettel a ?crit :


On 30 January 2012 at 18:42, Sacha Epskamp wrote:
| Last year I have written some functions for my then supervisor using
| Rcpp and inline, which worked fine. Recently my supervisor got a new
| Mac, and the functions don't work anymore.
|
| After some trying I found at least one thing that wasn't working
| properly. As an example see this function:
|
| library("inline")
| library("Rcpp")
|
| fun<-cxxfunction(, '
| NumericVector foo(3,1.0);
| return wrap(foo);
| ',plugin="Rcpp")
|
| fun()
|
| This returns the vector (1,1,1) for me, but numeric(0) for my
| supervisor (compiling seems to go fine and functions work with objects

Are you both using Rcpp 0.9.9?

Could it be that he has another version hiding in his .libPaths?

Your sample works fine for me too, as it should. (You can skip the
library(Rcpp) which inline will do for us with the given plugin for Rcpp,
and
there is no need for wrap() of an Rcpp vector type.)

Dirk


Works for me too. Did you install Rcpp from source ? Maybe that would do the
trick.

Romain


| like double). I have no idea what is going wrong. I realize this is
| probably a very system-specific problem that is hard to "fix" through
| mail, but I am hoping that you might have some ideas on what might go
| wrong or a place to start.
|
| Below are some system specifications.
|
| Best,
| Sacha Epskamp
|
| system("g++ --version")
| i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc.
| build 5658) (LLVM build 2336.1.00)
| Copyright (C) 2007 Free Software Foundation, Inc.
| This is free software; see the source for copying conditions. ?There is
NO
| warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
|
|> ?R.version
| ? ? ? ? ? ? ? ?_
| platform ? ? ? x86_64-apple-darwin9.8.0
| arch ? ? ? ? ? x86_64
| os ? ? ? ? ? ? darwin9.8.0
| system ? ? ? ? x86_64, darwin9.8.0
| status
| major ? ? ? ? ?2
| minor ? ? ? ? ?14.1
| year ? ? ? ? ? 2011
| month ? ? ? ? ?12
| day ? ? ? ? ? ?22
| svn rev ? ? ? ?57956
| language ? ? ? R
| version.string R version 2.14.1 (2011-12-22)
|> ?packageDescription("Rcpp")$Version
| [1] "0.9.9"
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-devel at lists.r-forge.r-project.org<mailto:Rcpp-devel at lists.r-forge.r-project.org>
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel



--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
R Graph Gallery: http://addictedtor.free.fr/graphiques
blog: ? ? ? ? ? ?http://romainfrancois.blog.free.fr
|- http://bit.ly/odMuw2 : R Bloggers widget in R Graph Gallery
|- http://bit.ly/oqkEap : R Graph Gallery widget in R Bloggers
`- http://bit.ly/r2teYA : Twitter updates on R Graph Gallery

_______________________________________________
Rcpp-devel mailing list
Rcpp-devel at lists.r-forge.r-project.org<mailto:Rcpp-devel at lists.r-forge.r-project.org>
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel


------------------------------

Message: 2
Date: Mon, 27 Feb 2012 17:09:44 +0000
From: Michael Braun <braunm at MIT.EDU<mailto:braunm at MIT.EDU>>
To: "<romain at r-enthusiasts.com<mailto:romain at r-enthusiasts.com>>  <romain at r-enthusiasts.com<mailto:romain at r-enthusiasts.com>>"
<romain at r-enthusiasts.com<mailto:romain at r-enthusiasts.com>>
Cc: "rcpp-devel at lists.r-forge.r-project.org<mailto:rcpp-devel at lists.r-forge.r-project.org>"
<rcpp-devel at r-forge.wu-wien.ac.at<mailto:rcpp-devel at r-forge.wu-wien.ac.at>>
Subject: Re: [Rcpp-devel] Loading Rcpp modules from dynamic library
Message-ID: <16F3B775-597A-4CC4-955E-E376A2403426 at mit.edu<mailto:16F3B775-597A-4CC4-955E-E376A2403426 at mit.edu>>
Content-Type: text/plain; charset="iso-8859-1"

Romain:

Thanks for your helpful response.  This works perfectly.

Michael



On Feb 26, 2012, at 8:50 AM, <romain at r-enthusiasts.com<mailto:romain at r-enthusiasts.com>>
<romain at r-enthusiasts.com<mailto:romain at r-enthusiasts.com>> wrote:

hello,

You can grab the result of dyn.load and use it as the PACKAGE argument of Module.

Romain


Le 26 f?vr. 2012 ? 01:11, Michael Braun <braunm at MIT.EDU<mailto:braunm at MIT.EDU>> a ?crit :

No, what I would like to do is access an Rcpp module from a dynamic library that is not part of a R package (e.g., loaded using dyn.load() ).  If I put the code in a package, there is no problem.  But what I am getting is:

library(Rcpp)
dyn.load("add.so")
mod=Module("adding")
add=new(mod$adding,1.2,3.4)
Error in Module(module, mustStart = TRUE) :
Failed to initialize module pointer: Error in FUN("_rcpp_module_boot_adding"[[1L]], ...): no such symbol _rcpp_module_boot_adding in package .GlobalEnv

The packages that you reference are all, well, packages, and from what I can tell about .onLoad(), that applies only to packages.  And the loadRcppModules function, apparently, must be called from an .onLoad function (because I get an error message to that effect).

I have never had a problem loading compiled functions this way; it appears to be only an issue with modules.

I would appreciate some helpful suggestions from anyone in R-land who may have had some success with this (e.g., specific documentation pages to look at, code snippets that have worked for others, or other useful suggestions on what to try next).  Of course, if what I want to do is known to be impossible, that would also be a helpful response.

Respectfully,

Michael


On Feb 25, 2012, at 3:24 PM, Dirk Eddelbuettel wrote:


Hi Michael,

On 25 February 2012 at 19:45, Michael Braun wrote:
| Hi.  I would like to start using Rcpp modules in my code, but I am having some
| trouble loading them into R.  Here is an example:

My personal approach is to follow the path of least resistance on __start
from an existing package__ having the feature I want to use.

Rcpp comes with modules-using packages as part of the documentation (Rcpp
modules vignette) and unit tests. And there is even a package skeleton
generator (for which you can set an option to use modules).

And among the now 55 CRAN packages using Rcpp (!!), a few use modules
too. One is my RcppBDT package, there are the two packages by Baptiste (cda,
planar) and probably a few more but one can't tell from the DESCRIPTION.

Your code may have been fine, but you also need to look at the .onLoad or
.onAttach function etc.  So starting from a working stanza really strikes me
as easiest.

Hth, Dirk

--
"Outside of a dog, a book is a man's best friend. Inside of a dog, it is too
dark to read." -- Groucho Marx



_______________________________________________
Rcpp-devel mailing list
Rcpp-devel at lists.r-forge.r-project.org<mailto:Rcpp-devel at lists.r-forge.r-project.org>
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Michael Braun
MIT Sloan School of Management
braunm at mit.edu<mailto:braunm at mit.edu>
--------------------------------------------------
View my research at
http://braunm.scripts.mit.edu/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20120227/fd976f33/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1844 bytes
Desc: not available
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20120227/fd976f33/attachment-0001.bin>

------------------------------

Message: 3
Date: Mon, 27 Feb 2012 17:23:00 -0800
From: "Comanor, Katherine" <comanor at a9.com>
To: "rcpp-devel at lists.r-forge.r-project.org"
<rcpp-devel at r-forge.wu-wien.ac.at>
Subject: [Rcpp-devel] Problem with undefined symbols when building
RcppArmadillo
Message-ID: <CB716C74.34EB%comanor at amazon.com>
Content-Type: text/plain; charset="windows-1252"

Hello Dirk,

I went through the thread at: http://www.digipedia.pl/usenet/thread/14655/781/ as I seem to be running into the same problem, but wasn't able to determine a possible solution.

Basically, I'm trying to build R's RcppArmadillo, and although the build does succeed, it has undefined symbols in the binary library file RcppAramdillo.so which causes R's Forecast library, which depends on RcppArmadillo, not to build as a result of these undefined symbols.  I'm trying to build Forecast 3.16 using RcppArmadillo 0.2.34 and Rcpp 0.9.9.

Here are the undefined symbols dealing with "version":

nm RcppArmadillo.so| grep -i version
000000000001022e t _GLOBAL__I_armadillo_version
                U _ZN4arma12arma_version5majorE
                U _ZN4arma12arma_version5minorE
                U _ZN4arma12arma_version5patchE

Here are the error messages I get when trying to build R's Forecast library:
Error in dyn.load(file, DLLpath = DLLpath, ...) :
 unable to load shared object '/rhel5pdi/workplace/comanor-ws/build/RsRcppArmadillo/RsRcppArmadillo-0.2.34/RHEL5_64/DEV.STD.PTHREAD/build/lib64/R/library/RcppArmadillo/libs/RcppArmadillo.so':
 /rhel5pdi/workplace/comanor-ws/build/RsRcppArmadillo/RsRcppArmadillo-0.2.34/RHEL5_64/DEV.STD.PTHREAD/build/lib64/R/library/RcppArmadillo/libs/RcppArmadillo.so: undefined symbol: _ZN4arma12arma_version5majorE
Error : package ?RcppArmadillo? could not be loaded
ERROR: lazy loading failed for package ?forecast?

----
Is there a specific compiler option that's necessary when building RcppArmadillo?  Is this a known bug that was fixed in version 0.2.35?

Thank you for your help with this issue.  Much appreciated,

Katherine
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20120227/9622e7c3/attachment.html>

------------------------------

_______________________________________________
Rcpp-devel mailing list
Rcpp-devel at lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

End of Rcpp-devel Digest, Vol 28, Issue 41
******************************************

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20120228/3612d536/attachment-0001.html>


More information about the Rcpp-devel mailing list