Skip to content

Rcpp compiles using -std=gnu++11 but not -std=c++11. Is this a toolchain issue or an Rcpp issue? #360

Closed

Description

@aadler

Whilst trying to test the new Windows toolchains based on GCC 4.9.x, I have come across an interesting issue. When I compile Rcpp with either nothing or std=gnu++11, Rcpp compiles without any issues. However, when I pass std=c++11 I get:

* installing *source* package 'Rcpp' ...
** package 'Rcpp' successfully unpacked and MD5 sums checked
** libs
g++ -m64 -I"C:/R/R-PATC~2/include" -DNDEBUG -I../inst/include/    -I"C:/R/RLocalSoft/extsoft/include"     -std=c++11 -O2 -mtune=ivybridge -pipe -c Date.cpp -o Date.o
g++ -m64 -I"C:/R/R-PATC~2/include" -DNDEBUG -I../inst/include/    -I"C:/R/RLocalSoft/extsoft/include"     -std=c++11 -O2 -mtune=ivybridge -pipe -c Module.cpp -o Module.o
g++ -m64 -I"C:/R/R-PATC~2/include" -DNDEBUG -I../inst/include/    -I"C:/R/RLocalSoft/extsoft/include"     -std=c++11 -O2 -mtune=ivybridge -pipe -c Rcpp_init.cpp -o Rcpp_init.o
g++ -m64 -I"C:/R/R-PATC~2/include" -DNDEBUG -I../inst/include/    -I"C:/R/RLocalSoft/extsoft/include"     -std=c++11 -O2 -mtune=ivybridge -pipe -c api.cpp -o api.o
api.cpp:40:30: fatal error: execinfo.h: No such file or directory
         #include <execinfo.h>
                              ^
compilation terminated.
make: *** [api.o] Error 1
Warning: running command 'make -f "Makevars.win" -f "C:/R/R-PATC~2/etc/x64/Makeconf" -f "C:/R/R-PATC~2/share/make/winshlib.mk" -f "\\[REDACTED]/.R/Makevars" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="Rcpp.dll" WIN=64 TCLBIN=64 OBJECTS="Date.o Module.o Rcpp_init.o api.o attributes.o barrier.o"' had status 2
ERROR: compilation failed for package 'Rcpp'
* removing 'C:/R/R-patched/library/Rcpp'

The downloaded source packages are in
        ‘C:\R\temp\Rtmp4mtdWr\downloaded_packages’
Warning messages:
1: running command '"C:/R/R-patched/bin/x64/R" CMD INSTALL --byte-compile -l "C:\R\R-patched\library" C:\R\temp\Rtmp4mtdWr/downloaded_packages/Rcpp_0.12.0.tar.gz' had status 1 
2: In install.packages("Rcpp", type = "source", INSTALL_opts = "--byte-compile") :
  installation of package ‘Rcpp’ had non-zero exit status

Is this a toolchain issue, or an issue with Rcpp being built under Windows?

Thank you.

Activity

  1. thirdwing commented on Sep 1, 2015

    @thirdwing
    Member

    This is really weired, execinfo.h shouldn't be included, see https://github.com/RcppCore/Rcpp/blob/master/src/api.cpp#L37-L40

  2. eddelbuettel commented on Sep 1, 2015

    @eddelbuettel
    Member

    Given that is an issue which arises only with the new toolchain, I think you know the answer to this. That said, several #ifdef assumptions may need to be validated. PRs welcome to make Rcpp build on the new and untested toolchain...

  3. eddelbuettel commented on Sep 1, 2015

    @eddelbuettel
    Member

    Looking at

    #if defined(_WIN32)
    

    the recent commit by @kevinushey comes to mind.

    Maybe we need _WIN32 and WIN32 ? Oh the joy of 'doze...

  4. aadler commented on Sep 1, 2015

    @aadler
    Author

    @thirdwing I'm on Win64, but if Win32 is the threading, then yes, it's using Win32 and not posix.

    @eddelbuettel Thank you; I was afraid of that :)

    @jeroenooms, you may be interested in this.

  5. kevinushey commented on Sep 1, 2015

    @kevinushey
    Contributor

    Normally, _WIN32 implies both Windows 32bit and Windows 64bit. I have no idea what the toolchain is doing here. It seems like a bug in the toolchain to me that suddenly _WIN32 would not be defined if -std=c++11 were selected.

    We should put something in platform.h like:

    #if defined(_WIN32) || defined(WIN32) || defined(_WIN64) || defined(WIN64)
    # define RCPP_IS_WINDOWS_SYSTEM
    #endif
    

    and then protect <execinfo.h> with that as well.

    Of course, if this is the case we can probably create a reproducible example and forward it to MinGW...

  6. kevinushey commented on Sep 2, 2015

    @kevinushey
    Contributor

    This issue is already fixed on master. The switch from WIN32 to _WIN32 fixes this. I assume @aadler was building an older version of Rcpp that did not have that fix.

  7. eddelbuettel commented on Sep 2, 2015

    @eddelbuettel
    Member

    Cool. I still like the idea about platform.h though.

  8. aadler commented on Sep 2, 2015

    @aadler
    Author

    I was building from CRAN (Per r-lib/devtools#908) so that makes sense. Looking forward to the next release (or seeing if @kevinushey 's suggestion there is correct). Thank you.

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