This is a small reproducing example.
Describe the bug
I’m trying buid a c++ project with nvidia HPC compiler with openmp . This project compiled with meson.
When I using default compiler (gcc c++) with openmp, it’s OK.
But nvidia hpc compiler is failed.
To Reproduce
meson.build file:
project('nvidiaHPCtest', 'cpp')
ompdep = dependency('openmp')
executable('demo', 'main.cpp', dependencies : ompdep)
main.cpp file:
#include <iostream>
#include <omp.h>
int main(int argc, char **argv) {
#if defined(_OPENMP)
std::cout << "openmp is defined\n";
#endif
#pragma omp parallel
{
std::cout <<"Hello there.\n";
}
return 0;
}
Expected behavior
gcc meson compile command:
1. meson setup builddir
2. cd builddir
3. ninja
nvidia hpc compile command:
1. CC=/mnt/f/work/nvhpc/Linux_x86_64/23.5/compilers/bin/nvc CXX=/mnt/f/work/nvhpc/Linux_x86_64/23.5/compilers/bin/nvc++ meson setup builddir
It will failed with ERROR: Dependency “openmp” not found, tried system.
note: my nvidia hpc compiler installed in /mnt/f/work/nvhpc/Linux_x86_64/23.5/compilers/bin
system parameters
- This is a Windows wsl2 Ubuntu subsystem compile
- Ubuntu 22.04
- Python 3.10.6
- meson 0.61.2
- ninja 1.10.1
I have also post this issue on github #meson build for some comments with meson compile.
meson build error with openmp using nvidia HPC compiler · Issue #11880 · mesonbuild/meson (github.com)