Missing ___emutls_get_address with gcc-4.7 and openMP
Asked Answered
U

2

10

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

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;
}

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).

Ullage answered 16/11, 2012 at 10:30 Comment(4)
Strange, I did compile recently GCC 4.7.1 on OS X 10.8.2 according to this guide and the OpenMP support works flawlessly.Nakano
@HristoIliev I'll check again how I compiled it and try to recompile. Hopefully the issue disappears...Ullage
A similar question and answer have been posted there: #7885746Sicilia
After upgrading the version of the org.deeplearning4j from 1.0.0-beta5 to 1.0.0-beta6 it is ok.Travax
V
9

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

and the problem is solved!

Maybe you can try to reinstall gcc to your Mac.

Veinstone answered 3/4, 2019 at 16:37 Comment(0)
E
3

I had exactly the same problem. In my case it was caused by linking against a library (I don't remember which one) of an older version of gcc installed by XCode, which was in /usr/lib. When I corrected it to link against the newer gcc library of the version I used for compiling (in /usr/local) this error was fixed.

So just check your built executable and all the libraries it is linked with using

otool -L EXECUTABLE_OR_DYLIB

And if you find anything linked with a library of an older gcc, fix that.

Eure answered 13/5, 2014 at 19:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.