I have a cpp file with openMP functions and I want to link it statically. I have already tried solution proposed here but without success.
If I use the following commands:
g++ -c main.cpp -fopenmp -o main.o
g++ -static -lgomp -lpthread main.o -o main
I get errors saying that there is no reference to "dlopen, dlsym, dlclose, dlerror".
So, I tried also to add -fopenmp
flag in linking command:
g++ -c main.cpp -fopenmp -o main.o
g++ -static -lgomp -lpthread -fopenmp main.o -o main
Now I don't receive linking errors, but I get this warning:
/usr/lib/gcc/x86_64-linux-gnu/7/libgomp.a(target.o): in function "gomp_target_init":
(.text+0x8b): attention: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
This warning suggest me that static linking has not been successful (even if ldd main
states is not a dynamic executable
.
Any suggestion?