[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-sig-mac
Subject:    Re: [R-SIG-Mac] Compiling a portable binary that includes Fortran
From:       Michael Braun <braunm () mit ! edu>
Date:       2011-09-21 15:50:22
Message-ID: 749FEA1C-B007-4318-8B2C-62570AEC8050 () mit ! edu
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Thanks for these helpful suggestions.  Changing the symbolic link for libgfortran \
worked.  Also, I did convert the Fortran code to C using f2c, and that worked as \
well.


On Sep 20, 2011, at 2:24 PM, Simon Urbanek wrote:

> 
> On Sep 20, 2011, at 2:09 PM, Charlie Sharpsteen wrote:
> 
> > On Monday, September 19, 2011 7:41:08 PM UTC-7, Simon Urbanek wrote:
> > Michael,
> > the problem has nothing to do with your package (you should not be touching any \
> > flags at all), but rather the Fortran you use. 
> > If you have both static and dynamic fortran runtime, the dynamic one has always \
> > precedence. So there are essentially two possible ways forward: 
> > a) use static Fortran runtime. It simply means moving \
> > /usr/local/lib/libgfortran.dylib aside. 
> > b) if you use dynamic Fortran runtime, take the one from R. Since you have R \
> > 2.13.x it is shipped in \
> > /Library/Frameworks/R.framework/Versions/2.13/Resources/lib/ so you can use it \
> > along the lines of cd /usr/local/lib
> > sudo ln -sfn /Library/Frameworks/R.framework/Versions/2.13/Resources/lib/libgfortran.2.dylib \
> > . sudo ln -sfn libgfortran.2.dylib libgfortran.dylib
> > Alternatively you can simply use install_name_tool to point your package to R's \
> > runtime. 
> > 
> > Note that GFortran also has a `-static-libgfortran` flag that will force the \
> > compiler to select the static runtime library over the dynamic one. Using this \
> > flag should remove any need to move libraries around or muck about with \
> > `install_name_tool` (unless your package has other dynamic dependencies). 
> > Hope that helps!
> > 
> 
> Not in this case, because this linking is not done by gfortran so the flag has no \
> effect. The problem with linking mixed code is that you have to use g++ for linking \
> so the Fortran runtime must be linked "by hand". R takes care of this but it means \
> you get your fortran used at configure time which in Michael's case is dynamic \
> linking. 
> Cheers,
> Simon
> 

Michael Braun 
MIT Sloan School of Management
braunm@mit.edu
-------------------------------------------------- 
View my research at
http://braunm.scripts.mit.edu/


[Attachment #5 (unknown)]

<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; \
-webkit-line-break: after-white-space; "><div>Thanks for these helpful suggestions. \
&nbsp;Changing the symbolic link for libgfortran worked. &nbsp;Also, I did convert \
the Fortran code to C using f2c, and that worked as \
well.</div><div><br></div><br><div><div>On Sep 20, 2011, at 2:24 PM, Simon Urbanek \
wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><br>On \
Sep 20, 2011, at 2:09 PM, Charlie Sharpsteen wrote:<br><br><blockquote type="cite">On \
Monday, September 19, 2011 7:41:08 PM UTC-7, Simon Urbanek \
wrote:<br></blockquote><blockquote type="cite">Michael,<br></blockquote><blockquote \
type="cite">the problem has nothing to do with your package (you should not be \
touching any flags at all), but rather the Fortran you \
use.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote \
type="cite">If you have both static and dynamic fortran runtime, the dynamic one has \
always precedence. So there are essentially two possible ways \
forward:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote \
type="cite">a) use static Fortran runtime. It simply means moving \
/usr/local/lib/libgfortran.dylib aside.<br></blockquote><blockquote \
type="cite"><br></blockquote><blockquote type="cite">b) if you use dynamic Fortran \
runtime, take the one from R. Since you have R 2.13.x it is shipped in \
/Library/Frameworks/R.framework/Versions/2.13/Resources/lib/ so you can use it along \
the lines of<br></blockquote><blockquote type="cite">cd \
/usr/local/lib<br></blockquote><blockquote type="cite">sudo ln -sfn \
/Library/Frameworks/R.framework/Versions/2.13/Resources/lib/libgfortran.2.dylib \
.<br></blockquote><blockquote type="cite">sudo ln -sfn libgfortran.2.dylib \
libgfortran.dylib<br></blockquote><blockquote type="cite">Alternatively you can \
simply use install_name_tool to point your package to R's \
runtime.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote \
type="cite"><br></blockquote><blockquote type="cite">Note that GFortran also has a \
`-static-libgfortran` flag that will force the compiler to select the static runtime \
library over the dynamic one. Using this flag should remove any need to move \
libraries around or muck about with `install_name_tool` (unless your package has \
other dynamic dependencies).<br></blockquote><blockquote \
type="cite"><br></blockquote><blockquote type="cite">Hope that \
helps!<br></blockquote><blockquote type="cite"><br></blockquote><br>Not in this case, \
because this linking is not done by gfortran so the flag has no effect. The problem \
with linking mixed code is that you have to use g++ for linking so the Fortran \
runtime must be linked "by hand". R takes care of this but it means you get your \
fortran used at configure time which in Michael's case is dynamic \
linking.<br><br>Cheers,<br>Simon<br><br></div></blockquote></div><br><div> <span \
class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); \
font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: \
normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: \
-webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; \
word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; \
-webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; \
-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; \
">Michael Braun&nbsp;<br>MIT Sloan School of Management<br><a \
href="mailto:braunm@mit.edu">braunm@mit.edu</a><br>--------------------------------------------------&nbsp;<br>View \
my research at<br>http://braunm.scripts.mit.edu/</span> </div>
<br></body></html>


["smime.p7s" (smime.p7s)]

0	*H
 010	+0	*H
 00% $eB D/0
	*H
0l10	UUS10U
Massachusetts1.0,U
%Massachusetts Institute of Technology10UClient CA v10
110802212001Z
120802212001Z010	UUS10U
Massachusetts1.0,U
%Massachusetts Institute of Technology10UClient CA v110U
Michael Braun10	*H
	braunm@MIT.EDU0"0
	*H
0
߲D1.&7fa@IH&1g‭	)qI诈A8.F@
O҂JzRV#Et>SEԉD
3
h3޾em.1Y_ɹ=VCRNpzAr3%q&3_V)#^jʽ}*q+[GrD]9 \
;*#Ypa ö1/0Fch< 72;
!fB00	U00	`HB \
0U%0++0U0U݃=n޵}yC	$03U,0*0( \
& $"http://ca.mit.edu/ca/mitclient.crl0 	*H
4$:̮F:lmT 
^Mt3o@\n\GASCp$ːuI:ډ^3޾uT%п@X)SoxNpjB
 	AxМ7160200l10	UUS10U
Massachusetts1.0,U
%Massachusetts Institute of Technology10UClient CA v1$eB \
D/0	+ 0	*H 	1	*H
0	*H
	1
110921155023Z0#	*H
	1_Ōau-! *Jh0	+7100l10	UUS10U
Massachusetts1.0,U
%Massachusetts Institute of Technology10UClient CA v1$eB \
D/0*H 	1 0l10	UUS10U
Massachusetts1.0,U
%Massachusetts Institute of Technology10UClient CA v1$eB D/0
	*H
WP}(9JdY'60FcL=
Z__V^suS#<1$<Łb.Ck?=R#T/G \
9Z&v2@G}v%%sЇ݋*/ǛPLv>6U]|mBMEo3 \
\U2tvUk>JC3.BAM;c_9y-




_______________________________________________
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac

--===============1989333989==--


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic