btop icon indicating copy to clipboard operation
btop copied to clipboard

cmake: link CMAKE_DL_LIBS

Open alalazo opened this issue 1 year ago • 5 comments

Without the explicit command in the PR, I get a build failure when building from sources on Ubuntu 20.04 and adding GPU support.

The build was done with Spack, see https://github.com/spack/spack/pull/42139

If it is of any use, I attach a log of the failed build (before this change): spack-build-out.txt

alalazo avatar Jan 18 '24 11:01 alalazo

This is because glibc on Ubuntu 20.04 is too old. This is the same issue as here.

There are newer Ubuntu LTS's available with proper support for CMake, glibc and gcc. (20.04 doesn't have a new enough CMake anyway, and only gcc-10 while 11 or newer is recommended).

I'd like to keep this in line with the Makefile which doesn't support that either.

imwints avatar Jan 18 '24 14:01 imwints

There are newer Ubuntu LTS's available with proper support for CMake, glibc and gcc. (20.04 doesn't have a new enough CMake anyway, and only gcc-10 while 11 or newer is recommended).

I built the tool with a package manager that doesn't require root privileges. We can currently deal with cmake and compiler but we don't yet build our own glibc. So glibc remains our only issue for a pristine build.

Since I'll use that patch to build btop, I thought it would be good to upstream it. I think one point would be: would it make building with newer glibc worse? If not this seems an improvement :slightly_smiling_face:

alalazo avatar Jan 18 '24 16:01 alalazo

I'd like to keep this in line with the Makefile which doesn't support that either.

Does this mean that a similar change in the Makefile is welcome, or is it a policy to build only with the system provided toolchain on each OS?

alalazo avatar Jan 18 '24 16:01 alalazo

No, there is no such policy, but it's just unusual to run into a system with brand new compiler and outdated libc.

You don't even need to patch the build files. Just configure cmake with proper LDFLAGS like so LDFLAGS=-ldl cmake -B ... IMO this is not worth patching since it's so uncommon and LDFLAGS is even simpler.

imwints avatar Jan 20 '24 11:01 imwints