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

Community
  • 1
  • 1
Marco Lombardi
  • 545
  • 4
  • 18
  • Strange, I did compile recently GCC 4.7.1 on OS X 10.8.2 according to [this guide](http://solarianprogrammer.com/2012/07/21/compiling-gcc-4-7-1-mac-osx-lion/) and the OpenMP support works flawlessly. – Hristo Iliev Nov 16 '12 at 10:39
  • @HristoIliev I'll check again how I compiled it and try to recompile. Hopefully the issue disappears... – Marco Lombardi Nov 16 '12 at 14:41
  • A similar question and answer have been posted there: http://stackoverflow.com/questions/7885246/what-is-the-emutls-get-address-symbol – FabienRohrer Jan 30 '14 at 08:24
  • After upgrading the version of the org.deeplearning4j from 1.0.0-beta5 to 1.0.0-beta6 it is ok. – Oleksii Kyslytsyn Jan 02 '20 at 18:37

2 Answers2

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.

FL1NT
  • 101
  • 1
  • 2
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.

Michal Fapso
  • 1,242
  • 1
  • 15
  • 21