Skip to content

tools: cmake: update to 4.0.3 - #19558

Closed
PolynomialDivision wants to merge 3 commits into
openwrt:mainfrom
PolynomialDivision:tools-cmake-4-0-3
Closed

PolynomialDivision wants to merge 3 commits into
openwrt:mainfrom
PolynomialDivision:tools-cmake-4-0-3

Conversation

@PolynomialDivision

Copy link
Copy Markdown
Member

@neheb

neheb commented Jul 27, 2025

Copy link
Copy Markdown
Contributor
logs/tools/cmake/compile.txt-Applying /Volumes/OpenWrt/openwrt/tools/cmake/patches/120-curl-fix-libressl-linking.patch using plaintext: 
logs/tools/cmake/compile.txt-patching file Utilities/cmcurl/CMakeLists.txt
logs/tools/cmake/compile.txt-Hunk #1 FAILED at 775.

@neheb

neheb commented Jul 27, 2025

Copy link
Copy Markdown
Contributor

That patch can go. clock_gettime has been a part of glibc since 2.17, which is ancient at this point.

Tested with the oldest OS that can build OpenWrt: Ubuntu 18.04.

@github-actions github-actions Bot added the build/scripts/tools pull request/issues for build, scripts and tools related changes label Jul 27, 2025
@PolynomialDivision

Copy link
Copy Markdown
Member Author

That patch can go. clock_gettime has been a part of glibc since 2.17, which is ancient at this point.

But why is the patch from 2017 if glibc has included clock_gettime() since version 2.17? Which libc was OpenWrt using at that time? Also, are we still linking LibreSSL statically?

@neheb

neheb commented Jul 27, 2025

Copy link
Copy Markdown
Contributor

Looking at it again, the patch was a hack to deal with libssl.pc not containing -lpthread which was needed for much longer. librt was more of a why not looks like.

-lpthread is getting applied somehow so the patch is no longer needed.

@PolynomialDivision
PolynomialDivision force-pushed the tools-cmake-4-0-3 branch 2 times, most recently from a0b8caf to 2a8d0ea Compare July 27, 2025 22:28
@PolynomialDivision

Copy link
Copy Markdown
Member Author

@neheb I put you as suggested-by

@PolynomialDivision
PolynomialDivision force-pushed the tools-cmake-4-0-3 branch 3 times, most recently from d54321f to 9f4e0da Compare July 29, 2025 21:28
@neheb

neheb commented Jul 31, 2025

Copy link
Copy Markdown
Contributor

a rebase should fix CI.

@neheb

neheb commented Aug 1, 2025

Copy link
Copy Markdown
Contributor
    ERROR: tools/firmware-utils failed to build.

Interesting.

@PolynomialDivision
PolynomialDivision force-pushed the tools-cmake-4-0-3 branch 2 times, most recently from b20da7f to 5c91ffd Compare August 3, 2025 09:40
@PolynomialDivision

Copy link
Copy Markdown
Member Author
    ERROR: tools/firmware-utils failed to build.

Interesting.

Just cmake dropping legacy support.

@hauke

hauke commented Aug 3, 2025

Copy link
Copy Markdown
Member

Please do a full build to ensure that all cmake packages are requiring version 3.5 or later like you fixed it for firmware-ults.

We build it also as a package in package/utils/firmware-utils.

0725c3d build: require CMake >= 3.5 due to dropped legacy support

Signed-off-by: Nick Hainke <[email protected]>
Recent CMake releases require at least version 3.5.

Signed-off-by: Nick Hainke <[email protected]>
Changelog:
https://cmake.org/cmake/help/latest/release/4.0.html

Drop patch 120-curl-fix-libressl-linking.patch. It was originally
added as a workaround for missing -lpthread in libssl.pc, with -lrt
added as a precaution. Since -lpthread is now applied correctly
during the build, the patch is no longer necessary.

Suggested-by: Rosen Penev <[email protected]>
Signed-off-by: Nick Hainke <[email protected]>
@hnyman

hnyman commented Aug 23, 2025

Copy link
Copy Markdown
Contributor

4.1.0 has been released. (seems to require just a few more automatic refreshes for patches)

@hnyman

hnyman commented Aug 23, 2025 •

Copy link
Copy Markdown
Contributor

I compiled my own E8450/RT3200 build with cmake 4.1.0 and needed quite a lot of patching of packages for cmake_minimum_required to be at least 3.5.

(I patched them locally to require the current 3.31, but the new minimum 3.5 could also work for some time. Also the cmake 3.30 in OpenWrt 24.10 might serve as the new defined minimum value, as the same package sources as in main/master could still be used also used in 24.10)

Quite many of these are actually packages where OpenWrt is also the original upstream, so devs should be able to pretty easily patch the packages in original sources.

OpenWrt hosted packages:
package/kernel/mt76 (well, outside, but managed by @nbd168 )
package/libs/libnl-tiny
package/libs/libubox
package/libs/uclient
package/libs/udebug
package/libs/ustream-ssl
package/network/ipv6/odhcp6c
package/network/services/odhcpd
package/network/services/uhttpd
package/network/services/unetd
package/system/fstools
package/system/fwtool
package/system/procd
package/system/rpcd
package/system/ubox
package/system/ubus
package/system/uci
package/system/urngd
package/system/usign

Outside packages in main repo:
package/libs/jansson/
package/libs/libjson-c/
package/libs/pcre2/
package/utils/jsonfilter/

In packages feed:
libs/libcbor
net/cgi-io (OpenWrt hosted)
net/nlbwmon (@jow- manages upstream)

In luci feed:
contrib/package/lucihttp (@jow- manages upstream)

There are surely others, but those were the ones that were included in my build. So, lots of packages to be patched before cmake 4.x can be adopted.

Edit:
Adding a note from cmake docs. Compatibility string should be at least 3.10...
(So, either 3.10 or 3.30 ?)

Changed in version 4.0: Compatibility with versions of CMake older than 3.5 is removed. Calls to cmake_minimum_required(VERSION) or cmake_policy(VERSION) that do not specify at least 3.5 as their policy version (optionally via ...) will produce an error in CMake 4.0 and above.

Changed in version 3.31: Compatibility with versions of CMake older than 3.10 is deprecated. Calls to cmake_minimum_required(VERSION) or cmake_policy(VERSION) that do not specify at least 3.10 as their policy version (optionally via ...) will produce a deprecation warning in CMake 3.31 and above.

EDIT2:
There are 64 cmake packages in the main OpenWrt repo and 200 packages in the packages feed repo. Assumingly some/many of those already have a compatible cmake_minimum_required value in the upstream sources thanks to newer releases, but likely there is need for quite much patching especially for older dormant packages.

@PolynomialDivision

Copy link
Copy Markdown
Member Author

@hnyman Since you already invested so much work, feel free to push into this PR and update it. :)

@hnyman

hnyman commented Aug 25, 2025

Copy link
Copy Markdown
Contributor

feel free to push into this PR

No push rights here...

Regarding the OpenWrt own packages, core devs should just update the sources directly in our "upstream" repos and then bump makefiles. Creating patches for uci , procd etc. is no real long-term solution.

@PolynomialDivision

Copy link
Copy Markdown
Member Author

Should I close and you just open a new PR?

@hnyman

hnyman commented Aug 25, 2025

Copy link
Copy Markdown
Contributor

No, but you could update the PR to handle 4.1.0

If you so wish, I can do a separate PR about those "OpenWrt native packages" in the main repo that I noticed. But that makes no real sense in the long run, as the only permanent solution for OpenWrt's own packages is that core devs with merge rights do update the relevant strings in local "upstream" source repos and then author new version bumps package Makefiles.

The other packages in the main repo and the 200 apps in packages feed will be more cumbersome to handle, something like the opkg-apk change was. The compatibility should be checked/changed before the cmake version bump if possible. But it is also possible that we could just bump the cmake and then fix the fallout in packages. Many/most upstream packages are stubmling into this right now, so new versions are likely compatible in any case.

@hnyman

hnyman commented Oct 5, 2025

Copy link
Copy Markdown
Contributor

This stale PR could be closed in favor of #20265

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build/scripts/tools pull request/issues for build, scripts and tools related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants