[Bug] - Include file omp.h not found by clang-18
Using C++ compiler clang++-18 to compile an OpenMP program, the file omp.h is not found.
The file can be found in the directory /usr/lib64/clang/15.0.7/include/
The OS is Amazon Linux 2023 version 2023.7.20250623 on AArch64, specifically the container image: arm64v8/amazonlinux:latest (image id 3e1fc21b862d)
Note that I have installed libomp-devel. The only version I see available is 15.0.7-5.amzn2023.0.1.
If it's helpful for testing, here's a sample program, test.cpp
#include <iostream>
#include <omp.h>
int main() {
#pragma omp parallel
if (omp_get_thread_num() == 0)
std::cout << "I am thread 0 of " << omp_get_num_threads() << "\n";
}
which is expected to compile with clang++-18 -fopenmp test.cpp
You could explicitly include the header, like:
[ec2-user test]$ head -2 test.cpp
#include <iostream>
#include "/usr/lib64/clang/15.0.7/include/omp.h"
It build w/out errors:
[ec2-user test]$ clang++-18 -fopenmp test.cpp
[ec2-user test]$ ./a.out
I am thread 0 of 2
Not sure it's the correct way!
Yes, thank you, or use compiler flag -I/usr/lib64/clang/15.0.7/include
I just thought the Amazon linux packaging team would like to know about this issue.
It looks like we missed adding libomp18, working on it