Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue linking in CRAN M1 server #40

Open
david-cortes opened this issue Jul 15, 2021 · 3 comments · May be fixed by #41
Open

Issue linking in CRAN M1 server #40

david-cortes opened this issue Jul 15, 2021 · 3 comments · May be fixed by #41

Comments

@david-cortes
Copy link
Contributor

I'm having issues with the CRAN checks on apple M1 for a package that links to float:
https://www.stats.ox.ac.uk/pub/bdr/M1mac/recometrics.log
https://www.stats.ox.ac.uk/pub/bdr/M1mac/recometrics.out

Seems the linking is not working:

* installing *source* package ‘recometrics’ ...
** package ‘recometrics’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang++ -std=gnu++11 -I"/Users/ripley/R/R-devel/include" -DNDEBUG -D_FOR_R -I'/Users/ripley/R/Library/Rcpp/include' -I'/Users/ripley/R/Library/float/include' -I/opt/R/arm64/include   -fPIC  -g -O2  -c RcppExports.cpp -o RcppExports.o
clang++ -std=gnu++11 -I"/Users/ripley/R/R-devel/include" -DNDEBUG -D_FOR_R -I'/Users/ripley/R/Library/Rcpp/include' -I'/Users/ripley/R/Library/float/include' -I/opt/R/arm64/include   -fPIC  -g -O2  -c Rwrapper.cpp -o Rwrapper.o
clang++ -std=gnu++11 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Users/ripley/R/R-devel/lib -L/opt/R/arm64/lib -o recometrics.so RcppExports.o Rwrapper.o -L/Users/ripley/R/R-devel/lib -lRblas -L/opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.2.0/11.0.0 -L/opt/R/arm64/gfortran/lib -lgfortran -lemutls_w -lm -L/Users/ripley/R/Library/float/libs /Users/ripley/R/Library/float/libs/float.so -Wl,-rpath /Users/ripley/R/Library/float/libs -L/Users/ripley/R/R-devel/lib -lR -Wl,-framework -Wl,CoreFoundation
installing to /Users/ripley/R/packages/tests-devel/recometrics.Rcheck/00LOCK-recometrics/00new/recometrics/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘recometrics’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Users/ripley/R/packages/tests-devel/recometrics.Rcheck/00LOCK-recometrics/00new/recometrics/libs/recometrics.so':
  dlopen(/Users/ripley/R/packages/tests-devel/recometrics.Rcheck/00LOCK-recometrics/00new/recometrics/libs/recometrics.so, 6): Library not loaded: float.so
  Referenced from: /Users/ripley/R/packages/tests-devel/recometrics.Rcheck/00LOCK-recometrics/00new/recometrics/libs/recometrics.so
  Reason: image not found
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Users/ripley/R/packages/tests-devel/recometrics.Rcheck/recometrics’
* using log directory ‘/Users/ripley/R/packages/tests-devel/recometrics.Rcheck’
* using R Under development (unstable) (2021-07-15 r80623)
* using platform: aarch64-apple-darwin20.5.0 (64-bit)
* using session charset: UTF-8
* using option ‘--no-stop-on-test-error’
* checking for file ‘recometrics/DESCRIPTION’ ... OK
* checking extension type ... Package
* this is package ‘recometrics’ version ‘0.1.2’
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for executable files ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking whether package ‘recometrics’ can be installed ... ERROR
Installation failed.
See ‘/Users/ripley/R/packages/tests-devel/recometrics.Rcheck/00install.out’ for details.
* DONE

Status: 1 ERROR
See
  ‘/Users/ripley/R/packages/tests-devel/recometrics.Rcheck/00check.log’
for details.

       12.06 real        10.47 user         1.09 sys

Works fine in other platforms though.

@david-cortes
Copy link
Contributor Author

From Prof. Ripley:
"At least two issues need to be addressed:

  • float.so is not in general a library.
  • -Wl,-rpath is not portable and may well not do what it does on Linux.

See 'Writing R Extensions' §5.8 for fairly portable solutions."

In 'Writing R Extensions' it mentions that shared objects in mac should end in .dylib and that .so objects are not linkeable there.

It also mentions that rpath is specific to the GNU linker - should packages that link to float perhaps also have a requirement for GNU linker specified? Not sure if adding a variable LD in Makevars + SystemRequires in DESCRIPTION would do though.

@snoweye
Copy link
Contributor

snoweye commented Jul 19, 2021

Try the static library on mac. See rsparse for example.

The mac needs special treatment such as here as LinkingTo may be for simple usage.

@david-cortes
Copy link
Contributor Author

@snoweye Thanks for the reply. I see nevertheless that the code in that PR is no longer used in the current master branch.Does that mean it is now enough to just use float:::ldflags(static=TRUE) for macOS?

david-cortes added a commit to david-cortes/float that referenced this issue Jul 24, 2021
I think this should fix dynamic linkage for macOS, at least when using the clang compiler.

Fixes wrathematics#40 .
@david-cortes david-cortes linked a pull request Jul 24, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants