<div dir="ltr">I tried to build RcppOctave under Mac OS X (10.8.5) but ran into<div>a few problems.</div><div><br></div><div style>1. In src/modules/Makefile.in, the '-F' flag (for framework) is not</div><div style>
    recognized by mkoctfile, so I added this temporary work-around:</div><div style><br></div><div style><div>#R_LDFLAGS = @R_LDFLAGS@</div><div>R_LDFLAGS = -L/Library/Frameworks/R.framework/Libraries -lR</div><div><br></div>
<div style>2. Parsing the man files o_whatever.Rd fails (attempt to</div><div style>    free an unallocated pointer), so I removed all of these</div><div style>    man pages for now (the failure occurs in</div><div style>
   <R>/src/library/tools/R/Rd.R, function .build_Rd_db(),</div><div style>   where .fetch_Rd_object is applied to each Rd file).</div><div style><br></div><div style>3. With these changes the build gets to the point where</div>
<div style>    the install process checks if the package can be</div><div style>    loaded, and fails with:</div><div style><br></div><div style><div>** testing if installed package can be loaded</div><div>sh: line 1: 55395 Abort trap: 6           '/Library/Frameworks/R.framework/Resources/bin/R' --no-save --slave 2>&1 < '/var/folders/fq/2th4vc9n1mq9cxv5nl9bmzkc0000gn/T//RtmpbjkEA7/filed5d471d0dd21'</div>
<div>R(55395) malloc: *** error for object 0x7fff7684d570: pointer being freed was not allocated</div><div>*** set a breakpoint in malloc_error_break to debug</div><div>ERROR: loading failed</div><div>* removing ‘/Users/dsamperi/Library/R/3.0/library/RcppOctave’</div>
<div>* restoring previous ‘/Users/dsamperi/Library/R/3.0/library/RcppOctave’</div><div><br></div><div style>4. If I ignore this and try to run library(RcppOctave) in R I get:</div><div style><br></div><div style><div>> library(RcppOctave)</div>
<div>Loading required package: Rcpp</div><div>Loading required package: pkgmaker</div><div>Loading required package: registry</div><div>R(55403) malloc: *** error for object 0x7fff7684d570: pointer being freed was not allocated</div>
<div>*** set a breakpoint in malloc_error_break to debug</div><div>Abort trap: 6</div><div><br></div><div style>5. Setting the breakpoint as instructed was not very helpful</div><div style>as the malloc code does not have symbols and cannot be</div>
<div style>traced.</div></div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Oct 8, 2013 at 10:27 AM, Renaud Gaujoux <span dir="ltr"><<a href="mailto:renaud@mancala.cbio.uct.ac.za" target="_blank">renaud@mancala.cbio.uct.ac.za</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Yes, I also sporadically got this error. Don't know the origin, although it may happen because Rtools is not in the path anymore: there may be some conflict/mess up with dlls, which are present in Rtools and Octave, while the package was compiled against Rtools ones. Possible or fantasy?<br>

<br></div>I updated both github and my CRAN repo, with a new version that has a cleaner loading procedure.<br></div><div>I have just asked CRAN if they could install Octave on Win-builder so that I can check the package on their Windows machine. On my box I am getting strange errors when checking about not being able to read the DESCRIPTION file... very weird.<br>

</div><div><br></div><div>Bests,<br></div>Renaud<br><div><div><br><br></div></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On 8 October 2013 15:47, Dominick Samperi <span dir="ltr"><<a href="mailto:djsamperi@gmail.com" target="_blank">djsamperi@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I just installed the binary with Rtools not on my path (but with R in PATH)<br>and the first time I tried to load/unload RcppOctave I got the obscure<br>

</div><div>Windows load error (app terminated "in an unusual way"), but now I<br>
cannot reproduce it! If you are linking to the static Rcpp lib there<br>should be no problems.<br><br></div><div>I guess the source distribution is not in sync with the binary?<br></div></div><div><div>
<div class="gmail_extra"><br>
<br><div class="gmail_quote">On Tue, Oct 8, 2013 at 2:11 AM, Renaud <span dir="ltr"><<a href="mailto:getoxxx@gmail.com" target="_blank">getoxxx@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


Good. Still wondering why path to Rcpp.dll is needed when installing the binary package since RcppOctave.dll is linked static to Rcpp.a with full path specified. Most users will use the binary and not build it from source (which requires Rtools and possibly more config.<div>



<br><div>Did you try installing the binary directly from the repo (with only octave bin/ in the path, not Rtools nor R)?</div><span><font color="#888888"><div><br></div></font></span><div><span><font color="#888888">Renaud</font></span><div>


<div><span></span><br><div><br>On Monday, October 7, 2013, Dominick Samperi  wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div>I don't think you need to worry about linking against the .dll files, as the<br>



</div>import libraries (.dll.a files) contain all of the information that the linker needs,<br>
</div>and you PATH will tell Windows where to find the corresponding dll's.<br></div>It is possible to link against the dll's without using import libs, <br>but then various tricks have to be used to specify what is <br>




exported from each dll.<br><br></div>I downloaded the source for 0.10.1 and it seems to build and install<br></div>ok provided I place Rcpp.dll on PATH. It would save the user some<br>trouble if PATH could be updated automatically, but it is probably not<br>




a good idea to have R package installation or startup update the users<br></div>environment...<br><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Oct 7, 2013 at 10:52 AM, Renaud Gaujoux <span dir="ltr"><<a>renaud@mancala.cbio.uct.ac.za</a>></span> wrote:<br>




<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div>Thanks for the details Dominick.<br></div>I think I got it working now, by ad Octave bin directory to the path prior loading RcppOctave library.<br>




</div><div>I tested it by renaming the Octave root directory into something different than at building time.<br>
<br></div><div>I added the option to specify Octave path via option octave.path (e.g., see ?OctaveInit), so that the package loads fine even if Octave is not installed/found. The user can also define this option in the .Rprofile if Octave is not installed in the path by default.<br>





</div><div><br></div>Please let me know if it works for you:<br><br></div><div>install.packages('RcppOctave', repos = c(getOption('repos'), '<a href="http://web.cbio.uct.ac.za/~renaud/CRAN'" target="_blank">http://web.cbio.uct.ac.za/~renaud/CRAN'</a>))<br>





</div></div>library(RcppOctave)<br></div>.O$rand()<br><br></div><div>Note that this version (0.10.1) was linked against the .dll.a files, but will load the .dll files... I will try later to link against the .dll files as you suggested.<br>





</div><div><br></div><div>Bests,<br></div>Renaud<br><div><div><br></div></div></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On 7 October 2013 16:24, Dominick Samperi <span dir="ltr"><<a>djsamperi@gmail.com</a>></span> wrote:<br>





<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>Yes, I placed Octave bin on my path. This is required to find its dll's for the same reason<br>





that Rcpp libs (directory containing Rcpp.dll) needs to be on PATH. If you enable clients<br>
</div>of RcppOctave.dll to link against functions provided by RcppOctave, then these clients<br>will have to add the RcppOctave libs directory to their PATH.<br><br></div>The Octave dll's must be in its bin directory due to another Windows dll search rule:<br>






</div>when you run an executable (like octave.exe) that depends on dll's, Windows will<br>resolve the dependencies when the dll's are in the same directory as the executable.<br><br></div><div>You should be able to link to liboctave-1.dll using '-loctave-1', provided the bin<br>






directory is on your PATH. The gcc '.dll.a' suffix means the file is an import library,<br></div><div>not a static lib or a shared lib. Import libs tell Windows how to resolve references<br></div><div>in the corresponding dll. Windows uses the '.lib' suffix for import libs. For your<br>






</div><div>purposes you should link against the dll's, not the dll.a's.<br><br></div></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Oct 7, 2013 at 4:59 AM, Renaud Gaujoux <span dir="ltr"><<a>renaud@mancala.cbio.uct.ac.za</a>></span> wrote:<br>






<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>Dominick, just to be sure: did you have Octave bin directory in your PATH when you tested the package?<br>






</div>Because Octave dlls are also in that directory. <br><br></div>I am getting confused on which path/dll is to be used  where. Currently I build RcppOctave.dll linking against the dll.a files found in "C:\Octave\Octave3.6.4_gcc4.6.2\lib\octave\3.6.4". But there are .dll files (although named liboctave-1.dll and not liboctave.dll as I would expect) in ""C:\Octave\Octave3.6.4_gcc4.6.2\bin" where octave.exe. and octave-config.exe also live.<br>







</div><div>I had tried loading the .dll.a files with dyn.load in R but got errors. The -1.dll files load fine, and might be the ones I could load manually in .onLoad.<br></div><div><br></div>Now, should I also link using the bin/ path and the -1.dll files?<span><font color="#888888"><br>







<br></font></span></div><span><font color="#888888">Renaud<br><div><div><br><br></div></div></font></span></div>
</blockquote></div><br></div></div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div></blockquote></div></div></div></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>