1

I’m working on a legacy C++ codebase that ships with its own Clang 16 inside a thirdparty/llvm-build-16 folder. On our new Ubuntu 22.04 build system, this bundled compiler fails to run because it depends on libtinfo5, which isn’t available on 22.04 (only libtinfo6 is). Installing libtinfo5 isn’t an option.

The solution I’ve been trying is to rebuild LLVM/Clang 16 from source on Ubuntu 22.04 so that it links against libtinfo6.

My main concern:
I want this newly built Clang to behave exactly the same as the old bundled clang16 (same options, same default behavior, no surprises for the build system), just with the updated libtinfo6.

Questions:

  1. Is there a recommended way to extract or reproduce the exact CMake flags used to build the old clang binary?
  2. Are there any pitfalls when rebuilding Clang 16 on Ubuntu 22.04 (e.g. libstdc++ or glibc differences) that could cause it to behave slightly differently from the older build?
  3. And other option, can I statically link libtinfo6 to clang16 current compiler and remove libtinfo5? How to do it?

Has anyone done this before for legacy projects? Any tips on making sure my rebuilt compiler is a true drop-in replacement?

What other options can I try?

8
  • 1
    "Installing libtinfo5 isn’t an option." Why is that? It can be done in a minute and it does not affect any program that is already able to run. Commented Sep 16 at 8:13
  • @n.m.couldbeanAI client won't install libtinfo5 on their build machine due to some reasons. So, I have to look for other options. I already gave them this option but it's denied Commented Sep 16 at 8:33
  • So you have a client that wants to run a legacy compiler on their build system, but doesn't want to install support libraries required for it to run because of reasons. Do I understand the situation correctly? Commented Sep 16 at 8:54
  • Dwngrade the OS Commented Sep 16 at 11:14
  • Asking multiple questions at once makes it difficult to answer any of them. Pick one question to focus on. Then adjust the tags accordingly; you don't need to have 5. Commented Sep 16 at 12:42

1 Answer 1

0

can I statically link libtinfo6 to clang16 current compiler and remove libtinfo5? How to do it?

patchelf --replace-needed libtinfo.so.5 libtinfo.so.6 /path/to/binary

This sometimes work. It may or may not work for you, depending on how exactly your program uses libtinfo (the program may work as expected, behave erratically, or crash).

The proper way to fix the problem is to install libtinfo5, but he who pays the piper calls the tune.

Another option is to beg, buy, or build libtinfo5 from sources, rename the library from libtinfo.so.5 to libmy_special_tinfo5.so and patch the binary as above to refer to that instead of libtinfo.so.5. The result should be exactly the same as just dropping libtinfo.so.5 on the system as-is, but perhaps somehow it is more acceptable since libtinfo5 is no longer installed on the system (whatever that means).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.