Skip to content

Conversation

@mazunki
Copy link
Contributor

@mazunki mazunki commented Oct 13, 2025

As discussed in #2310, there are some issues with the build system picking a linker for unikernels, even in --pure mode.

Passing set(CMAKE_LINKER_TYPE LLD) seems to fix this, but doesn't work in older versions of CMake. This PR updates the minimum version of cmake we depend on to 3.31.6 (as reported by nix-shell --pure ./develop.nix --run 'cmake --version').

Bumping this version reports two usages of PRE_BUILD which is invalid in modern CMake (I believe they always have been, but just been silently ignored? https://cmake.org/cmake/help/latest/command/add_custom_command.html), and only be relevant to the Visual Studio editor and build system. I've simply removed them (commit 7097eda).

Lastly, I have added an explicit dependency to LLD/LLVM (https://cmake.org/cmake/help/latest/variable/CMAKE_LINKER_TYPE.html) in the example unikernel. With CMake updated, the unikernel links successfully even on Gentoo .

@mazunki
Copy link
Contributor Author

mazunki commented Oct 13, 2025

Worth nothing: It only links successfully in --pure mode on my machine.

@mazunki
Copy link
Contributor Author

mazunki commented Oct 13, 2025

Seems like set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=lld") from cmake/linux.service.cmake:175 is the culprit for adding the unrecognized -fuse-ld=lld flag. Is this still required if we explicitly tell CMake to use the LLD linker?

Sidenote: Maybe we should enable LLD by default on the linux target since we're using LLVM anyway?

@mazunki mazunki changed the title Update cmake version to handle linking issues Update deprecated cmake version Oct 15, 2025
@mazunki
Copy link
Contributor Author

mazunki commented Oct 17, 2025

@alfreb You mentioned you were skeptical to bumping to such a high version because of cmake_minimum_required suggesting it's the minimum version, and not the expected version. Do you prefer if we only bump the outdated ones to 3.10?

Since we're using a pinned nix version, we can essentially guarantee that the version used here is available. Are there any downsides other than a semantic meaning?

For reference, 4.2.0 is the latest version, 3.31.6 was released on 2025-02-24.

@alfreb
Copy link
Contributor

alfreb commented Oct 18, 2025

This is fine. I generally don't want to deprecate tools that work just fine, and are supported. But the only build system we support is nix with the pinned versions, and I verified now that this is 3.31.6, so let's go with that, even though it's not technically the minimum version.

@alfreb alfreb merged commit ea7a074 into includeos:main Oct 18, 2025
@mazunki mazunki deleted the bump-cmake-3.31 branch October 18, 2025 10:01
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