0

I'm having an issue running KING on Mac OS X . It has to do with a dyld link error, I think. Does anybody have any suggestions on how to fix this error?

Thanks in advance.

   > ./king -b ./ex/ex.bed

Returns:

dyld: Symbol not found: __ZdaPvm
  Referenced from: /Users/gaelgarcia/Downloads/./king (which was built for Mac OS X 10.13)
  Expected in: /usr/local/lib/libstdc++.6.dylib
 in /Users/gaelgarcia/./king
Abort trap: 6
Carmen Sandoval
  • 2,266
  • 5
  • 30
  • 46
  • normally a `dyld` error is a dynamic linker issue. in my experience, the problem lies in the compilation. what version of Mac are you using? did you compile KING from source? is it built with all of the requisite libraries? – Kevin L. Keys May 09 '18 at 14:47

2 Answers2

2

I had similar issues trying to use the provided precompiled Mac version. I was able to get a running version built from source running the following in the unzipped source directory:

clang++ -L /opt/local/lib/libomp/ -lm -lz -O2 -fopenmp -o king *.cpp

having first installed libomp in the above directory. I use Macports, so I did this with

port install libomp

For Homebrew users, the recommendation seems to be to simply install llvm, which now includes openmp support directly.


EDIT: Having installed llvm via Homebrew (brew install llvm), the command that got KING properly built and running on my Mac OS 10.12 was:

/usr/local/Cellar/llvm/6.0.0/bin/clang++ -I /usr/local/Cellar/llvm/6.0.0/include -L /usr/local/Cellar/llvm/6.0.0/lib -O2 -fopenmp -lm -lz -o king *.cpp

Running the newly built executable with the example .bed file provided:

> ./king -b ../ex/ex.bed

KING 2.1.3 - (c) 2010-2018 Wei-Min Chen

The following parameters are in effect:
Binary File :    ../ex/ex.bed (-bname)
Carmen Sandoval
  • 2,266
  • 5
  • 30
  • 46
merv
  • 67,214
  • 13
  • 180
  • 245
  • Thank you for your answer, merv. Can you elaborate on how you installed `libomp`? – Carmen Sandoval May 09 '18 at 21:10
  • Thanks. I just installed `llvm` as suggested, and updated my build command to: `clang++ -L /usr/local/Cellar/llvm -lm -lz -O2 -fopenmp -o king *.cpp`... but still get an error to do with `openMP` : `clang: error: unsupported option '-fopenmp'` . I'm not sure if I'm specifyng `-L`correctly. – Carmen Sandoval May 10 '18 at 00:02
  • 1
    @gaelgarcia, following [the other answer](https://stackoverflow.com/a/39843038/570918), your line should be something like: `/usr/local/Cellar/llvm/bin/clang++ -I/usr/local/Cellar/llvm/include -L/usr/local/Cellar/llvm/lib -fopenmp -lm -lz -O2 king *.cpp`. Basically, you're going to use clang from the llvm you've just installed. – merv May 10 '18 at 16:59
  • Can I PayPal you for a coffee please? It's working! Thank you so, so much. And I'm serious about the coffee. I'm editing your answer to make the solution clear for future sufferers. BTW, in my case, `/usr/local/Cellar/llvm/6.0.0/bin/clang++ -I/usr/local/Cellar/llvm/6.0.0/include -L/usr/local/Cellar/llvm/6.0.0/lib` (note the extra 6.0.0 in all 3 paths) `-O2 -fopenmp -lm -lz` and `-o king *.cpp` did the trick. – Carmen Sandoval May 10 '18 at 17:19
1

For anyone like me looking for an answer years later, I managed to solve this problem by installing gcc with Homebrew.

brew install gcc 

which includes libgfortran. Probably unnecessary, since I had dyld installed in Anaconda, but I found it was the easiest way to get King working on my mac.

Edit: I also had to set my DYLD_LIBRARY_PATH in my bash profile, as well, by going

nano ~/.bash_profile

and adding

export DYLD_LIBRARY_PATH=/opt/local/lib/libgcc/

or wherever the dynamic library libgcc_s.1.dylib is when you search for it on your computer.

lmrta
  • 305
  • 1
  • 2
  • 13