Viladoman / CompileScore

Tools for profiling and visualizing C++ build times.
MIT License
460 stars 19 forks source link

Explicitly build on Ubuntu 20.04 #54

Closed jorgenpt closed 5 months ago

jorgenpt commented 5 months ago

ubuntu-latest maps to 22.04, which uses a more modern libstdc++ (and libc), which is too new for the binary to run on Ubuntu 20.04 (which is still under LTS).

This fixes the following error:

./ScoreDataExtractor: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.31' not found (required by ./ScoreDataExtractor)
Viladoman commented 5 months ago

I don't understand the fix. If the issue is that ubuntu-latest maps to 22.04, how is the change to ubuntu-22.04 making any difference. On top of that, I think we should rather fix the action/code to work with the latest changes instead of getting stuck to a fixed version.

Maybe I am misunderstanding something. What are your thoughts?

jorgenpt commented 5 months ago

@Viladoman I am specifying 20.04, not 22.04 -- so we're building on the previous (still-supported) LTS of Ubuntu, rather than the most recent LTS. The problem here is that when you're building against libstdc++ and libc on Linux systems, the resulting binary will depend on the installed version of those. So systems with an older version will not be able to load the executable. That means that your released executable isn't compatible with Ubuntu 20.04 LTS, which is officially supported by Canonical for another year and quite widespread.

It's not trivial to explicitly depend on an older version of these, since these are system-wide packages. As far as I know, the easiest way to accomplish this is building on an older distribution, for example via a docker container or a chroot.

Creating redistributable binaries for Linux can be a bit of a pain. :(

There are projects like e.g. https://github.com/phusion/holy-build-box that provide a Docker container specifically intended for letting you build in an isolated environment with older dependencies. GitHub actions allows you to run your build inside a docker container when needed.

Viladoman commented 5 months ago

Thanks for the explanation! I totally missed the 20.04. That makes sense. Then I guess moving forward it would make sense to have multiple ubuntu verisons generated, at least when transitions like this are happening.

Trass3r commented 5 months ago

Yeah it's painful. You can use a matrix with different OSes, just need to name the artifacts differently or they silently overwrite each other.

https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs