[Rd] package compilation on OSX 10.8 -- error compiling Fortran library for architecture i386
Simon Urbanek
simon.urbanek at r-project.org
Thu Jul 25 14:37:33 CEST 2013
On Jul 24, 2013, at 3:35 PM, Jonathan Callahan wrote:
> I am developing a package for analysis of seismic data that relies on a
> Fortran library.
>
> Package compilation works fine on Ubuntu and Red Hat Enterprise but fails
> for R 2.15.3 on Mac OSX 10.8.4.
>
> I've included the entire dump below but the relevant error message seems to
> be:
>
> ld: warning: ignoring file libmseed/libmseed.a, file was built for archive
>> which is not the architecture being linked (i386): libmseed/libmseed.a
>
>
> Compilation for x86_64 proceeds without a hitch.
>
> If anyone is curious, the package tarballs are available at:
>
> http://mazamascience.com/Downloads/
>
> Thanks for any helpful suggestions about compiling Fortran on OSX.
>
This has nothing to do with Fortran (and it's not even Mac-specific) - you're using the wrong compiler flags for building the dependent library inside your package (as the message tells you: you are building 64-bit version of libmseed when compiling 32-bit version of the package). Please make sure you use the proper compiler and flags that R is providing (i.e., remove all conflicting flags from libmseed/Makefile).
Cheers,
Simon
> Jon
>
>
> $ R CMD INSTALL seismic_0.2.1.0.tar.gz
> * installing to library
> Œ/Library/Frameworks/R.framework/Versions/2.15/Resources/library‚
> * installing *source* package Œseismic‚ ...
> ** libs
> *** arch - i386
> gcc -arch i386 -std=gnu99
> -I/Library/Frameworks/R.framework/Resources/include
> -I/Library/Frameworks/R.framework/Resources/include/i386 -DNDEBUG
> -Ilibmseed -I/usr/local/include -fPIC -fPIC -g -O2 -c parseMiniSEED.c
> -o parseMiniSEED.o
> gcc -O2 -Wall -fPIC -c -o fileutils.o fileutils.c
> gcc -O2 -Wall -fPIC -c -o genutils.o genutils.c
> gcc -O2 -Wall -fPIC -c -o gswap.o gswap.c
> gcc -O2 -Wall -fPIC -c -o lmplatform.o lmplatform.c
> gcc -O2 -Wall -fPIC -c -o lookup.o lookup.c
> gcc -O2 -Wall -fPIC -c -o msrutils.o msrutils.c
> gcc -O2 -Wall -fPIC -c -o pack.o pack.c
> gcc -O2 -Wall -fPIC -c -o packdata.o packdata.c
> gcc -O2 -Wall -fPIC -c -o traceutils.o traceutils.c
> gcc -O2 -Wall -fPIC -c -o tracelist.o tracelist.c
> gcc -O2 -Wall -fPIC -c -o parseutils.o parseutils.c
> gcc -O2 -Wall -fPIC -c -o unpack.o unpack.c
> gcc -O2 -Wall -fPIC -c -o unpackdata.o unpackdata.c
> gcc -O2 -Wall -fPIC -c -o selection.o selection.c
> gcc -O2 -Wall -fPIC -c -o logging.o logging.c
> rm -f libmseed.a
> ar -csq libmseed.a fileutils.o genutils.o gswap.o lmplatform.o lookup.o
> msrutils.o pack.o packdata.o traceutils.o tracelist.o parseutils.o unpack.o
> unpackdata.o selection.o logging.o
> gcc -arch i386 -std=gnu99 -dynamiclib -Wl,-headerpad_max_install_names
> -undefined dynamic_lookup -single_module -multiply_defined suppress
> -L/usr/local/lib -o seismic.so parseMiniSEED.o -Llibmseed -lmseed
> -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework
> -Wl,CoreFoundation
> ld: warning: ignoring file libmseed/libmseed.a, file was built for archive
> which is not the architecture being linked (i386): libmseed/libmseed.a
> installing to
> /Library/Frameworks/R.framework/Versions/2.15/Resources/library/seismic/libs/i386
> *** arch - x86_64
> gcc -arch x86_64 -std=gnu99
> -I/Library/Frameworks/R.framework/Resources/include
> -I/Library/Frameworks/R.framework/Resources/include/x86_64 -DNDEBUG
> -Ilibmseed -I/usr/local/include -fPIC -fPIC -g -O2 -c parseMiniSEED.c
> -o parseMiniSEED.o
> gcc -O2 -Wall -fPIC -c -o fileutils.o fileutils.c
> gcc -O2 -Wall -fPIC -c -o genutils.o genutils.c
> gcc -O2 -Wall -fPIC -c -o gswap.o gswap.c
> gcc -O2 -Wall -fPIC -c -o lmplatform.o lmplatform.c
> gcc -O2 -Wall -fPIC -c -o lookup.o lookup.c
> gcc -O2 -Wall -fPIC -c -o msrutils.o msrutils.c
> gcc -O2 -Wall -fPIC -c -o pack.o pack.c
> gcc -O2 -Wall -fPIC -c -o packdata.o packdata.c
> gcc -O2 -Wall -fPIC -c -o traceutils.o traceutils.c
> gcc -O2 -Wall -fPIC -c -o tracelist.o tracelist.c
> gcc -O2 -Wall -fPIC -c -o parseutils.o parseutils.c
> gcc -O2 -Wall -fPIC -c -o unpack.o unpack.c
> gcc -O2 -Wall -fPIC -c -o unpackdata.o unpackdata.c
> gcc -O2 -Wall -fPIC -c -o selection.o selection.c
> gcc -O2 -Wall -fPIC -c -o logging.o logging.c
> rm -f libmseed.a
> ar -csq libmseed.a fileutils.o genutils.o gswap.o lmplatform.o lookup.o
> msrutils.o pack.o packdata.o traceutils.o tracelist.o parseutils.o unpack.o
> unpackdata.o selection.o logging.o
> gcc -arch x86_64 -std=gnu99 -dynamiclib -Wl,-headerpad_max_install_names
> -undefined dynamic_lookup -single_module -multiply_defined suppress
> -L/usr/local/lib -o seismic.so parseMiniSEED.o -Llibmseed -lmseed
> -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework
> -Wl,CoreFoundation
> installing to
> /Library/Frameworks/R.framework/Versions/2.15/Resources/library/seismic/libs/x86_64
> ** R
> ** inst
> ** preparing package for lazy loading
> Creating a generic function for Œas.vector‚ from package Œbase‚ in package
> Œseismic‚
> Creating a generic function for Œmean‚ from package Œbase‚ in package
> Œseismic‚
> Creating a generic function for Œmedian‚ from package Œstats‚ in package
> Œseismic‚
> Creating a generic function for Œsd‚ from package Œstats‚ in package
> Œseismic‚
> Creating a generic function for Œplot‚ from package Œgraphics‚ in package
> Œseismic‚
> ** help
> *** installing help indices
> ** building package indices
> ** installing vignettes
> Œseismic-intro.Rnw‚
> ** testing if installed package can be loaded
> *** arch - i386
> Error in dyn.load(file, DLLpath = DLLpath, ...) :
> unable to load shared object
> '/Library/Frameworks/R.framework/Versions/2.15/Resources/library/seismic/libs/i386/seismic.so':
>
> dlopen(/Library/Frameworks/R.framework/Versions/2.15/Resources/library/seismic/libs/i386/seismic.so,
> 6): Symbol not found: _ms_loginit
> Referenced from:
> /Library/Frameworks/R.framework/Versions/2.15/Resources/library/seismic/libs/i386/seismic.so
> Expected in: flat namespace
> in
> /Library/Frameworks/R.framework/Versions/2.15/Resources/library/seismic/libs/i386/seismic.so
> Error: loading failed
> Execution halted
> *** arch - x86_64
> ERROR: loading failed for Œi386‚
> * removing
> Œ/Library/Frameworks/R.framework/Versions/2.15/Resources/library/seismic‚
>
>
> --
> Jonathan Callahan, PhD
> Mazama Science
> 206-708-5028
> mazamascience.com
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
More information about the R-devel
mailing list