facebook / buck2

Build system, successor to Buck
https://buck2.build/
Apache License 2.0
3.37k stars 199 forks source link

How can I check and/or override the path for the linker for rust/cxx? #568

Closed seryl closed 4 months ago

seryl commented 4 months ago

I'm trying to build a rust test binary and I'm running into the following:

  = note: clang-16: warning: argument unused during compilation: '-stdlib=libc++' [-Wunused-command-line-argument]
          ld: library not found for -lc++abi
          clang-16: error: linker command failed with exit code 1 (use -v to see invocation)

when I run ld -v (outside of the sandbox); the pathing looks correct:

> ld -v
@(#)PROGRAM:ld  PROJECT:ld64-609
BUILD 00:00:00 Jan  1 1980
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em (tvOS)
Library search paths:
    /nix/store/nn3dk08nih2y7gwrs9dcynmryp8j3psz-libcxx-16.0.6/lib
    /nix/store/sfwdnyqvz8wizrz88wd45nqalfxbalvr-libcxxabi-16.0.6/lib
    /nix/store/yf4gzga2ark7xqik44lwj6kg17lsiikd-compiler-rt-libc-16.0.6/lib
    /nix/store/lvlwkpy6zd4crhbvybw9ssrclm0144m3-libobjc-11.0.0/lib
    /nix/store/nn3dk08nih2y7gwrs9dcynmryp8j3psz-libcxx-16.0.6/lib
    /nix/store/sfwdnyqvz8wizrz88wd45nqalfxbalvr-libcxxabi-16.0.6/lib
    /nix/store/yf4gzga2ark7xqik44lwj6kg17lsiikd-compiler-rt-libc-16.0.6/lib
    /nix/store/lvlwkpy6zd4crhbvybw9ssrclm0144m3-libobjc-11.0.0/lib
    /nix/store/lvif9r2fzh2qrnmnc0np4hwk3za2fmq6-libSystem-11.0.0/lib
Framework search paths:
ld: no object files specified
zjturner commented 4 months ago

I would expect you need to define your own rust toolchain that isn’t the system one, so that you can customize it to your liking