I'm trying to write an R package that calls a Fortran subroutine on my Mac os x El Capitan with Xcode 7 and gfortran 6.1, R 3.3.0. I couldn't build the library with my current namespace commands. I get the following error: * installing *source* package ?Nepidemic? ... ** libs gfortran -fPIC -Wall -g -O2 -c randomepi.f95 -o randomepi.o gfortran -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o Nepidemic.so randomepi.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation installing to /Users/Vineetha/myrlibrary/myrpackages/Nepidemic.Rcheck/Nepidemic/libs ** R ** preparing package for lazy loading ** help *** installing help indices ** building package indices ** testing if installed package can be loaded Error in library.dynam(lib, package, package.lib) : shared object ?randomepi.so? not found Error: loading failed Execution halted ERROR: loading failed * removing ?/Users/Vineetha/myrlibrary/myrpackages/Nepidemic.Rcheck/Nepidemic? My package name is "NEpidemic" and source code file in src folder is "randomepi.f95" Any help would be much appreciated. I'm vey new to both R and Fortran coding, especially in package building. Thanks in advance! Vineetha
Writing R package that calls Fortran on Mac os X El Capitan Error
9 messages · Eduardo M. A. M. Mendes, Kodalore Vijayan, Vineetha W, Peter Dalgaard
Dear Vennetha I am running R on a mac too. Please see if my comments below helps.
On Jun 16, 2016, at 5:00 PM, Kodalore Vijayan, Vineetha W <vwkv13 at mun.ca> wrote: I'm trying to write an R package that calls a Fortran subroutine on my Mac os x El Capitan with Xcode 7 and gfortran 6.1, R 3.3.0. I couldn't build the library with my current namespace commands. I get the following error: * installing *source* package ?Nepidemic? ... ** libs gfortran -fPIC -Wall -g -O2 -c randomepi.f95 -o randomepi.o gfortran -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o Nepidemic.so randomepi.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
The name of the library created by r cmd shlib is Nepidemic.so.
installing to /Users/Vineetha/myrlibrary/myrpackages/Nepidemic.Rcheck/Nepidemic/libs ** R ** preparing package for lazy loading ** help *** installing help indices ** building package indices ** testing if installed package can be loaded Error in library.dynam(lib, package, package.lib) : shared object ?randomepi.so? not found
Note that the r cmd check is looking for randomepi.so so it means that it is calling the wrong library (it should be Nepidemic.so). Are you sure that the NAMESPACE contains the following lines? useDynLib(NEpidemic,.registration = TRUE) export(randomepi) in all the examples I have those lines would suffice.
Error: loading failed Execution halted ERROR: loading failed * removing ?/Users/Vineetha/myrlibrary/myrpackages/Nepidemic.Rcheck/Nepidemic? My package name is "NEpidemic" and source code file in src folder is "randomepi.f95" Any help would be much appreciated. I'm vey new to both R and Fortran coding, especially in package building. Thanks in advance! Vineetha [[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
The most obvious thing is that you build Nepidemic.so but the error talks about randomepi.so. Could it be as simple as putting the wrong thing in useDynLib(...)? -pd
On 16 Jun 2016, at 22:00 , Kodalore Vijayan, Vineetha W <vwkv13 at mun.ca> wrote: I'm trying to write an R package that calls a Fortran subroutine on my Mac os x El Capitan with Xcode 7 and gfortran 6.1, R 3.3.0. I couldn't build the library with my current namespace commands. I get the following error: * installing *source* package ?Nepidemic? ... ** libs gfortran -fPIC -Wall -g -O2 -c randomepi.f95 -o randomepi.o gfortran -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o Nepidemic.so randomepi.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation installing to /Users/Vineetha/myrlibrary/myrpackages/Nepidemic.Rcheck/Nepidemic/libs ** R ** preparing package for lazy loading ** help *** installing help indices ** building package indices ** testing if installed package can be loaded Error in library.dynam(lib, package, package.lib) : shared object ?randomepi.so? not found Error: loading failed Execution halted ERROR: loading failed * removing ?/Users/Vineetha/myrlibrary/myrpackages/Nepidemic.Rcheck/Nepidemic? My package name is "NEpidemic" and source code file in src folder is "randomepi.f95" Any help would be much appreciated. I'm vey new to both R and Fortran coding, especially in package building. Thanks in advance! Vineetha [[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
Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
Yes. My package name is "Epidemic" and namespace contains the following:
useDynLib(randomepi)
useDynLib(Nepidemic, .registration = TRUE)
exportPattern("^[[:alpha:]]+")
export(randomepi)
import(graphics,grDevices,stats, utils)
I could see Nepidemic.so and randomepi.o files in the src folder.
-V
On Thu, Jun 16, 2016 at 2:28 PM, Eduardo M. A. M.Mendes <
emammendes at gmail.com> wrote:
Dear Vennetha I am running R on a mac too. Please see if my comments below helps. On Jun 16, 2016, at 5:00 PM, Kodalore Vijayan, Vineetha W <vwkv13 at mun.ca> wrote: I'm trying to write an R package that calls a Fortran subroutine on my Mac os x El Capitan with Xcode 7 and gfortran 6.1, R 3.3.0. I couldn't build the library with my current namespace commands. I get the following error: * installing *source* package ?Nepidemic? ... ** libs gfortran -fPIC -Wall -g -O2 -c randomepi.f95 -o randomepi.o gfortran -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o Nepidemic.so randomepi.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation The name of the library created by r cmd shlib is Nepidemic.so. installing to /Users/Vineetha/myrlibrary/myrpackages/Nepidemic.Rcheck/Nepidemic/libs ** R ** preparing package for lazy loading ** help *** installing help indices ** building package indices ** testing if installed package can be loaded Error in library.dynam(lib, package, package.lib) : shared object ?randomepi.so? not found Note that the r cmd check is looking for randomepi.so so it means that it is calling the wrong library (it should be Nepidemic.so). Are you sure that the NAMESPACE contains the following lines? useDynLib(NEpidemic,.registration = TRUE) export(randomepi) in all the examples I have those lines would suffice. Error: loading failed Execution halted ERROR: loading failed * removing ?/Users/Vineetha/myrlibrary/myrpackages/Nepidemic.Rcheck/Nepidemic? My package name is "NEpidemic" and source code file in src folder is "randomepi.f95" Any help would be much appreciated. I'm vey new to both R and Fortran coding, especially in package building. Thanks in advance! Vineetha [[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
My namespace contains:
useDynLib(randomepi)
useDynLib(Nepidemic, .registration = TRUE)
exportPattern("^[[:alpha:]]+")
export(randomepi)
import(graphics,grDevices,stats, utils)
Any thoughts?
Thanks,
Vineetha
On Thu, Jun 16, 2016 at 2:30 PM, peter dalgaard <pdalgd at gmail.com> wrote:
The most obvious thing is that you build Nepidemic.so but the error talks about randomepi.so. Could it be as simple as putting the wrong thing in useDynLib(...)? -pd
On 16 Jun 2016, at 22:00 , Kodalore Vijayan, Vineetha W <vwkv13 at mun.ca>
wrote:
I'm trying to write an R package that calls a Fortran subroutine on my
Mac
os x El Capitan with Xcode 7 and gfortran 6.1, R 3.3.0. I couldn't build the library with my current namespace commands. I get the following error: * installing *source* package ?Nepidemic? ... ** libs gfortran -fPIC -Wall -g -O2 -c randomepi.f95 -o randomepi.o gfortran -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o Nepidemic.so randomepi.o -F/Library/Frameworks/R.framework/.. -framework
R
-Wl,-framework -Wl,CoreFoundation
installing to
/Users/Vineetha/myrlibrary/myrpackages/Nepidemic.Rcheck/Nepidemic/libs
** R
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error in library.dynam(lib, package, package.lib) :
shared object ?randomepi.so? not found
Error: loading failed
Execution halted
ERROR: loading failed
* removing
?/Users/Vineetha/myrlibrary/myrpackages/Nepidemic.Rcheck/Nepidemic?
My package name is "NEpidemic" and source code file in src folder is
"randomepi.f95"
Any help would be much appreciated. I'm vey new to both R
and Fortran coding, especially in package building.
Thanks in advance!
Vineetha
[[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
-- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
Please rename your NAMESPACE to something else and create a new one with useDynLib(NEpidemic,.registration = TRUE) export(randomepi) It is worth a try.
On Jun 16, 2016, at 5:40 PM, Kodalore Vijayan, Vineetha W <vwkv13 at mun.ca> wrote:
Yes. My package name is "Epidemic" and namespace contains the following:
useDynLib(randomepi)
useDynLib(Nepidemic, .registration = TRUE)
exportPattern("^[[:alpha:]]+")
export(randomepi)
import(graphics,grDevices,stats, utils)
I could see Nepidemic.so and randomepi.o files in the src folder.
-V
On Thu, Jun 16, 2016 at 2:28 PM, Eduardo M. A. M.Mendes <emammendes at gmail.com <mailto:emammendes at gmail.com>> wrote:
Dear Vennetha
I am running R on a mac too.
Please see if my comments below helps.
On Jun 16, 2016, at 5:00 PM, Kodalore Vijayan, Vineetha W <vwkv13 at mun.ca <mailto:vwkv13 at mun.ca>> wrote: I'm trying to write an R package that calls a Fortran subroutine on my Mac os x El Capitan with Xcode 7 and gfortran 6.1, R 3.3.0. I couldn't build the library with my current namespace commands. I get the following error: * installing *source* package ?Nepidemic? ... ** libs gfortran -fPIC -Wall -g -O2 -c randomepi.f95 -o randomepi.o gfortran -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o Nepidemic.so randomepi.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
The name of the library created by r cmd shlib is Nepidemic.so.
installing to /Users/Vineetha/myrlibrary/myrpackages/Nepidemic.Rcheck/Nepidemic/libs ** R ** preparing package for lazy loading ** help *** installing help indices ** building package indices ** testing if installed package can be loaded Error in library.dynam(lib, package, package.lib) : shared object ?randomepi.so? not found
Note that the r cmd check is looking for randomepi.so so it means that it is calling the wrong library (it should be Nepidemic.so). Are you sure that the NAMESPACE contains the following lines? useDynLib(NEpidemic,.registration = TRUE) export(randomepi) in all the examples I have those lines would suffice.
Error: loading failed Execution halted ERROR: loading failed * removing ?/Users/Vineetha/myrlibrary/myrpackages/Nepidemic.Rcheck/Nepidemic? My package name is "NEpidemic" and source code file in src folder is "randomepi.f95" Any help would be much appreciated. I'm vey new to both R and Fortran coding, especially in package building. Thanks in advance! Vineetha [[alternative HTML version deleted]]
_______________________________________________ R-SIG-Mac mailing list R-SIG-Mac at r-project.org <mailto:R-SIG-Mac at r-project.org> https://stat.ethz.ch/mailman/listinfo/r-sig-mac <https://stat.ethz.ch/mailman/listinfo/r-sig-mac>
Perfect! Its working now. Thanks a lot for your patience and help. Just curious, what did I do wrong in the previous case? -Vineetha On Thu, Jun 16, 2016 at 2:48 PM, Eduardo M. A. M.Mendes <
emammendes at gmail.com> wrote:
Please rename your NAMESPACE to something else and create a new one with
useDynLib(NEpidemic,.registration = TRUE)
export(randomepi)
It is worth a try.
On Jun 16, 2016, at 5:40 PM, Kodalore Vijayan, Vineetha W <vwkv13 at mun.ca>
wrote:
Yes. My package name is "Epidemic" and namespace contains the following:
useDynLib(randomepi)
useDynLib(Nepidemic, .registration = TRUE)
exportPattern("^[[:alpha:]]+")
export(randomepi)
import(graphics,grDevices,stats, utils)
I could see Nepidemic.so and randomepi.o files in the src folder.
-V
On Thu, Jun 16, 2016 at 2:28 PM, Eduardo M. A. M.Mendes <
emammendes at gmail.com> wrote:
Dear Vennetha I am running R on a mac too. Please see if my comments below helps. On Jun 16, 2016, at 5:00 PM, Kodalore Vijayan, Vineetha W <vwkv13 at mun.ca> wrote: I'm trying to write an R package that calls a Fortran subroutine on my Mac os x El Capitan with Xcode 7 and gfortran 6.1, R 3.3.0. I couldn't build the library with my current namespace commands. I get the following error: * installing *source* package ?Nepidemic? ... ** libs gfortran -fPIC -Wall -g -O2 -c randomepi.f95 -o randomepi.o gfortran -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o Nepidemic.so randomepi.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation The name of the library created by r cmd shlib is Nepidemic.so. installing to /Users/Vineetha/myrlibrary/myrpackages/Nepidemic.Rcheck/Nepidemic/libs ** R ** preparing package for lazy loading ** help *** installing help indices ** building package indices ** testing if installed package can be loaded Error in library.dynam(lib, package, package.lib) : shared object ?randomepi.so? not found Note that the r cmd check is looking for randomepi.so so it means that it is calling the wrong library (it should be Nepidemic.so). Are you sure that the NAMESPACE contains the following lines? useDynLib(NEpidemic,.registration = TRUE) export(randomepi) in all the examples I have those lines would suffice. Error: loading failed Execution halted ERROR: loading failed * removing ?/Users/Vineetha/myrlibrary/myrpackages/Nepidemic.Rcheck/Nepidemic? My package name is "NEpidemic" and source code file in src folder is "randomepi.f95" Any help would be much appreciated. I'm vey new to both R and Fortran coding, especially in package building. Thanks in advance! Vineetha [[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
Since I am not an expert on writing R extensions (although I have lots of old and new fortran source codes linked to R), my guess is that R only calls the library named after package. You have useDynLib twice. You are welcome. Please update the thread in R-List in case someone there is interested in the answer.
On Jun 16, 2016, at 5:53 PM, Kodalore Vijayan, Vineetha W <vwkv13 at mun.ca> wrote: Perfect! Its working now. Thanks a lot for your patience and help. Just curious, what did I do wrong in the previous case? -Vineetha On Thu, Jun 16, 2016 at 2:48 PM, Eduardo M. A. M.Mendes <emammendes at gmail.com <mailto:emammendes at gmail.com>> wrote: Please rename your NAMESPACE to something else and create a new one with useDynLib(NEpidemic,.registration = TRUE) export(randomepi) It is worth a try.
On Jun 16, 2016, at 5:40 PM, Kodalore Vijayan, Vineetha W <vwkv13 at mun.ca <mailto:vwkv13 at mun.ca>> wrote:
Yes. My package name is "Epidemic" and namespace contains the following:
useDynLib(randomepi)
useDynLib(Nepidemic, .registration = TRUE)
exportPattern("^[[:alpha:]]+")
export(randomepi)
import(graphics,grDevices,stats, utils)
I could see Nepidemic.so and randomepi.o files in the src folder.
-V
On Thu, Jun 16, 2016 at 2:28 PM, Eduardo M. A. M.Mendes <emammendes at gmail.com <mailto:emammendes at gmail.com>> wrote:
Dear Vennetha
I am running R on a mac too.
Please see if my comments below helps.
On Jun 16, 2016, at 5:00 PM, Kodalore Vijayan, Vineetha W <vwkv13 at mun.ca <mailto:vwkv13 at mun.ca>> wrote: I'm trying to write an R package that calls a Fortran subroutine on my Mac os x El Capitan with Xcode 7 and gfortran 6.1, R 3.3.0. I couldn't build the library with my current namespace commands. I get the following error: * installing *source* package ?Nepidemic? ... ** libs gfortran -fPIC -Wall -g -O2 -c randomepi.f95 -o randomepi.o gfortran -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o Nepidemic.so randomepi.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
The name of the library created by r cmd shlib is Nepidemic.so.
installing to /Users/Vineetha/myrlibrary/myrpackages/Nepidemic.Rcheck/Nepidemic/libs ** R ** preparing package for lazy loading ** help *** installing help indices ** building package indices ** testing if installed package can be loaded Error in library.dynam(lib, package, package.lib) : shared object ?randomepi.so? not found
Note that the r cmd check is looking for randomepi.so so it means that it is calling the wrong library (it should be Nepidemic.so). Are you sure that the NAMESPACE contains the following lines? useDynLib(NEpidemic,.registration = TRUE) export(randomepi) in all the examples I have those lines would suffice.
Error: loading failed Execution halted ERROR: loading failed * removing ?/Users/Vineetha/myrlibrary/myrpackages/Nepidemic.Rcheck/Nepidemic? My package name is "NEpidemic" and source code file in src folder is "randomepi.f95" Any help would be much appreciated. I'm vey new to both R and Fortran coding, especially in package building. Thanks in advance! Vineetha [[alternative HTML version deleted]]
_______________________________________________ R-SIG-Mac mailing list R-SIG-Mac at r-project.org <mailto:R-SIG-Mac at r-project.org> https://stat.ethz.ch/mailman/listinfo/r-sig-mac <https://stat.ethz.ch/mailman/listinfo/r-sig-mac>
On 16 Jun 2016, at 22:53 , Kodalore Vijayan, Vineetha W <vwkv13 at mun.ca> wrote: Perfect! Its working now. Thanks a lot for your patience and help. Just curious, what did I do wrong in the previous case?
Tried to use a dynamic library that wasn't there:
useDynLib(randomepi)
but you never built a randomepi.so. You built randomepi.o, but that is an object file not a dynamic library. It was eventually linked into Nepidemic.so, which is the thing that you do want to useDynLib() on. -pd (Incidentally, watch your casing, you use "Nepidemic" and "NEpidemic" every other time. Sooner or later you'll find yourself in a situation where the case actually matters and gives you a mysterious malfunction.)
-Vineetha On Thu, Jun 16, 2016 at 2:48 PM, Eduardo M. A. M.Mendes < emammendes at gmail.com> wrote:
Please rename your NAMESPACE to something else and create a new one with
useDynLib(NEpidemic,.registration = TRUE)
export(randomepi)
It is worth a try.
On Jun 16, 2016, at 5:40 PM, Kodalore Vijayan, Vineetha W <vwkv13 at mun.ca>
wrote:
Yes. My package name is "Epidemic" and namespace contains the following:
useDynLib(randomepi)
useDynLib(Nepidemic, .registration = TRUE)
exportPattern("^[[:alpha:]]+")
export(randomepi)
import(graphics,grDevices,stats, utils)
I could see Nepidemic.so and randomepi.o files in the src folder.
-V
On Thu, Jun 16, 2016 at 2:28 PM, Eduardo M. A. M.Mendes <
emammendes at gmail.com> wrote:
Dear Vennetha I am running R on a mac too. Please see if my comments below helps. On Jun 16, 2016, at 5:00 PM, Kodalore Vijayan, Vineetha W <vwkv13 at mun.ca> wrote: I'm trying to write an R package that calls a Fortran subroutine on my Mac os x El Capitan with Xcode 7 and gfortran 6.1, R 3.3.0. I couldn't build the library with my current namespace commands. I get the following error: * installing *source* package ?Nepidemic? ... ** libs gfortran -fPIC -Wall -g -O2 -c randomepi.f95 -o randomepi.o gfortran -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o Nepidemic.so randomepi.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation The name of the library created by r cmd shlib is Nepidemic.so. installing to /Users/Vineetha/myrlibrary/myrpackages/Nepidemic.Rcheck/Nepidemic/libs ** R ** preparing package for lazy loading ** help *** installing help indices ** building package indices ** testing if installed package can be loaded Error in library.dynam(lib, package, package.lib) : shared object ?randomepi.so? not found Note that the r cmd check is looking for randomepi.so so it means that it is calling the wrong library (it should be Nepidemic.so). Are you sure that the NAMESPACE contains the following lines? useDynLib(NEpidemic,.registration = TRUE) export(randomepi) in all the examples I have those lines would suffice. Error: loading failed Execution halted ERROR: loading failed * removing ?/Users/Vineetha/myrlibrary/myrpackages/Nepidemic.Rcheck/Nepidemic? My package name is "NEpidemic" and source code file in src folder is "randomepi.f95" Any help would be much appreciated. I'm vey new to both R and Fortran coding, especially in package building. Thanks in advance! Vineetha [[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
[[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
Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com