redumper icon indicating copy to clipboard operation
redumper copied to clipboard

Darwin binary is dynamically linked against a missing libc++?

Open mistydemeo opened this issue 1 year ago • 4 comments

The Darwin binaries provided are dynamically linked against /usr/local/opt/llvm/lib/c++/libc++.1.dylib. Since that's not included with the binary, by default it's bringing in the system libc++ instead of the Homebrew LLVM one it was built with. So far that hasn't caused any problems, but I thought I'd flag it just in case it might. I know this can't be built with the Xcode/CLT-provided clang, but I wasn't sure about the libc++ requirement.

mistydemeo avatar Jan 06 '24 03:01 mistydemeo

Yes this is correct, I have to link it with the latest libc++, otherwise I'm getting unresolved symbols for std::format and something else if I remember correctly. I know it works with system bundled one (when compiled) but I cannot explain how. Would love to improve that if you have any ideas. For example, on Linux I am building fully static executable with no dependencies at all, it looks weird when you ld that but works everywhere it seems, but unfortunately can't do the same thing on Mac.

superg avatar Jan 06 '24 13:01 superg

The current release now fails to run because it tries and fails to load that libc++; may be the time to look into options? One solution would be to distribute the LLVM libc++ libraries with it, and rewrite the install names in redumper using install_name_tool to point at the local copies.

dyld[17569]: Library not loaded: /opt/homebrew/opt/llvm/lib/c++/libc++.1.dylib
  Referenced from: <79BA934E-58E5-387B-8EE1-CD619EC3840F> /opt/homebrew/Cellar/redumper/385/bin/redumper
  Reason: tried: '/opt/homebrew/opt/llvm/lib/c++/libc++.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/llvm/lib/c++/libc++.1.dylib' (no such file), '/opt/homebrew/opt/llvm/lib/c++/libc++.1.dylib' (no such file)

mistydemeo avatar Jul 04 '24 00:07 mistydemeo

macOS usage is close to 0%, nobody seems to care. Honestly it looks like a waste of time. I might work on this later but super low priority.

superg avatar Jul 04 '24 03:07 superg

That's understandable, yeah. I do really appreciate the macOS binaries - I use them myself. If I can help with this, I'd be happy to.

mistydemeo avatar Jul 04 '24 16:07 mistydemeo