mold
mold copied to clipboard
Uncaught exception running mold on macos
I have installed mold on macos (Monterey 12.0.1) using homebrew:
uname -a
Darwin MacBook-Pro 21.1.0 Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:23 PDT 2021; root:xnu-8019.41.5~1/RELEASE_X86_64 x86_64
which mold
/usr/local/bin/mold
mold -v
mold 1.0.3 (compatible with GNU ld)
When I try to use it, it fails with a broken symlink error, and there seems to be a reference to a linux /proc folder.
mold -run cargo build
libc++abi: terminating with uncaught exception of type std::__1::__fs::filesystem::filesystem_error: filesystem error: in read_symlink: No such file or directory [/proc/self/exe]
zsh: abort mold -run cargo build
Fairly sure mold
does not support true Unix systems, only Linux. Sorry :(
(also macOS has departed quite a bit from pure Unix, especially in its directory structure)
Yes, per #189, mac support is currently nowhere near complete.
Maybe mold should print an unremovable "mold: mac support is currently in pre-alpha stage; pull requests are welcome, but please don't report bugs, they're most likely known already" warning before doing anything else.
Ok, thanks I didn't see anything either way about macos, and when I saw homebrew I assumed macos.
@Alcaro That's a good suggestion. Let me do that.
I confirm @andrewdavidmackenzie , I thought that there is support for macOS when I saw Homebrew in binary packages list here. Need to be removed from the list and/or show a detailed report of this problem.
For mold -run
intercepting exec
on ld
, ld.gold
and ld.lld
, macOS does not support LD_PRELOAD
and the alternative DYLD_INSERT_LIBRARIES
does not work with System Integrity Protection enabled:
> DYLD_INSERT_LIBRARIES=./mold-wrapper.so env | grep DYLD # empty
I guess we need an alternative way for mold -run
to work on macOS. Say creating symbolic link ld -> mold
under a directory and add it to PATH
. But that won't work when the absolute path of a linker is used.
This caught my eye this week:
https://www.reddit.com/r/rust/comments/wd8xuc/mold_on_macos_works_kinda_and_i_confirmed_with_a/?utm_medium=android_app&utm_source=share