helix-editor / helix

A post-modern modal text editor.
https://helix-editor.com
Mozilla Public License 2.0
33.81k stars 2.51k forks source link

Can't pass LDFLAGS or CFLAGS to runtime bindings #12079

Open theoparis opened 3 hours ago

theoparis commented 3 hours ago

I have a custom xcode toolchain on my macOS machine, and It requires linking directly against libcxxabi.a and libcxx.a for some reason (otherwise it tries to use the dynamically linked version which needs patching with install_name_tool due to it using rpaths). I tried RUSTFLAGS="-Clink-arg=-fuse-ld=lld -Clink-arg=/Library/Developer/Toolchains/LLVM20.0.0git.xctoolchain/usr/lib/libc++.a -Clink-arg=/Library/Developer/Toolchains/LLVM20.0.0git.xctoolchain/usr/lib/libc++abi.a" LDFLAGS="-fuse-ld=lld /Library/Developer/Toolchains/LLVM20.0.0git.xctoolchain/usr/lib/libc++.a /Library/Developer/Toolchains/LLVM20.0.0git.xctoolchain/usr/lib/libc++.a /Library/Developer/Toolchains/LLVM20.0.0git.xctoolchain/usr/lib/libc++abi.a cargo install --path helix-term And it seems like the LDFLAGS variable doesn't get passed to each runtime binding's build.rs:

 dyld[86159]: Symbol not found: ___cxa_demangle
    Referenced from: <FDE9B676-8FF7-3D2F-B75C-B230CB71A4E6> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
    Expected in:     <4C4C442A-5555-3144-A184-217C9A91A590> /Users/theo/Documents/llvm-project/install/Toolchains/LLVM20.0.0git.xctoolchain/usr/lib/libc++.1.0.dylib
  clang++: error: unable to execute command: Abort trap: 6
  clang++: error: linker command failed due to signal (use -v to see invocation)

  --- stderr
  thread 'main' panicked at helix-term/build.rs:7:14:
  Failed to compile tree-sitter grammars: 207 grammars failed to build

It's supposed to use ld.lld instead of ld, which is how I know it isn't working.

theoparis commented 3 hours ago

I managed to fix it by removing the shared libraries from my toolchain for now.