Skip to content

[Request] Test for compiler compatibility with -fopenmp before using SHLIB_OPENMP_CFLAGS #2161

Closed

Description

@jimhester

This will allow installation of data.table on systems / compilers that do not support openmp, even if the site Makeconf file defines SHLIB_OPENMP_CFLAGS. This is the case on macOS as of R 3.4.0 with the default clang compiler.

Something like the following should be sufficient, note that ifeq is a GNU make extension, so it will need to be noted in your DESCRIPTION

CXX11=$(shell "${R_HOME}"/bin/R CMD config CXX11)
ifeq ($(shell $(CXX11) -fopenmp -E -xc++ - 2>&1 >/dev/null && echo 'true'), true)
  PKG_CFLAGS=$(SHLIB_OPENMP_CFLAGS)
  PKG_LIBS=$(SHLIB_OPENMP_CFLAGS)
endif

Activity

  1. bryanhanson commented on May 28, 2017

    @bryanhanson

    This issue is currently blocking use of data.table on Mac with the devel version of R, which in turn blocks a number of other packages, and in turn, development and updating of packages:

    > sessionInfo()
    R Under development (unstable) (2017-05-26 r72742)
    Platform: x86_64-apple-darwin15.6.0 (64-bit)
    Running under: macOS Sierra 10.12.5
    
    Matrix products: default
    BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
    LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
    
    locale:
    [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
    
    attached base packages:
    [1] stats     graphics  grDevices utils     datasets 
    [6] methods   base     
    
    loaded via a namespace (and not attached):
    [1] compiler_3.5.0 tools_3.5.0   
    
  2. jimhester commented on Oct 9, 2019

    @jimhester
    ContributorAuthor

    Just a note that this still causes issues (e.g. this new one on R community), particularly after a new release when CRAN has not yet built a binary. Now that you are using a configure script (#3951) it might be worth adding this test to the configure script so compilation will work with the native macOS toolchain (albeit without parallelization).

  3. mattdowle commented on Oct 14, 2019

    @mattdowle
    Member

    @jimhester Thanks for the note. I thought it already worked with compilers without openmp, and that's checked in CRAN_Release.cmd here:

    # Check compiles ok when OpenMP is disabled
    . But clearly I am wrong and that isn't sufficient. I'll try and get my head around what you're saying and suggesting.

    I get a bit frustrated with claims from users that data.table is blocking anything. It's MacOS that's the problem ... why doesn't it include openmp by default? It all works smoothly on Linux and Windows.

  4. added this to the 1.12.7 milestone on Dec 6, 2019
  5. modified the milestones: 1.12.7, 1.12.9 on Dec 8, 2019
  6. modified the milestones: 1.12.11, 1.12.9 on May 26, 2020
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

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions