Oops, Sorry, did not reply-all:

Thanks for the reply Simon,

I have a follow-up question:

So after I run the first code you suggested on a computer, the shared
object will use the Fortran run-time included in R. Does this code change
the shared object itself? Meaning if I send this object to yet another
computer and run it, will it know to link to the Fortran included in R?
Thanks!

-Best,
Xiao


On Thu, May 23, 2013 at 5:06 PM, Xiao He <praguewatermelon@gmail.com> wrote:

> Thanks for the reply Simon,
>
> I have a follow-up question:
>
> So after I run the first code you suggested on a computer, the shared
> object will use the Fortran run-time included in R. Does this code change
> the shared object itself? Meaning if I send this object to yet another
> computer and run it, will it know to link to the Fortran included in R?
> Thanks!
>
> Best,
> Xiao
>
>
>
> On Thu, May 23, 2013 at 4:54 PM, Simon Urbanek <
> simon.urbanek@r-project.org> wrote:
>
>> On May 23, 2013, at 4:18 PM, Xiao He <praguewatermelon@gmail.com> wrote:
>>
>> > Dear all,
>> >
>> > I have a C++ code. To create a shared object from this particular code,
>> I
>> > had to install a Fortran library on my computer (Mac). The compiled code
>> > runs fine on my computer. However,  if I try to dyn.load() said shared
>> > object on a computer that does not have the Fortran library installed,
>> the
>> > object won't load, and instead I get a message below:
>> >
>> > usr/local/lib/libgfortran.2.dylib
>> > Referenced from: /Users/xh/Downloads/foo2.so
>> >
>> > I wonder if there is any way to compile the original C++ code such that
>> I
>> > can include the necessary components of the Fortran library without
>> having
>> > to install the library.
>> >
>>
>> The Fortran run-time is included with R, so you only need to change the
>> path -- e.g.
>>
>> install_name_tool -change /usr/local/lib/libgfortran.2.dylib
>> /Library/Frameworks/R.framework/Resources/lib/libgfortran.2.dylib
>> /Users/xh/Downloads/foo2.so
>>
>> You can make that permanent on your build machine by running
>>
>> install_name_tool -id
>>  /Library/Frameworks/R.framework/Resources/lib/libgfortran.2.dylib
>> /usr/local/lib/libgfortran.2.dylib
>>
>> If you do that, all code compiled against it subsequently will point to
>> the version inside R instead.
>>
>> Cheers,
>> Simon
>>
>> FWIW: There is R-SIG-Mac for Mac-specific questions.
>>
>>
>> >
>> > Thank you in advance.
>> >
>> > Best,
>> > Xiao
>> >
>> >       [[alternative HTML version deleted]]
>> >
>> > ______________________________________________
>> > R-devel@r-project.org mailing list
>> > https://stat.ethz.ch/mailman/listinfo/r-devel
>> >
>> >
>>
>>
>

	[[alternative HTML version deleted]]

