My builds often fail during the linking stage. I found the issue was due using 'rustup' for my host rust toolchain. rustup statically bundles its own LLVM backend, which lags behind the native Arch Linux system LLVM backend. Cross-Language LTO requires exact major versions so the build fails late in the process.
Changes:
- Check clang and rust LLVM versions are the same
- On mismatch
- Prompt user to exit or disable LTO
- Give user hint for mismatch (rustup)
- Give user workaround options
- On mismatch
- Minor linting
I've tested this locally on a x86_64 platform and the check/build succeeds. I haven't tested on aarch64.
I haven't done much PKGBUILD development so I'm not sure if a user prompt is a good idea. If not, I can just make it an early exit to avoid waiting for a build to fail at the linking stage.