superg / redumper

Low level CD dumper utility
GNU General Public License v3.0
216 stars 19 forks source link

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

Open mistydemeo opened 9 months ago

mistydemeo commented 9 months ago

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.

superg commented 9 months ago

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.

mistydemeo commented 3 months ago

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)
superg commented 3 months ago

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.

mistydemeo commented 3 months ago

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.