[Rcpp-devel] Rcpp module errors with Rcpp binary installation

Kevin Ushey kevinushey at gmail.com
Fri May 2 01:08:14 CEST 2014


Actually, to confirm: this is exactly what the build report tells you
(with a lot of macro expansion in the support of Rcpp::function)...

clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG
-I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include
-I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include"
  -fPIC  -Wall -mtune=core2 -g -O2  -c flowMatch.cpp -o flowMatch.o
flowMatch.cpp:74:2: error: reference to 'function' is ambiguous
        function( "computeMEC" , &computeMEC  , "Match clusters across
a pair of sample by mixed edge cover algorithm." ) ;
        ^
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include/Rcpp/module/Module_generated_function.h:28:6:
note: candidate found by name lookup is 'Rcpp::function'
void function( const char* name_,  OUT (*fun)(void), const char* docstring = 0){
     ^

...

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__functional_03:206:49:
note: candidate found by name lookup is 'std::__1::function'
template<class _Fp> class _LIBCPP_TYPE_VIS_ONLY function; // undefined
                                                ^

Clang does a good job of reporting error messages, so please learn how
to read them and what they are trying to tell you.

Cheers,
Kevin

On Thu, May 1, 2014 at 4:04 PM, Kevin Ushey <kevinushey at gmail.com> wrote:
> Hi Azad,
>
> Your first issue is something separate, probably due to clashing
> compiler toolchains between compiled versions of R / packages. If you
> want to dive into that further you'll need to give us some more
> information about your compiler setup.
>
> The second issue, with flowMatch, I believe this is because there is a
> clash between Rcpp::function (used for modules) and clang's
> std::function. You're probably running into this because you have
> 'using namespace std;' (which is bad practice btw -- please use
> typedefs for items in std:: you need, or qualify with std::
> explicitly).
>
> You might be able to work around it by qualifying with Rcpp::function
> explicitly.
>
> Cheers,
> Kevin
>
>
>
> On Thu, May 1, 2014 at 3:55 PM, Ariful Azad <azadcse at gmail.com> wrote:
>> Dear All,
>>
>> This question might be a repeat of an earlier question, but I will be
>> grateful if you can suggest any alternate solution to my problem.
>>
>> ------------
>> My system: Mac OS X 10.9 (Mavericks)
>> Rcpp Version: 0.11.1
>> R Version: 3.0.3
>> ----------------
>>
>> I installed Rcpp from binary using the install.package() function.
>> When I try to install a test package created by
>> Rcpp.package.skeleton('testModule', module=T)
>> I obtain the following error:
>>
>> *** installing help indices
>> ** building package indices
>> ** testing if installed package can be loaded
>> sh: line 1:  7195 Abort trap: 6
>> '/Library/Frameworks/R.framework/Resources/bin/R' --no-save --slave 2>&1 <
>> '/var/folders/pn/d49rpkj95v5_9g5q5bsz0k400000gn/T//RtmpwW5RU4/file1bff7d88ce2'
>> Warning: class "C++Object" is defined (with package slot ‘Rcpp’) but no
>> metadata object found to revise subclass information---not exported?  Making
>> a copy in package ‘testModule’
>> R(7195,0x7fff77cc8310) malloc: *** error for object 0x7fff77dd5330: pointer
>> being freed was not allocated
>> *** set a breakpoint in malloc_error_break to debug
>> ERROR: loading failed
>>
>>
>> However, the error is gone when I install Rcpp from source. So far so good
>> for me.
>> However, I have distributed my package through Bioconducor.org. Bioconducor
>> is unable to build the package in Mac OS X 10.9 (Mavericks) (similarly other
>> users of my package). They report the following error :
>>
>> flowMatch.cpp:74:2: error: reference to 'function' is ambiguous
>>         function( "computeMEC" , &computeMEC  , "Match clusters across a
>> pair of sample by mixed edge cover algorithm." ) ;
>>
>> (the detail error can be found here
>>
>> from
>> http://www.bioconductor.org/checkResults/release/bioc-LATEST/flowMatch/morelia-buildsrc.html
>>
>>
>> )
>> I don't know what Rcpp version they are using. It looks like they are not
>> building Rcpp from source.  Is there any alternative suggestion to avoid
>> this situation? (It may to be possible to instruct every users of the
>> package to install Rcpp from source).
>> The error is apparently coming from function declaration inside RCPP_MODULE
>> function("hello" , &hello  , "documentation for hello ");
>> I disabled this line and the error is gone with Rcpp installed from Binary
>> for the package created using install.package().
>>
>>
>> Notes 1: I do not see this error with Rcpp 0.10.5 installed from source in
>> Mac OS X 10.9 (Mavericks)
>> Notes 2: I do not see this error with Rcpp 0.10.5 installed from binary in
>> Mac OS X Snow Leopard (10.6.8).
>> Notes3: Bioconductor (I don't know their Rcpp version) successfully built my
>> package on Linux (Ubuntu 12.04.4 LTS) / x86_64, Windows Server 2008 R2
>> Enterprise SP1 (64-bit) / x64 and Mac OS X Snow Leopard (10.6.8) / x86_64 .
>> But their system was not able to build my package on Mac OS X Mavericks
>> (10.9.2) / x86_64
>>
>> The primary error they reported is
>>
>>
>>
>> flowMatch.cpp:74:2: error: reference to 'function' is ambiguous
>>         function( "computeMEC" , &computeMEC  , "Match clusters across a
>> pair of sample by mixed edge cover algorithm." ) ;
>>
>> If you are interested, the detail error can be found:
>> from
>> http://www.bioconductor.org/checkResults/release/bioc-LATEST/flowMatch/morelia-buildsrc.html
>>
>>
>>
>> Any suggestion to avoid this error in third party installation is much
>> appreciated.
>>
>> Regards,
>>
>> Ariful Azad
>> Post Doctoral Researcher
>> Lawrence Berkeley National Laboratory
>>
>>
>> _______________________________________________
>> 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


More information about the Rcpp-devel mailing list