Open jayv opened 5 months ago
As I dig more into this, it seems like a non-standard Apple only linker flag?
I can't find any evidence of other linkers supporting this... impemented only for lld
with mach-o
target.
https://bugs.llvm.org/show_bug.cgi?id=50229
If that's the case the condition should not just check isClangBuild()
but rather check if the Darwin ld64
linker is being invoked or lld with mach-o target.
This is the relevant change "fix debugging on Mac OS" that introduced the new flag, and probably broke non-Apple users:
https://github.com/bazelbuild/intellij/pull/4003
/cc @tpasternak
I think it's rather triggered by the fact you are using mold instead of lld. We are planning to reorganize some things in this area and we will take this issue into account.
Hmm, did you try? I tried mold, gold, and gnu ld, nothing worked, and then I found the PR/commit on llvm https://github.com/llvm/llvm-project/commit/236197e2d026193111580bd145f00367ba0c1afb AFAICT this flag was only added for “mach-o” (mac) binaries, meaning lld for linux (elf) binaries does not support this flag.
Thanks for clarification then
Whle trying to learn Bazel with a simple project setup with Bazel/Clion I ran into this issue.
update:
oso_prefix
seems a non-standard Apple/Darwin-only linker flag https://github.com/bazelbuild/intellij/issues/6410#issuecomment-2080239502 introduced to fix debugging on MacOSA normal build/run of the main bazel target works fine, but the debug build fails to link because of the "path trimming" flags that get injected by default by the plugin. When I run the bazel command without the
-oso_prefix,.
part it links just fine, so when I enabledbazel.trim.absolute.path.disabled
in the registry, my project builds/runs/hits breakpoints per usual 🤷🏻♂️, ~so I'm not sure why this is done by default.~This is on Ubuntu Linux with
clang-17
andmold
(as linker) configured as a custom blaze toolchain to leverageC++23
andlibc++
. That saidld
, andgold
also struggle with this linker flag, suggesting-oso_prefix,.
is not correct or universally supported. https://github.com/bazelbuild/intellij/issues/6410#issuecomment-2080239502 ~Or is there perhaps something wrong with my bazel project setup?~https://github.com/bazelbuild/intellij/blob/86e31292434875ca1f86a02230cde5a3de5a70cf/clwb/src/com/google/idea/blaze/clwb/run/BlazeCidrRunConfigurationRunner.java#L120-L124
bazel command:
clang command: