Sander W. van der Laan
Sander W. van der Laan

Reputation: 790

Installation of `brew install llvm` leads to "Segmentation fault: 11" on macOS

For some program LDSTORE I need to install llvm on my Mac (macOS 10.13). I do this using brew install llvm. This leads to a Segmentation fault: 11 message when running ldstore, or other (C++ based?) programs. How can I fix this?

It clearly has to do with llvm, as doing brew uninstall llvm fixes the issue (obvious ldstore won't work in that case). For what it's worth: I use the native python 2.7.10.

As per suggestion of Stanislav Pankevich I ran lldb ldstore_v11 followed by r, resulting in this:

lldb ldstore_v11
(lldb) target create "ldstore_v11"
Current executable set to 'ldstore_v11' (x86_64).
(lldb) r
Process 15841 launched: '/Users/swvanderlaan/bin/ldstore_v11' (x86_64)
dyld: Library not loaded: /usr/local/opt/libiomp/lib/libiomp5.dylib
  Referenced from: /Users/swvanderlaan/bin/ldstore_v11
  Reason: image not found
Process 15841 stopped
* thread #1, stop reason = signal SIGABRT
    frame #0: 0x0000000100095216 dyld`__abort_with_payload + 10
dyld`__abort_with_payload:
->  0x100095216 <+10>: jae    0x100095220               ; <+20>
    0x100095218 <+12>: movq   %rax, %rdi
    0x10009521b <+15>: jmp    0x100094a74               ; cerror_nocancel
    0x100095220 <+20>: retq
Target 0: (ldstore_v11) stopped.

It's odd that the library is not found, as I clearly added to my bash_profile the following line: export PATH="/usr/local/opt/llvm/bin:$PATH", as per suggestion of the installation messages.

Hope someone can help me debug this.

Thanks,

Sander P.S. I hope it's clear, I'm not trying to develop anything, I'm just trying to use LDSTORE.

Upvotes: 3

Views: 1050

Answers (1)

Jonas
Jonas

Reputation: 1031

The problem is that this tool is dynamically linked against libiomp5.dylib, which must be present at /usr/local/opt/libiomp/lib/libiomp5.dylib for it to work.

As suggested by Stanislav, download the precompiled binaries from http://releases.llvm.org/5.0.0/clang+llvm-5.0.0-x86_64-apple-darwin.tar.xz. This contains the library you need: ./lib/libiomp5.dylib. You'll have to copy the library into /usr/local/opt/libiomp/lib, which probably won't exist yet.

Once you've done that, you'll be able to run ldstore.

Upvotes: 1

Related Questions