Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
barracuda156 opened this issue May 4, 2024 · 2 comments

Comments

@barracuda156
Copy link

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 added a commit that referenced this issue May 6, 2024
See #9

Note on previous commit: commit 2fc4998 added back and forth coersions
between ngCMatrix and SVT_SparseMatrix objects.
hpages added a commit that referenced this issue May 6, 2024
See #9

Also:
- Bring back coercion from dgCMatrix to ngCMatrix. This is another
  critically endangered coercion method originally defined in the Matrix
  package but that the lazy Matrix maintainers have decided to eradicate
  from the surface of Earth in an attempt to make the life of their users
  no so easy.
- Add back and forth coersions between ngCMatrix and SVT_SparseMatrix
  objects.
- Add nzwhich() method for RsparseMatrix objects.
- Add nzvals() methods for ngCMatrix and ngRMatrix objects.
@hpages
Copy link
Contributor

hpages commented May 6, 2024

Thanks for the report.

Hopefully adding the following line will do:

/* <Rinternals.h> defines macro match that seems to break <omp.h> on
some versions of Clang.
See https://github.com/Bioconductor/SparseArray/issues/9 */
#undef match

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
Copy link
Contributor

hpages commented May 24, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants