静态链接OpenMP
我有一个带有OpenMP功能的CPP文件,我想静态地链接它。我已经尝试了建议的解决方案在这里但没有成功。
如果我使用以下命令:
g++ -c main.cpp -fopenmp -o main.o
g++ -static -lgomp -lpthread main.o -o main
我会发现错误,说没有提及“ dlopen,dlsym,dlclose,dlerror”。
因此,我还尝试在链接命令中添加-fopenmp
标志:
g++ -c main.cpp -fopenmp -o main.o
g++ -static -lgomp -lpthread -fopenmp main.o -o main
现在我没有收到链接错误,但是我收到了此警告:
/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
此警告建议我 static linking 还没有成功(即使ldd main
状态不是动态的可执行文件
。
有什么建议吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论