amazon-linux-2023 icon indicating copy to clipboard operation
amazon-linux-2023 copied to clipboard

[Bug] - Include file omp.h not found by clang-18

Open hpkfft opened this issue 5 months ago • 4 comments

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)

hpkfft avatar Jul 04 '25 21:07 hpkfft

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

hpkfft avatar Jul 05 '25 20:07 hpkfft

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!

zcobol avatar Jul 05 '25 21:07 zcobol

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.

hpkfft avatar Jul 05 '25 21:07 hpkfft

It looks like we missed adding libomp18, working on it

ozbenh avatar Jul 07 '25 01:07 ozbenh