使用gcc-4.7和openMP缺少___emutls_get_address [英] Missing ___emutls_get_address with gcc-4.7 and openMP
问题描述
我正在尝试在Mac OS 10.8.2上使用自编译的GCC-4.7.1编译程序.该程序使用openMP,编译成功;但是,当我尝试运行程序时,动态链接器会抱怨
I am trying to compile a program using a self-compiled GCC-4.7.1 on Mac OS 10.8.2. The program uses openMP and the compilation succeeds; however, when I try to run the program, the dynamic linker complains with
dyld: lazy symbol binding failed: Symbol not found: ___emutls_get_address
Referenced from: /usr/local/gcc-4.7.1/lib/libgomp.1.dylib
Expected in: /usr/lib/libSystem.B.dylib
dyld: Symbol not found: ___emutls_get_address
Referenced from: /usr/local/gcc-4.7.1/lib/libgomp.1.dylib
Expected in: /usr/lib/libSystem.B.dylib
使用-fopenmp编译的任何程序(包括MWE)中始终存在此问题
This issue is constantly present in any program compiled with -fopenmp, including the MWE
#include <stdio.h>
int main() {
#pragma omp parallel
printf("Hallo!\n");
return 0;
}
请注意,"___emutls_get_address"是什么?符号?,即在链接阶段添加 -lgcc_eh
无效(我仍然得到相同的dyld错误消息).
Note that the solution suggested in What is the "___emutls_get_address" symbol?, namely adding -lgcc_eh
in the linking phase, does not work (I still get the same dyld error message).
推荐答案
我也遇到了完全相同的问题.而且我是openMP的新手,使用Michal Fapso提供的解决方案的技能也不是很好.我通过使用
I had exactly the same problem too. And I am new to openMP, and my skill is not that good to use the solution offered by Michal Fapso. I solve this problem by using
brew link --overwrite gcc
问题解决了!
也许您可以尝试将gcc重新安装到Mac.
Maybe you can try to reinstall gcc to your Mac.
这篇关于使用gcc-4.7和openMP缺少___emutls_get_address的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!