[R-SIG-Mac] Compiling a portable binary that includes Fortran code

Simon Urbanek simon.urbanek at r-project.org
Wed Nov 13 15:24:42 CET 2013


On Nov 13, 2013, at 4:26 AM, Simon Zehnder <szehnder at uni-bonn.de> wrote:

> Diego,
> 
> if you compiled the binary on your Mac with gfortran installed the library created still links to the libgfortran.3.dylib library. In your package shared object file there is now a link to the libgfortran.3.dylib library and when installing to R, this link is searched for but cannot be found, as it is on your Mac and not on the user’s Mac. I guess, if you include the static library instead of the dynamic things work. 
> 

FWIW if you use recommended tools then this is non-issue since R ships with libgfortran, so the problem is really in the tools used, not in R nor the package.

Cheers,
Simon


> First look into the shared object file of your package: 
> On the Shell type: otool -L yourpackagename.so
> There should be a link to libgfortran.3.dylib
> Second, check if libgfortran.a exists: 
> On The shell type: locate libgfortran 
> 
> Now if it does, try the following:
> Open your Makevars and add the line
> PKG_LIBS = -L/path/to/your/libgfortran.a 
> 
> Then recompile and try to install the binary. 
> Also look again into the shared object file with tool -L and check if libgfortran is still in there.
> 
> May it helps
> 
> Simon
> 
> On 05 Nov 2013, at 22:13, Diego M Salvanha <dinarussia at gmail.com> wrote:
> 
>> Hello-
>> 
>> I am facing issues generating my package binary for MacOS.
>> 
>> The generated binary doesn't work on another Macs :( 
>> It is missing the libgfortran.3.dylib
>> 
>> once it's the binary, I'd expect my user doesn't need to have fortran installed !
>> 
>> Could you please help me ?
>> 
>> sessionInfo()
>> R version 3.0.2 (2013-09-25)
>> Platform: x86_64-apple-darwin10.8.0 (64-bit)
>> 
>> locale:
>> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
>> 
>> attached base packages:
>> [1] stats     graphics  grDevices utils     datasets  methods   base  
>> 
>> 
>> *****************************************
>> installed but doesn't load:
>> 
>> Error in dyn.load(file, DLLpath = DLLpath, ...) : 
>> 
>> unable to load shared object '/Library/Frameworks/R.framework/Versions/3.0/Resources/library/ProbMetab/libs/ProbMetab.so':
>> 
>> dlopen(/Library/Frameworks/R.framework/Versions/3.0/Resources/library/ProbMetab/libs/ProbMetab.so, 6): Library not loaded: /usr/local/lib/libgfortran.3.dylib
>> 
>> Referenced from: /Library/Frameworks/R.framework/Versions/3.0/Resources/library/ProbMetab/libs/ProbMetab.so
>> 
>> Reason: image not found
>> 
>> In addition: Warning messages:
>> 
>> 1: package ‘ProbMetab’ was built under R version 3.0.2 
>> 
>> 2: package ‘Rcpp’ was built under R version 3.0.2 
>> 
>> 3: In fun(libname, pkgname) :
>> 
>>  mzR has been built against a different Rcpp version
>> 
>> than is installed on your system. This might lead to errors
>> 
>> when loading mzR. If you encounter such issues, please send
>> 
>> a report, including the output of sessionInfo() to the Bioc
>> 
>> mailing list -- http://www.bioconductor.org/help/mailing-list.
>> 
>> 4: package ‘igraph’ was built under R version 3.0.2 
>> 
>> 
>> 
>> On Tue, Nov 5, 2013 at 12:19 PM, Diego M Salvanha <dinarussia at gmail.com> wrote:
>> OPSS
>> 
>> the right command is:
>> 
>> install.packages("ProbMetab_1.0.tgz", repos=NULL)
>> 
>> without the type="source"
>> 
>> 
>> Cheers.,
>> Diego M Salvanha
>> Grad. Student Inter-institutional Grad Program on Bioinformatics - University of Sao Paulo
>> Member of LabPIB - http://labpib.fmrp.usp.br | Dr. Ricardo Z. N. Vencio
>> Visiting Grad Student | Dr. Nitin Baliga's Group
>> Institute for Systems Biology
>> +1 (206) 732-1415 |  +1 (206) 407-8560
>> 
>> 
>> 
>> 
>> 
>> On Nov 5, 2013, at 12:16 PM, Diego M Salvanha <dinarussia at gmail.com> wrote:
>> 
>>> <ProbMetab_1.0.tgz>
>>> 
>>> 
>>> you can install with command:
>>> 
>>> install.packages("ProbMetab_1.0.tgz", repos=NULL, type="source")
>>> 
>>> it should be ok now.
>>> 
>>> then, 
>>> 
>>> library(ProbMetab) and let me know it you get any error.
>>> 
>>> sorry to bother but I don't have another mac to try :(
>>> 
>>> 
>>> Cheers.,
>>> Diego M Salvanha
>>> Grad. Student Inter-institutional Grad Program on Bioinformatics - University of Sao Paulo
>>> Member of LabPIB - http://labpib.fmrp.usp.br | Dr. Ricardo Z. N. Vencio
>>> Visiting Grad Student | Dr. Nitin Baliga's Group
>>> Institute for Systems Biology
>>> +1 (206) 732-1415 |  +1 (206) 407-8560
>>> 
>>> 
>>> 
>>> 
>>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> Cheers.,
>> Diego M Salvanha
>> Grad. Student Inter-institutional Grad Program on Bioinformatics - University of Sao Paulo
>> Member of LabPIB - http://labpib.fmrp.usp.br | Dr. Ricardo Z. N. Vencio
>> Visiting Grad Student | Dr. Nitin Baliga's Group
>> Institute for Systems Biology
>> +1 (206) 732-1415 |  +1 (206) 407-8560
>> 
>> 
>> 
>> 
>> 
>> 
>> 	[[alternative HTML version deleted]]
>> 
>> _______________________________________________
>> R-SIG-Mac mailing list
>> R-SIG-Mac at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> 
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> 



More information about the R-SIG-Mac mailing list