<div dir="ltr">This solution yields:<br><div><br><div><div>-Wl,-F/Library/Frameworks/R.framework/..,-framework R ...</div></div><div><br></div><div>and the linker doesn't know that the last "R" belongs to the</div>
<div>-framework option. </div><div><br></div><div>To fix, simply add the 'g' qualifier to the sed command in</div><div><a href="http://configure.ac">configure.ac</a>:</div><div><p style="margin:0px;font-size:11px;font-family:Menlo">
R_LDFLAGS=`echo "-Wl,$R_LDFLAGS" | sed 's/ /,/g'`</p></div><div><br></div><div>My original solution works because the -Wl,"whatever"</div></div><div>option causes mkoctfile to insert the string "whatever"</div>
<div>into the linker command line without parsing. If instead</div><div>mkoctfile used a form of exec(3) that expects tokenized</div><div>options, the sed solution would be necessary.</div><div><br></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Thu, Nov 7, 2013 at 7:20 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">
I changed <a href="http://configure.ac" target="_blank">configure.ac</a> into:<br>
R_LDFLAGS=`echo "-Wl,$R_LDFLAGS" | sed 's/ /,/'`<br>
<br>
as I read/saw that multiple options must be comma separated.<br>
This will break if the path to the R framework contains spaces though.<br>
Can you please try again:<br>
<div class="im HOEnZb"><br>
install_github('RcppOctave', 'renozao', ref = 'develop')<br>
<br>
Thanks.<br>
<br>
Bests,<br>
Renaud<br>
<br>
</div><div class="HOEnZb"><div class="h5">On 6 November 2013 22:37, Renaud Gaujoux <<a href="mailto:renaud@mancala.cbio.uct.ac.za">renaud@mancala.cbio.uct.ac.za</a>> wrote:<br>
> Nice. It is indeed a better solution than changing the flags and their<br>
> values. The sed command did not work probably because I forgot to double the<br>
> square brackets, which is necessary to correctly pass configure's first<br>
> string evaluation.<br>
> I will incorporate the change tomorrow.<br>
> Thanks!<br>
><br>
> Bests,<br>
> Renaud<br>
><br>
> On Wednesday, November 6, 2013, Dominick Samperi wrote:<br>
>><br>
>> The reason we have been hacking away at '-F' vs '-L' instead of<br>
>> letting 'R CMD config' figure things out is that mkoctfile does not<br>
>> know about R frameworks ('-F' is invalid). But mkoctfile does have<br>
>> the -Wl,whatever option, which simply passes whatever down to<br>
>> the linker.<br>
>><br>
>> I have attached a modified <a href="http://configure.ac" target="_blank">configure.ac</a> that uses this option<br>
>> instead of using sed to hack the output of R CMD config --ldflags.<br>
>><br>
>><br>
>><br>
>> On Wed, Nov 6, 2013 at 10:25 AM, Dominick Samperi <<a href="mailto:djsamperi@gmail.com">djsamperi@gmail.com</a>><br>
>> wrote:<br>
>><br>
>> Hello Renaud,<br>
>><br>
>> So, this R technical issue (reg.finalizer) was the crux of the problem all<br>
>> along. Good work!<br>
>><br>
>> The '..' is still there and the build still fails without my hacked<br>
>> Makefile.in, but<br>
>> with this change everything works (no more install memory errors).<br>
>><br>
>> The '..' in the output of R CMD config --ldflags is there for a purpose,<br>
>> because<br>
>> the R framework is under /Library/Frameworks, and not under<br>
>> /Library/Frameworks/R.framework. This is analogous to<br>
>> -L/usr/lib/mylibs -lfoo, where /usr/lib/mylibs may contain a collection<br>
>> of libraries (instead of frameworks), not just libfoo.so.<br>
>> (A Mac OS framework is analogous to an R package.)<br>
>><br>
>> Make sure '..' is not in the path supplied to '-L' and everything should<br>
>> work.<br>
>><br>
>> Cheers,<br>
>> Dominick<br>
>><br>
>><br>
>> On Wed, Nov 6, 2013 at 8:19 AM, Renaud Gaujoux<br>
>> <<a href="mailto:renaud@mancala.cbio.uct.ac.za">renaud@mancala.cbio.uct.ac.za</a>> wrote:<br>
>><br>
>> Hi,<br>
>><br>
>> I made some changes available in the develop version, which should<br>
>> hopefully solve both issues:<br>
>> * octave_end is now called on exit (via reg.finalizer: see my post<br>
>> on r-devel<br>
>> <a href="https://stat.ethz.ch/pipermail/r-devel/2013-November/067912.html" target="_blank">https://stat.ethz.ch/pipermail/r-devel/2013-November/067912.html</a>)<br>
>> * the extra dots are removed by the sed in <a href="http://configure.ac" target="_blank">configure.ac</a>, but I think<br>
>> we still need to figure out why these dots are there...<br>
>><br>
>> To test:<br>
>><br>
>> devtools::install_github('RcppOctave', 'renozao', ref = 'develop')<br>
>><br>
>> Thanks.<br>
>><br>
>> Bests,<br>
>> Renaud<br>
>><br>
>> On 6 November 2013 11:15, Renaud Gaujoux <<a href="mailto:renaud@mancala.cbio.uct.ac.za">renaud@mancala.cbio.uct.ac.za</a>><br>
>> wrote:<br>
>> > Couple of questions to understand what is going on:<br>
>> ><br>
>> > * why does R CMD config --ldflags returns these extra '..' if they are<br>
>> > incorrect?<br>
>> > * why does the compilation work if the path is incorrect to R library<br>
>> > is<br>
>> > incorrect?<br>
>> > * why removing the dots should solve the malloc error?<br>
>> ><br>
>> ><br>
>> ><br>
>> > On 5 November 2013 16:38, Dominick Samperi <<a href="mailto:djsamperi@gmail.com">djsamperi@gmail.com</a>> wrote:<br>
>> >><br>
>> >> R CMD config --ldflags<br>
>> >> yields<br>
>> >> -F/Library/Frameworks/R.framework/.. -framework R<br>
>> >><br>
>> >> This needs to be hacked for mkoctfile to:<br>
>> >> -L/Library/Frameworks/R.framework/Libraries -lR<br>
>> >> (no '..')<br>
>> >><br>
>> >> Applying this to the github source fixes it for<br>
>> >> Mac OS X Mavericks provided the --no-test-load<br>
>> >> and octave_end tricks are used.<br>
>> >><br>
>> >><br>
>> >> On Tue, Nov 5, 2013 at 9:04 AM, Renaud Gaujoux<br>
>> >> <<a href="mailto:renaud@mancala.cbio.uct.ac.za">renaud@mancala.cbio.uct.ac.za</a>> wrote:<br>
>> >>><br>
>> >>> Not sure where the extra '..' would come from.<br>
>> >>> Are you installing the latest version from github?<br>
>> >>><br>
>> >>> devtools::install_github('RcppOctave', 'renozao')<br>
>> >>><br>
>> >>><br>
>> >>><br>
>> >>> On 2 November 2013 07:00, Dominick Samperi <<a href="mailto:djsamperi@gmail.com">djsamperi@gmail.com</a>><br>
>> >>> wrote:<br>
>> >>>><br>
>> >>>> It appears that octave_end is not called at all under Mac OS X. But<br>
>> >>>> it<br>
>> >>>> is also not called under Linux! I inserted Rprintf statements to<br>
>> >>>> check.<br>
>> >>>><br>
>> >>>> Perhaps the explanation is that failing to call octave_end under<br>
>> >>>> Linux<br>
>> >>>> (or Windows?) is non-fatal, but this is fatal under Mac OS X? If this<br>
>> >>>> is so the Mac OS X behavior is less dangerous...<br>
>> >>>><br>
>> >>>> If I do not use --no-test-load, I get the result in RcppOctave.log<br>
>> >>>> (attached)<br>
</div></div></blockquote></div><br></div>