Can't open In M3 mac
❯ c3c dyld[53358]: Library not loaded: /opt/homebrew/opt/llvm@17/lib/libunwind.1.dylib Referenced from: <2D50C22A-0492-3DC4-9738-F08EE7CF712B> /Users/hootie/Documents/c3c/c3c Reason: tried: '/opt/homebrew/opt/llvm@17/lib/libunwind.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/llvm@17/lib/libunwind.1.dylib' (no such file), '/opt/homebrew/opt/llvm@17/lib/libunwind.1.dylib' (no such file) [1] 53358 abort c3c
Sadly a known issue Homebrew producing non-standalone static libraries. One can really ask oneself what the point is of static libraries when the libraries retain dependencies on dynamic libraries.
For now, using Homebrew to get c3c, grab LLVM from homebrew just to get the dependencies or building it yourself are the available solutions. I am very sorry about this.
What we need is a CI similar to https://github.com/c3lang/win-llvm but for MacOS which creates builds for Aarch64 and x64. Then we could use those to build C3 instead.
yeah im experiencing this on M3 too.. missing a lot dylib
I has this problem too.
The temporary fix is make a symlink '/opt/homebrew/opt/llvm@17/lib/libunwind.1.dylib' refer to the original 'libunwind.1.dylib' in unwind folder (I have libunwind.1.dylib but inside unwind folder in lib)
Why not bundle a version of libunwind? It's not a huge library...
This is what building a custom version of LLVM could do.
Temp Fix
c3c it's looking for libunwind from LLVM 17 and some Homebrew stuff.
➜ otool -L c3c | grep libunwind
/opt/homebrew/opt/llvm@17/lib/libunwind.1.dylib (compatibility version 1.0.0, current version 1.0.0)
a quick fix is run:
brew install llvm@17
I got the compiler working on LLVM 19.1.6 by just grab the codebase and build it on my machine. Building from source prevents a lot of annoying dylib problems.
(I did encountered some problem while building though, that's because now llvm and lld become two different packages in homebrew so I adjusted some settings to make it find the lld libraries)
Temp Fix
c3c it's looking for libunwind from LLVM 17 and some Homebrew stuff.
➜ otool -L c3c | grep libunwind /opt/homebrew/opt/llvm@17/lib/libunwind.1.dylib (compatibility version 1.0.0, current version 1.0.0)
a quick fix is run:
brew install llvm@17
brew install llvm@17 also just worked for me.
This is in progress but will probably not be fixed quite yet.
I had newer versions of llvm and lld installed (Looks like they were split since 19) but was able to clone and build c3c from source with cmake -DCMAKE_PREFIX_PATH="$(brew --prefix llvm)" -DC3_LLD_DIR="$(brew --prefix lld)/lib" ..
I had newer versions of llvm and lld installed (Looks like they were split since 19) but was able to clone and build c3c from source with
cmake -DCMAKE_PREFIX_PATH="$(brew --prefix llvm)" -DC3_LLD_DIR="$(brew --prefix lld)/lib" ..
Only -DC3_LLD_DIR="$(brew --prefix lld)/lib" is enough if llvm is properly installed by homebrew