Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clang built against too recent libstdc++ version #21

Open
lenary opened this issue Jun 17, 2020 · 4 comments
Open

Clang built against too recent libstdc++ version #21

lenary opened this issue Jun 17, 2020 · 4 comments

Comments

@lenary
Copy link
Contributor

lenary commented Jun 17, 2020

As reported by @imphil: lowRISC/opentitan#2524 (comment)

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.

@lenary lenary self-assigned this Jun 17, 2020
@imphil
Copy link
Contributor

imphil commented Jun 17, 2020

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.

@lenary
Copy link
Contributor Author

lenary commented Jun 17, 2020

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.

@lenary lenary changed the title Clang built against too recent glibc version Clang built against too recent libstdc++ version Jun 17, 2020
@lenary
Copy link
Contributor Author

lenary commented Jun 17, 2020

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.

@lenary
Copy link
Contributor Author

lenary commented Jun 18, 2020

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

@lenary lenary removed their assignment Jan 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants