<div dir="ltr"><div><div><div><div><div>Thanks Kevin for the prompt reply. <br>As a quick fix to the Bioconductor problem (2nd issue), I used Rcpp::function in the Rcpp module (replacing using namespace std will be more work at this point). I will have to wait till Saturday to see the build result. I am surprised that they don't have the error in other platforms except Maverick.  <br>

<br></div>It is possible that the first problem stems from library conflicts in my machine. But note that this problem only arises when:<br></div>1. I build Rcpp from binary<br><br></div>This problem does not show up<br>
</div>
1. when I build Rcpp from source code, or<br></div>2. when I build Rcpp from binary but there is no function declaration inside Rcpp module. (even Rcpp::function gives me the same error when Rcpp is built from binary).<br>

<br><br><div><div><div><div><div><div><div><div><div>I will try to clean up my compiler toolchain and see if the problem can be removed. (I replaced clang++ with g++ for another reason. This process might create some problem).<br>

<br></div><div>Thanks again for your help.<br><br></div><div>--<br></div><div><br>Ariful Azad<br></div><div><br></div></div></div></div></div></div></div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">

On Thu, May 1, 2014 at 4:08 PM, Kevin Ushey <span dir="ltr"><<a href="mailto:kevinushey@gmail.com" target="_blank">kevinushey@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Actually, to confirm: this is exactly what the build report tells you<br>
(with a lot of macro expansion in the support of Rcpp::function)...<br>
<br>
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG<br>
-I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include<br>
-I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include"<br>
  -fPIC  -Wall -mtune=core2 -g -O2  -c flowMatch.cpp -o flowMatch.o<br>
<div class="">flowMatch.cpp:74:2: error: reference to 'function' is ambiguous<br>
        function( "computeMEC" , &computeMEC  , "Match clusters across<br>
a pair of sample by mixed edge cover algorithm." ) ;<br>
</div>        ^<br>
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include/Rcpp/module/Module_generated_function.h:28:6:<br>
note: candidate found by name lookup is 'Rcpp::function'<br>
void function( const char* name_,  OUT (*fun)(void), const char* docstring = 0){<br>
     ^<br>
<br>
...<br>
<br>
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__functional_03:206:49:<br>
note: candidate found by name lookup is 'std::__1::function'<br>
template<class _Fp> class _LIBCPP_TYPE_VIS_ONLY function; // undefined<br>
                                                ^<br>
<br>
Clang does a good job of reporting error messages, so please learn how<br>
to read them and what they are trying to tell you.<br>
<br>
Cheers,<br>
Kevin<br>
<div class="HOEnZb"><div class="h5"><br>
On Thu, May 1, 2014 at 4:04 PM, Kevin Ushey <<a href="mailto:kevinushey@gmail.com">kevinushey@gmail.com</a>> wrote:<br>
> Hi Azad,<br>
><br>
> Your first issue is something separate, probably due to clashing<br>
> compiler toolchains between compiled versions of R / packages. If you<br>
> want to dive into that further you'll need to give us some more<br>
> information about your compiler setup.<br>
><br>
> The second issue, with flowMatch, I believe this is because there is a<br>
> clash between Rcpp::function (used for modules) and clang's<br>
> std::function. You're probably running into this because you have<br>
> 'using namespace std;' (which is bad practice btw -- please use<br>
> typedefs for items in std:: you need, or qualify with std::<br>
> explicitly).<br>
><br>
> You might be able to work around it by qualifying with Rcpp::function<br>
> explicitly.<br>
><br>
> Cheers,<br>
> Kevin<br>
><br>
><br>
><br>
> On Thu, May 1, 2014 at 3:55 PM, Ariful Azad <<a href="mailto:azadcse@gmail.com">azadcse@gmail.com</a>> wrote:<br>
>> Dear All,<br>
>><br>
>> This question might be a repeat of an earlier question, but I will be<br>
>> grateful if you can suggest any alternate solution to my problem.<br>
>><br>
>> ------------<br>
>> My system: Mac OS X 10.9 (Mavericks)<br>
>> Rcpp Version: 0.11.1<br>
>> R Version: 3.0.3<br>
>> ----------------<br>
>><br>
>> I installed Rcpp from binary using the install.package() function.<br>
>> When I try to install a test package created by<br>
>> Rcpp.package.skeleton('testModule', module=T)<br>
>> I obtain the following error:<br>
>><br>
>> *** installing help indices<br>
>> ** building package indices<br>
>> ** testing if installed package can be loaded<br>
>> sh: line 1:  7195 Abort trap: 6<br>
>> '/Library/Frameworks/R.framework/Resources/bin/R' --no-save --slave 2>&1 <<br>
>> '/var/folders/pn/d49rpkj95v5_9g5q5bsz0k400000gn/T//RtmpwW5RU4/file1bff7d88ce2'<br>
>> Warning: class "C++Object" is defined (with package slot ‘Rcpp’) but no<br>
>> metadata object found to revise subclass information---not exported?  Making<br>
>> a copy in package ‘testModule’<br>
>> R(7195,0x7fff77cc8310) malloc: *** error for object 0x7fff77dd5330: pointer<br>
>> being freed was not allocated<br>
>> *** set a breakpoint in malloc_error_break to debug<br>
>> ERROR: loading failed<br>
>><br>
>><br>
>> However, the error is gone when I install Rcpp from source. So far so good<br>
>> for me.<br>
>> However, I have distributed my package through Bioconducor.org. Bioconducor<br>
>> is unable to build the package in Mac OS X 10.9 (Mavericks) (similarly other<br>
>> users of my package). They report the following error :<br>
>><br>
>> flowMatch.cpp:74:2: error: reference to 'function' is ambiguous<br>
>>         function( "computeMEC" , &computeMEC  , "Match clusters across a<br>
>> pair of sample by mixed edge cover algorithm." ) ;<br>
>><br>
>> (the detail error can be found here<br>
>><br>
>> from<br>
>> <a href="http://www.bioconductor.org/checkResults/release/bioc-LATEST/flowMatch/morelia-buildsrc.html" target="_blank">http://www.bioconductor.org/checkResults/release/bioc-LATEST/flowMatch/morelia-buildsrc.html</a><br>


>><br>
>><br>
>> )<br>
>> I don't know what Rcpp version they are using. It looks like they are not<br>
>> building Rcpp from source.  Is there any alternative suggestion to avoid<br>
>> this situation? (It may to be possible to instruct every users of the<br>
>> package to install Rcpp from source).<br>
>> The error is apparently coming from function declaration inside RCPP_MODULE<br>
>> function("hello" , &hello  , "documentation for hello ");<br>
>> I disabled this line and the error is gone with Rcpp installed from Binary<br>
>> for the package created using install.package().<br>
>><br>
>><br>
>> Notes 1: I do not see this error with Rcpp 0.10.5 installed from source in<br>
>> Mac OS X 10.9 (Mavericks)<br>
>> Notes 2: I do not see this error with Rcpp 0.10.5 installed from binary in<br>
>> Mac OS X Snow Leopard (10.6.8).<br>
>> Notes3: Bioconductor (I don't know their Rcpp version) successfully built my<br>
>> package on Linux (Ubuntu 12.04.4 LTS) / x86_64, Windows Server 2008 R2<br>
>> Enterprise SP1 (64-bit) / x64 and Mac OS X Snow Leopard (10.6.8) / x86_64 .<br>
>> But their system was not able to build my package on Mac OS X Mavericks<br>
>> (10.9.2) / x86_64<br>
>><br>
>> The primary error they reported is<br>
>><br>
>><br>
>><br>
>> flowMatch.cpp:74:2: error: reference to 'function' is ambiguous<br>
>>         function( "computeMEC" , &computeMEC  , "Match clusters across a<br>
>> pair of sample by mixed edge cover algorithm." ) ;<br>
>><br>
>> If you are interested, the detail error can be found:<br>
>> from<br>
>> <a href="http://www.bioconductor.org/checkResults/release/bioc-LATEST/flowMatch/morelia-buildsrc.html" target="_blank">http://www.bioconductor.org/checkResults/release/bioc-LATEST/flowMatch/morelia-buildsrc.html</a><br>


>><br>
>><br>
>><br>
>> Any suggestion to avoid this error in third party installation is much<br>
>> appreciated.<br>
>><br>
>> Regards,<br>
>><br>
>> Ariful Azad<br>
>> Post Doctoral Researcher<br>
>> Lawrence Berkeley National Laboratory<br>
>><br>
>><br>
>> _______________________________________________<br>
>> Rcpp-devel mailing list<br>
>> <a href="mailto:Rcpp-devel@lists.r-forge.r-project.org">Rcpp-devel@lists.r-forge.r-project.org</a><br>
>> <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>
</div></div></blockquote></div><br></div>