Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
theoparis opened this issue Nov 17, 2024 · 1 comment
Open

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

theoparis opened this issue Nov 17, 2024 · 1 comment

Comments

@theoparis
Copy link

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant