<div dir="ltr"><div>In your original post you mention the "pointer being freed was not allocated" error message. I have just tracked this down in another context (Octave<br>under Mac OS X). In my case the error occurs on the dlopen() call for<br>

an R package shared library. The fix was to make sure all apps and libs<br>are updated after moving to Mavericks. See the thread in rcppoctave-users<br></div><div>list for a blow-by-blow description.<br></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Fri, Nov 1, 2013 at 1:11 PM, Simon Zehnder <span dir="ltr"><<a href="mailto:szehnder@uni-bonn.de" target="_blank">szehnder@uni-bonn.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
You are right, working with apple and C++ is often a mess. Up to now, llvm does not yet support openmp. It is coming but I do not see it fully implemented before next summer. If I want to use openmp I have thus to rely on the gcc which brings a lot of problems with it and from what I read on the R-lists most of the Mac Users suffer. I guess that this time a reinstall of R was unavoidable for most of us. I thought about using the xcrun —find gcc/g++ etc. to get what is needed in a Makevars but this does not give anything so far.<br>

<div class="HOEnZb"><div class="h5"><br>
<br>
On 01 Nov 2013, at 17:50, Dominick Samperi <<a href="mailto:djsamperi@gmail.com">djsamperi@gmail.com</a>> wrote:<br>
<br>
> With Apple moving from gcc/g++ to LLVM/clang++ I guess it makes sense<br>
> for R/Rcpp to use the LLVM/clang++ tool chain eventuallly, but I don't know<br>
> if there are plans to do this. Otherwise, the R community would need to<br>
> support "MACtools" following the model provided by "Rtools" under Windows...<br>
><br>
><br>
> On Fri, Nov 1, 2013 at 12:12 PM, Simon Zehnder <<a href="mailto:szehnder@uni-bonn.de">szehnder@uni-bonn.de</a>> wrote:<br>
> Hi Dominick,<br>
><br>
> I did install files from brew but instead used the gcc from <a href="http://hpc.sourceforge.net" target="_blank">http://hpc.sourceforge.net</a><br>
><br>
><br>
> On 01 Nov 2013, at 16:55, Dominick Samperi <<a href="mailto:djsamperi@gmail.com">djsamperi@gmail.com</a>> wrote:<br>
><br>
> > If you depend on tools installed using brew, you might want to try<br>
> > removing those that were installed before the Mavericks update,<br>
> > using:<br>
> > rm -rf /usr/local/Cellar<br>
> > brew prune<br>
> > brew doctor<br>
> > brew install <what-you-need><br>
> ><br>
> ><br>
> > On Fri, Nov 1, 2013 at 11:19 AM, Simon Zehnder <<a href="mailto:szehnder@uni-bonn.de">szehnder@uni-bonn.de</a>> wrote:<br>
> > Point landing J.J.!<br>
> ><br>
> > I already compiled a new R when Mavericks came out with a newly installed a gcc-4.8.2, that I can load via environment modules. I also installed the Xcode Command Line Tools for Mavericks.<br>
> ><br>
> > I now reinstalled Rcpp with the gcc-4.8.2 and threw away all object and shared-object files in my /src/ folder of my package. The problem remains. Is there something special I can look for in my Makeconf file? What is so different about ‘compileAttributes’ in contrast to ‘sourceCpp’ or a usual package compilation via R CMD INSTALL? Does compileAttributes uses some additional flags and/or libraries?<br>

> ><br>
> > Best<br>
> > Simon<br>
> ><br>
> ><br>
> ><br>
> > On 01 Nov 2013, at 15:56, JJ Allaire <<a href="mailto:jj.allaire@gmail.com">jj.allaire@gmail.com</a>> wrote:<br>
> ><br>
> > > Are you by any chance on OS X Mavericks? I had one other user report this specific error on Mavericks and it seemed to be related to the use of different compilers (and thus different heaps) within the same compilation (there is exposure to this with the changes made by Apple to the toolchain in Mavericks).<br>

> > ><br>
> > > J.J.<br>
> > ><br>
> > ><br>
> > > On Fri, Nov 1, 2013 at 10:01 AM, Simon Zehnder <<a href="mailto:szehnder@uni-bonn.de">szehnder@uni-bonn.de</a>> wrote:<br>
> > > Dear Rcpp::Users and Rcpp::Devels,<br>
> > ><br>
> > > I get a weird exception when I try to compile an attribute in one of my packages:<br>
> > ><br>
> > > compileAttributes("/Users/simonzehnder/git/mmstruct/mmstruct/")<br>
> > > R(6256,0x7fff79ad9310) malloc: *** error for object 0x7fff7ac48330: pointer being freed was not allocated<br>
> > > *** set a breakpoint in malloc_error_break to debug<br>
> > > Abort trap: 6<br>
> > ><br>
> > > If I instead use the sourceCpp function all works fine:<br>
> > ><br>
> > > sourceCpp("/Users/simonzehnder/git/mmstruct/mmstruct/src/testing.cpp”)<br>
> > > testfunction_cc(c(0,0,0), list(trades = rnorm(10), T = 360))<br>
> > > [1] 0.000000e+00 3.509927e-05 1.169976e-05<br>
> > ><br>
> > > The function in my file is actually pretty simple (and its the only one):<br>
> > ><br>
> > > #include<Rcpp.h><br>
> > ><br>
> > > // [[Rcpp::export]]<br>
> > ><br>
> > > Rcpp::NumericVector testfunction_cc(Rcpp::NumericVector par,<br>
> > >         Rcpp::List list)<br>
> > > {<br>
> > >     const unsigned int K        = par.size();<br>
> > >     Rcpp::NumericVector trades  = list["trades"];<br>
> > >     const unsigned int T        = list["T"];<br>
> > >     double tmp = mean(trades)/T;<br>
> > >     std::vector<double> startp(K);<br>
> > >     startp[0] = 0.0;<br>
> > >     startp[1] = tmp * 0.75/2;<br>
> > >     startp[2] = tmp * 0.25/2;<br>
> > ><br>
> > >     return Rcpp::wrap(startp);<br>
> > > }<br>
> > ><br>
> > > At this moment I am a little perplexed. Where should I search for a possible error? What are things to try out?<br>
> > ><br>
> > > Best<br>
> > ><br>
> > > Simon<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>
> > ><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>
> ><br>
><br>
><br>
<br>
</div></div></blockquote></div><br></div>