Skip to content

Revert "bumped minimum CMake version to 3.21.0" - #2554

Merged
CarterLi merged 1 commit into
devfrom
revert-2517-patch-1
Sep 1, 2026
Merged

Revert "bumped minimum CMake version to 3.21.0"#2554
CarterLi merged 1 commit into
devfrom
revert-2517-patch-1

Conversation

@CarterLi

@CarterLi CarterLi commented Sep 1, 2026

Copy link
Copy Markdown
Member

Reverts #2517

Causes #2553, for some reason

@CarterLi

CarterLi commented Sep 1, 2026

Copy link
Copy Markdown
Member Author

I don't know why bumping minimal CMake version changes the behavior of cpack, but it does.

@CarterLi
CarterLi merged commit 37c198d into dev Sep 1, 2026
43 of 47 checks passed
@Guiorgy

Guiorgy commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Huh? 😅

It's still the case that build fails with older CMake ¯\_(ツ)_/¯

> docker run --rm -it -v /tmp/cmake:/tmp/cmake -w /tmp/cmake debian:bullseye bash
# apt update && apt install -y git build-essential pkg-config python3 cmake
# git clone --branch dev --depth 1 https://github.com/fastfetch-cli/fastfetch.git && cd fastfetch
# mkdir build && cd build
# cmake --version
cmake version 3.18.4

CMake suite maintained and supported by Kitware (kitware.com/cmake).
# cmake .. 
-- Build for system processor: amd64
-- Build type: RelWithDebInfo
-- Threads type: pthread
-- Enabling LTO
-- Target dirs: ROOT="" USR="/usr" HOME="/home" ETC="/etc"
fatal: No names found, cannot describe anything.
-- Found Python: /usr/bin/python3.9 (found version "3.9.2") found components: Interpreter
-- Minifying 'help.json'
-- Generating 'fastfetch.1'
-- Performing Test COMPILER_SUPPORTS_COUNT_OF
CMake Error at /tmp/cmake/fastfetch/build/CMakeFiles/CMakeTmp/CMakeLists.txt:15 (add_executable):
  C_STANDARD is set to invalid value '23'


CMake Error at /usr/share/cmake-3.18/Modules/CheckCSourceCompiles.cmake:109 (try_compile):
  Failed to generate test project build system.
Call Stack (most recent call first):
  CMakeLists.txt:1436 (check_c_source_compiles)


-- Configuring incomplete, errors occurred!
See also "/tmp/cmake/fastfetch/build/CMakeFiles/CMakeOutput.log".
See also "/tmp/cmake/fastfetch/build/CMakeFiles/CMakeError.log".

Note C_STANDARD is set to invalid value '23' :P

Edit: I tried reproducing this in a Trixie Docker container and it built and packed just fine with minimum set to 3.21?

> docker run --rm -it -v /tmp/cmake:/tmp/cmake -w /tmp/cmake debian:trixie bash
# apt update && apt install -y git build-essential pkg-config python3 cmake nano file
# git clone --branch dev --depth 1 https://github.com/fastfetch-cli/fastfetch.git && cd fastfetch
# mkdir build && cd build
# cmake --version
cmake version 3.31.6

CMake suite maintained and supported by Kitware (kitware.com/cmake).
# gcc --version
gcc (Debian 14.2.0-19) 14.2.0
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# nano ../CMakeLists.txt
# cat ../CMakeLists.txt | head -1
cmake_minimum_required(VERSION 3.21.0)
# cmake ..
# cpack --verbose -G DEB
# file fastfetch
fastfetch: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=f062535971b95eb5649a25b39c7fd0e1b7116075, for GNU/Linux 3.2.0, with debug_info, not stripped
# dpkg -i fastfetch-linux-amd64.deb
Selecting previously unselected package fastfetch.
(Reading database ... 23689 files and directories currently installed.)
Preparing to unpack fastfetch-linux-amd64.deb ...
Unpacking fastfetch (2.68.1) ...
Setting up fastfetch (2.68.1) ...

So something else seems to be the issue? Maybe an issue with CI/CD?

Edit2: Also @CarterLi looking at build-linux-hosts.yml it installs gcc 13 (sudo apt-get install -y gcc-13), and yet as far as I can tell C23 (-std=c23) was only added in GCC 14 and as experimental at that:

A further version of the C standard, known as C2X, is under development; experimental and incomplete support for this is enabled with -std=c2x.

A further version of the C standard, known as C23, is under development and expected to be published in 2024 as ISO/IEC 9899:2024. (While in development, drafts of this standard version were referred to as C2X.) Experimental and incomplete support for this is enabled with -std=c23 or -std=iso9899:2024.

The package source (ppa:ubuntu-toolchain-r/test) used has GCC 15 which has full support of C23 and uses it as the default:

The default, if no C language dialect options are given, is -std=gnu23.

So maybe we should use that to build fastfetch instead?

Edit3: Tried using GCC 13 in Trixie and still no issues:

> docker run --rm -it -v /tmp/cmake:/tmp/cmake -w /tmp/cmake debian:trixie bash
# apt update && apt install -y git build-essential gcc-13 pkg-config python3 cmake nano file
# git clone --branch dev --depth 1 https://github.com/fastfetch-cli/fastfetch.git && cd fastfetch
# mkdir build && cd build
# cmake --version
cmake version 3.31.6

CMake suite maintained and supported by Kitware (kitware.com/cmake).
# update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 100
# gcc --version
gcc (Debian 13.3.0-16) 13.3.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# nano ../CMakeLists.txt
# cat ../CMakeLists.txt | head -1
cmake_minimum_required(VERSION 3.21.0)
# cmake ..
# cpack --verbose -G DEB
# file fastfetch
fastfetch: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=863c528ed717cce4e351541066a4cdedf744dc08, for GNU/Linux 3.2.0, with debug_info, not stripped
# dpkg -i fastfetch-linux-amd64.deb
(Reading database ... 23987 files and directories currently installed.)
Preparing to unpack fastfetch-linux-amd64.deb ...
Unpacking fastfetch (2.68.1) over (2.68.1) ...
Setting up fastfetch (2.68.1) ...

Also tried GCC 13 and Ninja generator, but still a 64 bit binary was generated...

@CarterLi

CarterLi commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

The problem was that the linux-i686 workflow generated a package named amd64

You should use the instructions from https://github.com/fastfetch-cli/fastfetch/blob/dev/.github%2Fworkflows%2Fbuild-linux-i686.yml

@Guiorgy

Guiorgy commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

The problem was that the linux-i686 workflow generated a package named amd64

You should use the instructions from https://github.com/fastfetch-cli/fastfetch/blob/dev/.github%2Fworkflows%2Fbuild-linux-i686.yml

Yep, confirmed building using gcc-multilib and min raised did result in a fastfetch-linux-amd64.deb. After some digging here's what I found:

The workflow sets -DCMAKE_SYSTEM_PROCESSOR_OVERRIDE=i686, yet on line 2250 of CmakeLists.txt the CMAKE_SYSTEM_PROCESSOR variable is used in the output name. If I set min version to 3.21.0 and use CMAKE_SYSTEM_PROCESSOR_OVERRIDE on line 2250 and build and pack fastfetch I do get:

# file fastfetch
fastfetch: ELF 32-bit LSB pie executable, Intel i386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, BuildID[sha1]=da48b4a3210f67f34479810f18254cbcca803253, for GNU/Linux 3.2.0, with debug_info, not stripped
# ls fastfetch-linux-*
fastfetch-linux-i686.deb

From 3.21 docs:

When cross-compiling, a CMAKE_TOOLCHAIN_FILE should set the CMAKE_SYSTEM_PROCESSOR variable to match target architecture that it specifies

I can't seem to find any mention of CMAKE_SYSTEM_PROCESSOR_OVERRIDE? Nevermind, I see it's used in CMakeLists.txt

Edit: I modified CMakeLists.txt to print the values before and after overriding CMAKE_SYSTEM_PROCESSOR:

CMake Warning at CMakeLists.txt:13 (message):
  --------- before: CMAKE_SYSTEM_PROCESSOR is x86_64
  CMAKE_SYSTEM_PROCESSOR_OVERRIDE is i686


CMake Warning at CMakeLists.txt:15 (message):
  --------- after: CMAKE_SYSTEM_PROCESSOR is x86_64
  CMAKE_SYSTEM_PROCESSOR_OVERRIDE is i686

Looks like it was made into a read-only or something in newer versions :/

@CarterLi

CarterLi commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

Make a PR tofix that?

@Guiorgy

Guiorgy commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Make a PR tofix that?

That was just a workaround that kinda worked. The actual issue is that, from what I can tell, newer CMake are much stricter, the CMAKE_SYSTEM_PROCESSOR variable after calling project(...) is forced and set to read-only. Setting it through -DCMAKE_SYSTEM_PROCESSOR=... also didn't work. What one must now do when cross compiling is to use toolchain files and pass it using -DCMAKE_TOOLCHAIN_FILE=..., for example:

# cat ../i386-toolchain.cmake
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR i386)
set(CMAKE_C_FLAGS "-m32 -march=i686 -mtune=i686")
# CMAKE_PREFIX_PATH=/home/linuxbrew/.linuxbrew PKG_CONFIG_PATH=/home/linuxbrew/.linuxbrew/lib/pkgconfig:$PKG_CONFIG_PATH cmake .. -DCMAKE_C_FLAGS="-m32 -march=i686 -mtune=i686" -DCMAKE_SYSTEM_N
AME=Linux -DCPACK_DEBIAN_PACKAGE_ARCHITECTURE=i386 -DCMAKE_TOOLCHAIN_FILE=../i386-toolchain.cmake -DCMAKE_SYSTEM_PROCESSOR_OVERRIDE=whatever
CMake Warning at CMakeLists.txt:4 (message):
  --------- before: CMAKE_SYSTEM_PROCESSOR is CMAKE_SYSTEM_PROCESSOR_OVERRIDE
  is whatever


CMake Warning at CMakeLists.txt:6 (message):
  --------- after: CMAKE_SYSTEM_PROCESSOR is whatever
  CMAKE_SYSTEM_PROCESSOR_OVERRIDE is whatever


-- Build for system processor: whatever
-- The C compiler identification is GNU 14.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
CMake Warning at CMakeLists.txt:26 (message):
  --------- before: CMAKE_SYSTEM_PROCESSOR is i386
  CMAKE_SYSTEM_PROCESSOR_OVERRIDE is whatever


CMake Warning at CMakeLists.txt:28 (message):
  --------- after: CMAKE_SYSTEM_PROCESSOR is i386
  CMAKE_SYSTEM_PROCESSOR_OVERRIDE is whatever


-- Build for system processor: i386

I tried setting it both before project(...) and after, hence the double print. With the toolchain file I finally configured CMake to build for the target architecture and generated the correct package file:

# file fastfetch && ls fastfetch-linux-*
fastfetch: ELF 32-bit LSB pie executable, Intel i386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, BuildID[sha1]=5059d181a0ab9b9adf3a011299f2ab436e5c250d, for GNU/Linux 3.2.0, with debug_info, not stripped
fastfetch-linux-i386.deb

However, I am by no means an expert, toolchain files are new to me, I am still trying to look deeper.

Edit: Supposed we use toolchain files, do we create them inside git worktree and persist them, or generate them on the fly inside workflows?

Edit2:

# CMAKE_PREFIX_PATH=/home/linuxbrew/.linuxbrew PKG_CONFIG_PATH=/home/linuxbrew/.linuxbrew/lib/pkgconfig:$PKG_CONFIG_PATH cmake .. -DCMAKE_C_FLAGS="-m32 -march=i686 -mtune=i686" -DCMAKE_SYSTEM_N
AME=Linux -DCPACK_DEBIAN_PACKAGE_ARCHITECTURE=i386 -DCMAKE_SYSTEM_PROCESSOR_OVERRIDE=whatever
CMake Warning at CMakeLists.txt:4 (message):
  --------- before: CMAKE_SYSTEM_PROCESSOR is whatever
  CMAKE_SYSTEM_PROCESSOR_OVERRIDE is whatever


CMake Warning at CMakeLists.txt:6 (message):
  --------- after: CMAKE_SYSTEM_PROCESSOR is whatever
  CMAKE_SYSTEM_PROCESSOR_OVERRIDE is whatever


-- Build for system processor: whatever
CMake Warning at CMakeLists.txt:26 (message):
  --------- before: CMAKE_SYSTEM_PROCESSOR is whatever
  CMAKE_SYSTEM_PROCESSOR_OVERRIDE is whatever


CMake Warning at CMakeLists.txt:28 (message):
  --------- after: CMAKE_SYSTEM_PROCESSOR is whatever
  CMAKE_SYSTEM_PROCESSOR_OVERRIDE is whatever


-- Build for system processor: whatever

I am lost... Why does it work again?! XD

@Guiorgy

Guiorgy commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

CMake is such a mess... According to this issue the CMAKE_SYSTEM_PROCESSOR variable is fundamentally broken on Windows :P, and according to this issue CMAKE_<LANG>_COMPILER_ARCHITECTURE_ID is the preferred way to detect target architectures starting from 4.1 -_-.

Anyway, while trying different things I tried setting -DCMAKE_SYSTEM_NAME=Linux alongside -DCMAKE_SYSTEM_PROCESSOR_OVERRIDE=i686 and maybe that worked:

# rm -rf build2/* && CMAKE_PREFIX_PATH=/home/linuxbrew/.linuxbrew PKG_CONFIG_PATH=/home/linuxbrew/.linuxbrew/lib/pkgconfig:$PKG_CONFIG_PATH cmake -S . -B build2 -DCMAKE_C_FLAGS="-m32 -march=i686 -mtu
ne=i686" -DCPACK_DEBIAN_PACKAGE_ARCHITECTURE=i386 -DCMAKE_SYSTEM_PROCESSOR_OVERRIDE=i686 && (cd build2 && cpack --debug -G DEB)
CMake Warning at CMakeLists.txt:4 (message):
  --------- before: CMAKE_SYSTEM_PROCESSOR is CMAKE_SYSTEM_PROCESSOR_OVERRIDE
  is i686


CMake Warning at CMakeLists.txt:6 (message):
  --------- after: CMAKE_SYSTEM_PROCESSOR is i686
  CMAKE_SYSTEM_PROCESSOR_OVERRIDE is i686


-- Build for system processor: i686
-- The C compiler identification is GNU 14.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
CMake Warning at CMakeLists.txt:26 (message):
  --------- before: CMAKE_SYSTEM_PROCESSOR is x86_64
  CMAKE_SYSTEM_PROCESSOR_OVERRIDE is i686


CMake Warning at CMakeLists.txt:28 (message):
  --------- after: CMAKE_SYSTEM_PROCESSOR is x86_64
  CMAKE_SYSTEM_PROCESSOR_OVERRIDE is i686


-- Build for system processor: amd64
...
# rm -rf build2/* && CMAKE_PREFIX_PATH=/home/linuxbrew/.linuxbrew PKG_CONFIG_PATH=/home/linuxbrew/.linuxbrew/lib/pkgconfig:$PKG_CONFIG_PATH cmake -S . -B build2 -DCMAKE_C_FLAGS="-m32 -march=i686 -mtu
ne=i686" -DCPACK_DEBIAN_PACKAGE_ARCHITECTURE=i386 -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR_OVERRIDE=i686 && (cd build2 && cpack --debug -G DEB)
CMake Warning at CMakeLists.txt:4 (message):
  --------- before: CMAKE_SYSTEM_PROCESSOR is CMAKE_SYSTEM_PROCESSOR_OVERRIDE
  is i686


CMake Warning at CMakeLists.txt:6 (message):
  --------- after: CMAKE_SYSTEM_PROCESSOR is i686
  CMAKE_SYSTEM_PROCESSOR_OVERRIDE is i686


-- Build for system processor: i686
-- The C compiler identification is GNU 14.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
CMake Warning at CMakeLists.txt:26 (message):
  --------- before: CMAKE_SYSTEM_PROCESSOR is i686
  CMAKE_SYSTEM_PROCESSOR_OVERRIDE is i686


CMake Warning at CMakeLists.txt:28 (message):
  --------- after: CMAKE_SYSTEM_PROCESSOR is i686
  CMAKE_SYSTEM_PROCESSOR_OVERRIDE is i686


-- Build for system processor: i686

So can this be it? Could you also try setting min version to 3.21 and adding -DCMAKE_SYSTEM_NAME=Linux? If not, I'll try this in a fresh container tomorrow, gtg now.

@Guiorgy

Guiorgy commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Created a new PR #2565

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

Successfully merging this pull request may close these issues.

2 participants