Skip to content

Rcpp compilation issue on Alpine distribution #448

Closed

Description

@lostie
"Command failed (1)

Failed to run system command:

'/usr/lib/R/bin/R' --vanilla CMD INSTALL '/tmp/RtmpDPDGNf/Rcpp' --library='/app/packrat/lib/x86_64-alpine-linux-musl/3.2.3' --install-tests --no-docs --no-multiarch --no-demo
The command failed with output:
* installing *source* package 'Rcpp' ...
** package 'Rcpp' successfully unpacked and MD5 sums checked
** libs
x86_64-alpine-linux-musl-g++ -I/usr/lib/R/include -DNDEBUG -I../inst/include/ -Os -fomit-frame-pointer    -fpic  -Os -fomit-frame-pointer  -c Date.cpp -o Date.o
x86_64-alpine-linux-musl-g++ -I/usr/lib/R/include -DNDEBUG -I../inst/include/ -Os -fomit-frame-pointer    -fpic  -Os -fomit-frame-pointer  -c Module.cpp -o Module.o
x86_64-alpine-linux-musl-g++ -I/usr/lib/R/include -DNDEBUG -I../inst/include/ -Os -fomit-frame-pointer    -fpic  -Os -fomit-frame-pointer  -c Rcpp_init.cpp -o Rcpp_init.o
x86_64-alpine-linux-musl-g++ -I/usr/lib/R/include -DNDEBUG -I../inst/include/ -Os -fomit-frame-pointer    -fpic  -Os -fomit-frame-pointer  -c api.cpp -o api.o
api.cpp:40:30: fatal error: execinfo.h: No such file or directory
compilation terminated.
/usr/lib/R/etc/Makeconf:141: recipe for target 'api.o' failed
make: *** [api.o] Error 1
ERROR: compilation failed for package 'Rcpp'
* removing '/app/packrat/lib/x87_64-alpine-linux-musl/3.2.3/Rcpp'"

It seems related to #360 (although on a diferrent platform).

The code it is hitting seems to be https://github.com/RcppCore/Rcpp/blob/0.12.3/src/api.cpp#L40

According to the gnulib page it seems that for platforms that the file is missing it should only have a stub (do nothing).

Alpine Linux is a security-oriented, lightweight Linux distribution based on musl libc
http://wiki.alpinelinux.org/wiki/Main_Page

Alpine seems to use a different libc as mentioned above

Is that the Alpine distribution be covered by the Rcpp api.cpp to just use a stub?

Activity

  1. eddelbuettel commented on Mar 21, 2016

    @eddelbuettel
    Member

    I would encourage you to work up a (minimal) pull request demonstrating (via Travis CI) that nothing breaks on other systems yet that it recognizes your (somewhat exotic) libc variant.

    We generally rely on that set of defines list over here at sourceforge. Methinks the required change may just be on one line (but possibly one line in several files).

  2. thirdwing commented on Mar 21, 2016

    @thirdwing
    Member

    From musl source code (http://git.musl-libc.org/cgit/musl/tree/include), there seems no execinfo.h.

    I know GLIBC defines several macros (https://github.com/lattera/glibc/blob/master/include/features.h#L358), so we know we are using GLIBC.

    I am not sure there are such macros in musl.

  3. eddelbuettel commented on Mar 21, 2016

    @eddelbuettel
    Member

    @thirdwing take a step back -- @lostie correctly pointed to line 40 for execinfo.h but on line 37 we have the very test he needs to expand. Should not be hard, may however also be needed somewhere else.

  4. lostie commented on Mar 21, 2016

    @lostie
    ContributorAuthor

    I don't seem to be able to push my changes to the remote 😢

    Here's a suggested patch: https://gist.github.com/lostie/425d11dff9c06cc9ff89

  5. thirdwing commented on Mar 21, 2016

    @thirdwing
    Member

    Hi @lostie

    I think there is another place need to be changed line260 . Maybe more.

    This change means we will only have the full backtrace info using GLIBC.

  6. eddelbuettel commented on Mar 21, 2016

    @eddelbuettel
    Member

    I don't seem to be able to push my changes to the remote 😢

    Welcome to git(hub). You are supposed to fork a repo after which you can push to your copy after which you can (once happy) propose a pull request back to our repo. Which we, who have write access to our repo, may or may not accept.

    There are lots of tutorials for all of this.

  7. eddelbuettel commented on Mar 31, 2016

    @eddelbuettel
    Member

    This was taken care of in #449.

  8. thirdwing commented on May 18, 2016

    @thirdwing
    Member

    @albap Hi, you need to modify the Makevars first.

  9. thirdwing commented on May 18, 2016

    @thirdwing
    Member

    You need -D__MUSL__ in the PKG_CXXFLAGS to install Rcpp on Alpine.

    You can add the following line

    PKG_CXXFLAGS = -D__MUSL__
    

    into Makevars (https://github.com/RcppCore/Rcpp/blob/master/src/Makevars) in the package.

  10. thirdwing commented on May 18, 2016

    @thirdwing
    Member

    You can try with a ~/.R/Makevars with content

    CXXFLAGS = -D__MUSL__
    
  11. eddelbuettel commented on May 18, 2016

    @eddelbuettel
    Member

    @thirdwing 's suggestion is what I would do but possibly with += rather than =:

    CXXFLAGS  += -D__MUSL__
    CXX1XFLAGS += -D__MUSL__
    

    to ensure C++ and C++11 have it set. That will affect all R builds across all packages; and at least Rcpp should take advantage of it.

  12. jirutka commented on May 20, 2016

    @jirutka

    Can we set it in system-wide Makeconf instead of Makevars? What’s difference between them?

  13. thirdwing commented on May 20, 2016

    @thirdwing
    Member

    Not everyone has the permission to change system-wide configurations.

  14. kevinushey commented on May 20, 2016

    @kevinushey
    Contributor

    Basically, when R compiles code in a package, it calls make and reads in the system Makeconf, and then applies (potentially amending or overriding) any variables set in the appropriate Makevars files. If you're able to just edit the Makeconf file, that should be sufficient.

    Reading the file at R.home("bin")/config is somewhat helpful (it shows how R looks up and uses the various Makefiles)

  15. jirutka commented on May 20, 2016

    @jirutka

    Not everyone has the permission to change system-wide configurations.

    That’s not what I’ve asked. I’m maintainer of the R package in Alpine Linux, so I’m about to add CXXFLAGS and CXX1XFLAGS as the default for the package.

    @kevinushey, thanks, so I’m gonna add these to the Makeconf.

  16. sgerrand commented on Jul 14, 2016

    @sgerrand

    Is it something that could be automated on Alpine Linux?

    @albap @jirutka: 📝 This change now exists in each of the Alpine packages for R which I maintain - https://github.com/sgerrand/alpine-pkg-R/releases. I've updated the value of R_XTRA_CPPFLAGS, so packages like Rcpp now compile out of the box.

    Try it out:

    wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://raw.githubusercontent.com/sgerrand/alpine-pkg-R/master/sgerrand.rsa.pub
    apk --no-cache -X http://apkproxy.heroku.com/sgerrand/alpine-pkg-R add R R-dev R-doc
    
  17. eddelbuettel commented on Jul 14, 2016

    @eddelbuettel
    Member

    Thanks for the update. As it happens, we'll probably release a new Rcpp version within a few days so if you have some cycles to spare, could you try the current master branch here (with version 0.12.5.7 likely to become 0.12.6 'real soon now') ?

  18. jirutka commented on Jul 14, 2016

    @jirutka

    @sgerrand I wonder, why do you maintain sgerrand/alpine-pkg-R when we already have R package in official Alpine repository?

  19. sgerrand commented on Jul 14, 2016

    @sgerrand

    @sgerrand I wonder, why do you maintain sgerrand/alpine-pkg-R when we already have R package in official Alpine repository?

    Mainly because that package predated my packaging efforts, it is still only
    in the edge branch and not publicly released.

  20. eddelbuettel commented on Jul 14, 2016

    @eddelbuettel
    Member

    This is all getting a little too inside-baseball for Rcpp so I am going to lock this discussion here.

    As it stands, Rcpp appears to be twice compiled right for Alpine we're all a happy family now.

  21. locked and limited conversation to collaborators on Jul 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions