dart-lang / dart-lang/native

[native_toolchain_c] Clang resolver trips over symlink to llvm executable

Open
#136 0 comments 0 reactions 0 assignees View on GitHub
package:native_toolchain_c
Dominant language
Dart
Stars
275
Forks
144
Avg merge
2d 7h
Merged PRs (30d)
55

Description

Apparently, newer `clang` versions all symlink to `llvm`, but then need to be invoked with `llvm clang`.

```
dacoharkes@dacoharkes-linux:~/dart-sdk/sdk/buildtools/linux-x64/clang/bin$ ls -lah clang
lrwxrwxrwx 1 dacoharkes primarygroup 4 Aug 23 15:10 clang -> llvm
dacoharkes@dacoharkes-linux:~/dart-sdk/sdk/buildtools/linux-x64/clang/bin$ ./llvm --version
OVERVIEW: llvm toolchain driver

USAGE: llvm [subcommand] [options]

SUBCOMMANDS:

size
readobj
readelf
rc
windres
profdata
objcopy
install-name-tool
bitcode-strip
strip
nm
mt
lipo
ifs
gsymutil
cxxfilt
ar
ranlib
lib
dlltool
lld
lld-link
ld.lld
ld64.lld
wasm-ld
clang-scan-deps
clang
clang++
clang-cl
clang-cpp

Type "llvm --help" to get more help on a specific subcommand

OPTIONS:

--help - Display this message

dacoharkes@dacoharkes-linux:~/dart-sdk/sdk/buildtools/linux-x64/clang/bin$ clang --version
Debian clang version 14.0.6
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

dacoharkes@dacoharkes-linux:~/dart-sdk/sdk/buildtools/linux-x64/clang/bin$ ls -lah ld.lld
lrwxrwxrwx 1 dacoharkes primarygroup 4 Aug 23 15:10 ld.lld -> llvm
```

Currently our logic fails, because it follows symlinks from `clang` to `llvm` and then fails to invoke `llvm` with a `clang` sub command.

In our tools abstraction, a tool instance refers to an executable, so having the linker/archiver/compiler all refer to the `llvm` executable is slightly weird, maybe we should have a new `llvm` tool/toolinstances to model this correctly.

The subcommand executables are still there, so as a stopgap we can probably stop following symlinks for LLVM for now.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.