Fix Clang 19 C++ headers and LLVM tool version mismatches on AL2023#3157
Fix Clang 19 C++ headers and LLVM tool version mismatches on AL2023#3157
Conversation
| # Ensure setup-clang-19.sh also prepends /opt/clang-19/bin to PATH so that | ||
| # matching versions of llvm-ar, llvm-ranlib, llvm-symbolizer, etc. are used | ||
| # instead of the system LLVM 15 versions. | ||
| echo 'export PATH=/opt/clang-19/bin:$PATH' >> /opt/compiler-env/setup-clang-19.sh |
There was a problem hiding this comment.
do we need to do this for other OS's or just AL?
https://github.com/search?q=repo%3Aaws%2Faws-lc%20setup-clang-19.sh&type=code
There was a problem hiding this comment.
Yes, this is specific to AL2023. It's the only image where we installed a pre-built Clang 19 alongside a system LLVM 15 from dnf. The two LLVM versions provide conflicting tools at different paths (/opt/clang-19/bin/llvm-ar vs /usr/bin/llvm-ar).
On Ubuntu 24.04, for example, Clang 14–19 are all installed via apt and the LLVM tools come in versioned variants (llvm-ar-14, llvm-ar-19, etc.) that don't conflict. The create-compiler-env.sh pattern of just setting CC/CXX works fine there.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3157 +/- ##
==========================================
- Coverage 77.96% 77.95% -0.02%
==========================================
Files 689 689
Lines 122535 122536 +1
Branches 17096 17070 -26
==========================================
- Hits 95537 95519 -18
- Misses 26100 26117 +17
- Partials 898 900 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Issues:
Follow-up to #3152
Description of changes:
The
setup-clang-19.shscript setsCCandCXXbut doesn't updatePATH, so CMake still picks up/usr/bin/llvm-arand/usr/bin/llvm-ranlibfrom the dnf-installed LLVM 15. These can't read object files produced by Clang 19 (Unknown attribute kind (86) — Producer: 'LLVM19.1.7' Reader: 'LLVM 15.0.7'). This appendsexport PATH=/opt/clang-19/bin:$PATHto the generated setup script so the matching LLVM 19 tools are found first.Testing:
Verified locally in the aarch64 Docker image that
which llvm-arresolves to/opt/clang-19/bin/llvm-arafter sourcing the updated script, and the ASAN build compiles and links successfully.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.