Hi all, Because of (the great) Rcpp, the size of my package was over 5Mb, which was an issue for a Cran release. I read with interest this article http://dirk.eddelbuettel.com/blog/2017/08/14/#009_compact_shared_libraries In particular, I was interested in the Makevars modification: strippedLib: $(SHLIB) if test -e "/usr/bin/strip"; then /usr/bin/strip --strip-debug $(SHLIB); fi Unfortunately it crashed compilation on Mac OS because for some reason --strip-debug doesn't exist. But this small modification works: strippedLib: $(SHLIB) if test -e "/usr/bin/strip" & test -e "/bin/uname" & [[ `uname` == "Linux" ]] ; then /usr/bin/strip --strip-debug $(SHLIB); fi May be there is a way to make strip works correctly on Mac, but as I have no size issue on both Windows and Mac OS... I don't care. I thought it was useful enough to share it with you. Kind regards, ________________ Micha?l BENESTY michael at benesty.fr Please do not print this e-mail unless you really need to.
[Rcpp-devel] Stripping symbols and Cran
8 messages · Michaël BENESTY, Dan Dillon, Qiang Kou +2 more
Michael,
On 18 September 2017 at 16:55, Micha?l BENESTY wrote:
| Because of (the great) Rcpp, the size of my package was over 5Mb, which was | an issue for a Cran release. Are you the OP behind the StackOverflow question here: https://stackoverflow.com/questions/46280628/object-files-in-r-package-too-large-rcpp If so we already tried to answer. This is NOT an issue for CRAN but merely a warning. Do yourself a quick favour and run file.info( system.file("libs", "dplyr.so", package="dplyr") )$size and you see that some well-known and widely used packages are MUCH bigger. | I read with interest this article | http://dirk.eddelbuettel.com/blog/2017/08/14/#009_compact_shared_libraries | | In particular, I was interested in the Makevars modification: | | strippedLib: $(SHLIB) | if test -e "/usr/bin/strip"; then /usr/bin/strip --strip-debug | $(SHLIB); fi | | Unfortunately it crashed compilation on Mac OS because for some reason | --strip-debug doesn't exist. Interesting. It so happens that I just shipped a use of `strip --strip-unneeded` in RcppClassic, see https://github.com/eddelbuettel/rcppclassic/blob/7cc5c626952d38cc97a99363131fe7ac9d0a7b28/src/Makevars#L33 Does --strip-unneeded work on macOS ? | But this small modification works: | strippedLib: $(SHLIB) | if test -e "/usr/bin/strip" & test -e "/bin/uname" & [[ | `uname` == "Linux" ]] ; then /usr/bin/strip --strip-debug $(SHLIB); fi Maybe --strip-unneeded is for preferable. Otherwise, yes, one needs to check for Linux here. But that is the crux of these Makefile / Makevars tweaks. They get non-portable real quickly. The easiest may just be to NOT worry, and just use -W,-S in the local ~/.R/Makevars. That is what I now do. | May be there is a way to make strip works correctly on Mac, but as I | have no size issue on both Windows and Mac OS... I don't care. | | I thought it was useful enough to share it with you. It is useful. Dan worked quite a bit on this too. See his repo at https://github.com/dcdillon/r-stripper Dirk
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
Hi Dirk, I am not the author of the question on SO, but the timing is perfect :-) I am aware of Dplyr size (I read ur blog carefully!!!) but really wanted to have 0 note. Just tried --strip-unneeded : not the silver bullet :-( #> error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip: unrecognized option: --strip-unneeded Kind regards, ________________ Micha?l BENESTY michael at benesty.fr Please do not print this e-mail unless you really need to.
On Mon, Sep 18, 2017 at 5:19 PM, Dirk Eddelbuettel <edd at debian.org> wrote:
Michael, On 18 September 2017 at 16:55, Micha?l BENESTY wrote: | Because of (the great) Rcpp, the size of my package was over 5Mb, which was | an issue for a Cran release. Are you the OP behind the StackOverflow question here: https://stackoverflow.com/questions/46280628/object-files-in-r-package-too-large-rcpp If so we already tried to answer. This is NOT an issue for CRAN but merely a warning. Do yourself a quick favour and run file.info( system.file("libs", "dplyr.so", package="dplyr") )$size and you see that some well-known and widely used packages are MUCH bigger. | I read with interest this article | http://dirk.eddelbuettel.com/blog/2017/08/14/#009_compact_shared_libraries | | In particular, I was interested in the Makevars modification: | | strippedLib: $(SHLIB) | if test -e "/usr/bin/strip"; then /usr/bin/strip --strip-debug | $(SHLIB); fi | | Unfortunately it crashed compilation on Mac OS because for some reason | --strip-debug doesn't exist. Interesting. It so happens that I just shipped a use of `strip --strip-unneeded` in RcppClassic, see https://github.com/eddelbuettel/rcppclassic/blob/7cc5c626952d38cc97a99363131fe7ac9d0a7b28/src/Makevars#L33 Does --strip-unneeded work on macOS ? | But this small modification works: | strippedLib: $(SHLIB) | if test -e "/usr/bin/strip" & test -e "/bin/uname" & [[ | `uname` == "Linux" ]] ; then /usr/bin/strip --strip-debug $(SHLIB); fi Maybe --strip-unneeded is for preferable. Otherwise, yes, one needs to check for Linux here. But that is the crux of these Makefile / Makevars tweaks. They get non-portable real quickly. The easiest may just be to NOT worry, and just use -W,-S in the local ~/.R/Makevars. That is what I now do. | May be there is a way to make strip works correctly on Mac, but as I | have no size issue on both Windows and Mac OS... I don't care. | | I thought it was useful enough to share it with you. It is useful. Dan worked quite a bit on this too. See his repo at https://github.com/dcdillon/r-stripper Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
What is the output of strip --help (or equivalent) on macOS? Surely there is some option that does the same thing. This doesn't solve your desire for no NOTEs on CRAN because to do it right you'd have to detect what strip you were calling and pass the right option to each variant, but it could point you in the right direction. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20170918/28bd7ef7/attachment.html>
On balance, I think you should ask on r-package-devel. Rcpp cannot help you here as R does not offer portable and reliable hooks. I recommend (and I am dead serious) to just live with the note. Dirk
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
On OSX, "-strip-all" or "-strip-debug" should work. See [1] for more information. Best, Qiang Kou [1] http://releases.llvm.org/2.9/docs/CommandGuide/html/llvm-ld.html
On Mon, Sep 18, 2017 at 11:42 AM, Dan Dillon <dcdillon at gmail.com> wrote:
What is the output of strip --help (or equivalent) on macOS? Surely there is some option that does the same thing. This doesn't solve your desire for no NOTEs on CRAN because to do it right you'd have to detect what strip you were calling and pass the right option to each variant, but it could point you in the right direction.
_______________________________________________ Rcpp-devel mailing list Rcpp-devel at lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
Qiang Kou qkou at umail.iu.edu School of Informatics and Computing, Indiana University -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20170918/1a0ca4c7/attachment-0001.html>
Note that macOS doesn't include debugging info in the objects so stripping is meaningless there. I wasn't on the full thread - which package are we talking about? Cheers, Simon
On Sep 18, 2017, at 5:34 PM, Qiang Kou <qkou at umail.iu.edu> wrote: On OSX, "-strip-all" or "-strip-debug" should work. See [1] for more information. Best, Qiang Kou [1] http://releases.llvm.org/2.9/docs/CommandGuide/html/llvm-ld.html On Mon, Sep 18, 2017 at 11:42 AM, Dan Dillon <dcdillon at gmail.com> wrote: What is the output of strip --help (or equivalent) on macOS? Surely there is some option that does the same thing. This doesn't solve your desire for no NOTEs on CRAN because to do it right you'd have to detect what strip you were calling and pass the right option to each variant, but it could point you in the right direction.
_______________________________________________ Rcpp-devel mailing list Rcpp-devel at lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel -- Qiang Kou qkou at umail.iu.edu School of Informatics and Computing, Indiana University _______________________________________________ Rcpp-devel mailing list Rcpp-devel at lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
On 18 September 2017 at 17:46, Simon Urbanek wrote:
| Note that macOS doesn't include debugging info in the objects so stripping is meaningless there. | I wasn't on the full thread - which package are we talking about? Michael started the thread generally musing about large sizes of object files from C++. And he has a point :) And he found my blog post showing the (absurd !!) gains from stripping, tried it on macOS and had issues. It so happens that I just updated the stone-old RcppClassic on the weekend, and in my infinite wisdom include such a call to strip with the unavailable-on-macOS option :-/ Oops. I broke my build. Fix coming to a CRAN mirror near you, likely testing for /usr/bin/strip AND being on Linux. Dirk
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org