Bioconductor / SparseArray

High-performance sparse data representation and manipulation in R
8 stars 2 forks source link

1.4.0 fails to build with Clang-16: `error: expected 'match' clause on 'omp declare variant' directive` #9

Closed barracuda156 closed 4 months ago

barracuda156 commented 6 months ago

New version fails to build with Clang:

  /opt/local/bin/clang-mp-16 -I"/opt/local/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/opt/local/Library/Frameworks/R.framework/Versions/4.4/Resources/library/S4Vectors/include' -I'/opt/local/Library/Frameworks/R.framework/Versions/4.4/Resources/library/IRanges/include' -I'/opt/local/Library/Frameworks/R.framework/Versions/4.4/Resources/library/XVector/include' -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk   -fopenmp -fPIC  -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -arch arm64  -c thread_control.c -o thread_control.o
  In file included from thread_control.c:7:
  /opt/local/include/libomp/omp.h:494:39: error: expected 'match' clause on 'omp declare variant' directive
      #pragma omp begin declare variant match(device={kind(host)})
                                        ^
  /opt/local/Library/Frameworks/R.framework/Resources/include/Rinternals.h:984:17: note: expanded from macro 'match'
  #define match                   Rf_match
                                  ^
  In file included from thread_control.c:7:
  /opt/local/include/libomp/omp.h:497:39: error: expected 'match' clause on 'omp declare variant' directive
      #pragma omp begin declare variant match(device={kind(nohost)})
                                        ^
  /opt/local/Library/Frameworks/R.framework/Resources/include/Rinternals.h:984:17: note: expanded from macro 'match'
  #define match                   Rf_match
                                  ^
  2 errors generated.
  make: *** [thread_control.o] Error 1
  ERROR: compilation failed for package ‘SparseArray’
  * removing ‘/opt/local/var/macports/build/_Users_runner_work_macports-ports_macports-ports_ports_R_R-SparseArray/R-SparseArray/work/build/SparseArray’
  Command failed:  cd "/opt/local/var/macports/build/_Users_runner_work_macports-ports_macports-ports_ports_R_R-SparseArray/R-SparseArray/work/SparseArray" && /opt/local/bin/R CMD INSTALL . --library=/opt/local/var/macports/build/_Users_runner_work_macports-ports_macports-ports_ports_R_R-SparseArray/R-SparseArray/work/build --install-tests 
  Error: Failed to build R-SparseArray: command execution failed

GCC build is fine.

hpages commented 6 months ago

Thanks for the report.

Hopefully adding the following line will do: https://github.com/Bioconductor/SparseArray/blob/533a86a5fee60e5bcb2f5cd8c16f2019eca8ac04/src/thread_control.c#L7-L10 Unfortunately I don't have access to Clang-16 so was not able to test.

This is in SparseArray 1.5.2 (devel branch) and 1.4.2 (RELEASE_3_19 branch).

hpages commented 5 months ago

@barracuda156 Can you confirm the problem is gone with the latest version? Thanks

barracuda156 commented 4 months ago

@barracuda156 Can you confirm the problem is gone with the latest version? Thanks

Yes, 1.4.8 builds fine across the board: https://ports.macports.org/port/R-SparseArray/details