I have a simple C++ program that does nothing:
int main() { return 0; }
I am trying to build this program completely statically using the following command:
g++ -o c c.cc -static
Everything works fine. However, when I try to link OpenMP, which is not actually a library, using the -fopenmp flag in static mode like this:
g++ -o c c.cc -fopenmp -static
The compiler gives an error:
/usr/bin/ld: cannot find -lgomp: No such file or directorycollect2: error: ld returned 1 exit status
This issue occurs with clang++ as well. The same happens with gcc and g++. However, other libraries that have static versions, such as curl, link correctly in static mode.
(I am on Arch Linux)