title: Do multiple gcc versions confuse dylibs (libgcc_s.1.dylib) and prevent binaries from running?
body: <p>I've encountered an error while trying to run Bayescan 2.0.</p>
  
  <p>This is on Mac OS X 10.9.2 Mavericks. When simply calling the program with no input file, the help menu displays normally.</p>
  
  <pre><code>BayeScan2.1_macos64bits --help
  </code></pre>
  
  <p>However when executing the program with input file as argument...</p>
  
  <pre><code>BayeScan2.1_macos64bits test.input
  </code></pre>
  
  <p>this error displays:</p>
  
  <pre><code>dyld: lazy symbol binding failed: Symbol not found: ___emutls_get_address
    Referenced from: /usr/local/lib/libgomp.1.dylib
    Expected in: /usr/local/lib/libgcc_s.1.dylib
  
  dyld: Symbol not found: ___emutls_get_address
    Referenced from: /usr/local/lib/libgomp.1.dylib
    Expected in: /usr/local/lib/libgcc_s.1.dylib
  
  Trace/BPT trap: 5
  </code></pre>
  
  <p>The program has executed perfectly fine in the past. My hunch is that the wrong gcc libs are referenced in 'libgcc_s.1.dylib' but I have no clue how to fix. I've tried installing various versions of gcc and gfortran, but having multiple installs seems generally like a bad idea. Both Macports and Homebrew are installed.</p>
  
  <p>There has been <a href="https://stackoverflow.com/questions/25395195/r-package-installation-error-packfor">another</a> possibly related install issue with an R-forge package with a 'symbol not found' error message that also references libgcc_s.1.dylib. Unfortunately I have no clue what this dylib is, how to search for symbols, link correct versions of gcc, etc.</p>
  
  <p>My active gcc version seems to be LLVM 5.1:</p>
  
  <pre><code>gcc --version
  
  Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
  Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
  Target: x86_64-apple-darwin13.1.0
  Thread model: posix
  </code></pre>
  
  <p>And gfortran version is 4.9:</p>
  
  <pre><code>gfortran --version
  
  GNU Fortran (GCC) 4.9.0
  </code></pre>
  
  <p>However it looks like multiple gcc libs might exist?</p>
  
  <pre><code>ls -1 /usr/local/lib/gcc
  
  i686-apple-darwin8/
  i686-apple-darwin8.8.1/
  powerpc-apple-darwin8/
  x86_64-apple-darwin13.0.0/
  </code></pre>
  
  <p>Also, it looks like other gcc/gfortran versions in /opt/local/bin:</p>
  
  <pre><code>ls -1 /opt/local/bin/*gfortran*; ls -1 /opt/local/bin/*gcc*
  
  /opt/local/bin/gfortran-mp-4.7*
  /opt/local/bin/gfortran-mp-4.8*
  /opt/local/bin/x86_64-apple-darwin13-gfortran-mp-4.7*
  /opt/local/bin/x86_64-apple-darwin13-gfortran-mp-4.8*
  /opt/local/bin/gcc-ar-mp-4.7*
  /opt/local/bin/gcc-ar-mp-4.8*
  /opt/local/bin/gcc-mp-4.7*
  /opt/local/bin/gcc-mp-4.8*
  /opt/local/bin/gcc-nm-mp-4.7*
  /opt/local/bin/gcc-nm-mp-4.8*
  /opt/local/bin/gcc-ranlib-mp-4.7*
  /opt/local/bin/gcc-ranlib-mp-4.8*
  /opt/local/bin/x86_64-apple-darwin13-gcc-4.7.3*
  /opt/local/bin/x86_64-apple-darwin13-gcc-4.8.3*
  /opt/local/bin/x86_64-apple-darwin13-gcc-ar-mp-4.7*
  /opt/local/bin/x86_64-apple-darwin13-gcc-ar-mp-4.8*
  /opt/local/bin/x86_64-apple-darwin13-gcc-mp-4.7*
  /opt/local/bin/x86_64-apple-darwin13-gcc-mp-4.8*
  /opt/local/bin/x86_64-apple-darwin13-gcc-nm-mp-4.7*
  /opt/local/bin/x86_64-apple-darwin13-gcc-nm-mp-4.8*
  /opt/local/bin/x86_64-apple-darwin13-gcc-ranlib-mp-4.7*
  /opt/local/bin/x86_64-apple-darwin13-gcc-ranlib-mp-4.8*
  </code></pre>
  
  <p>Are the multiple versions of gcc/gfortran causing this error? Any other ideas?
  Any help is welcome! Sorry I can't be any more descriptive of my fortran setup.</p>
  
  <p><strong>EDIT:</strong>
  Here is a related post:
  <a href="https://github.com/mash/node-imagemagick-native/issues/17" rel="nofollow">https://github.com/mash/node-imagemagick-native/issues/17</a></p>
  
  <p><strong>EDIT #2:</strong>
  This error is elicited by multiple programs. To illustrate, here is the error message while trying to run the program Genepop:</p>
  
  <pre><code>Genepop
  
  Genepop version 4.2.1
  
  Unable to open file genepop.txt
  Unable to open file dyld: lazy symbol binding failed: Symbol not found: ___emutls_get_address
    Referenced from: /usr/local/lib/libstdc++.6.dylib
    Expected in: /usr/local/lib/libgcc_s.1.dylib
  
  dyld: Symbol not found: ___emutls_get_address
    Referenced from: /usr/local/lib/libstdc++.6.dylib
    Expected in: /usr/local/lib/libgcc_s.1.dylib
  
  Trace/BPT trap: 5
  </code></pre>
  
  <p>If I temporarily mask libgcc_s.1.dylib...</p>
  
  <pre><code>sudo mv /usr/local/lib/libgcc_s.1.dylib /usr/local/lib/libgcc_s.1.dylibTEMP 
  Genepop
  
  Genepop version 4.2.1
  
  Unable to open file genepop.txt
  Unable to open file dyld: lazy symbol binding failed: Symbol not found: ___emutls_get_address
    Referenced from: /usr/local/lib/libstdc++.6.dylib
    Expected in: /usr/lib/libSystem.B.dylib
  
  dyld: Symbol not found: ___emutls_get_address
    Referenced from: /usr/local/lib/libstdc++.6.dylib
    Expected in: /usr/lib/libSystem.B.dylib
  
  Trace/BPT trap: 5
  </code></pre>
  
  <p>And finally if I mask the entire /usr/local directory, this solves the problem for some programs (Genepop)! But not for others (Bayescan):</p>
  
  <pre><code>sudo mv /usr/local /usr/localTEMP
  
  BayeScan2.1_macos64bits test.input
  
  dyld: Library not loaded: /usr/local/lib/libgomp.1.dylib
    Referenced from: /Users/maierpa/programs/Bayescan
    Reason: image not found
  Trace/BPT trap: 5
  </code></pre>