lowrisc-toolchains
lowrisc-toolchains copied to clipboard
Clang built against too recent libstdc++ version
As reported by @imphil: https://github.com/lowRISC/opentitan/pull/2524#issuecomment-645360269
Clang ends up requiring a more recent version of glibc++ than ubuntu-16.04 has by default.
root@b012f757fb24:/azp# /tools/riscv/bin/riscv32-unknown-elf-clang --version
/tools/riscv/bin/riscv32-unknown-elf-clang: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.22' not found (required by /tools/riscv/bin/riscv32-unknown-elf-clang)
/tools/riscv/bin/riscv32-unknown-elf-clang: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /tools/riscv/bin/riscv32-unknown-elf-clang)
This is very weird because we build on the azure ubuntu-16.04 image.
The MSFT-provided Azure images are not pure Ubuntu 16.04, but have additional repositories and software installed.
I have no idea if that's the problem here, but could be an interesting area to look at.
I think this is the list of software: https://github.com/actions/virtual-environments/releases/tag/ubuntu16%2F20200604.1
it is presumably because of too-recent versions of GCC that we're having this issue.
Concurrently, there's been some discussion of doing something like https://github.com/phusion/holy-build-box to get support for older linuxes in this binary build. I'm not sure how easy this will be to do.
LLVM CMake has the option LLVM_STATIC_LINK_CXX_STDLIB
which will pass -static-libstdc++
when linking. I think this may help, based on https://stackoverflow.com/questions/13636513/linking-libstdc-statically-any-gotchas specifically:
The only C++ ABI changes introduced since GCC 3.4 have been backward-compatible, meaning the C++ ABI has been stable for nearly nine years.
Alternatively there is also LLVM_STATIC
which can cause us to entirely link LLVM statically (which might be a good idea here).
Edit: Crosstool already does the same with GCC, though I'll make sure our config requires that rather than just selecting the default.
I think we might have addressed this for the moment, but I'd like to keep this issue open to track any possible work towards using something like https://github.com/phusion/holy-build-box to build our toolchains. At first glance it seems possible.
Edit: Here are instructions for using a container in pipelines