JuliaPackaging / BinaryBuilder.jl

Binary Dependency Builder for Julia
https://binarybuilder.org
Other
384 stars 99 forks source link

Impossible to upgrade CMake within build recipe #1317

Closed abussy closed 4 months ago

abussy commented 4 months ago

Hello,

I am trying to build a package that requires CMake with version >= 3.22. The default CMake version within BinaryBuilder currently is 3.21.7, meaning I need to update CMake within the build script.

From the documentation and other build recipes in Yggdrasil, it seems that there are two options to do so: set CMake_jll as a a HostBuildDependency, or upgrading from alpinelinux.org. As things stand, both approaches fail.

If I set HostBuildDependency(PackageSpec(; name="CMake_jll", version = v"3.28.1")), where 3.28.1 is listed as the highest available version, I get the error message LoadError: KeyError: key v"3.28.1" not found.

If I add the line apk add --upgrade cmake --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main in my script instead, I get the error message Error relocating /usr/bin/cmake: _ZSt21__glibcxx_assert_failPKciS0_S0_: symbol not found.

I think something might be broken. My solution so far is to hack the CMakeLists.txt file on the run with sed -i 's/VERSION 3.22 FATAL_ERROR/VERSION 3.21.7 FATAL_ERROR/' ./CMakeLists.txt. It works, but this is hardly a solution.

giordano commented 4 months ago

If I set HostBuildDependency(PackageSpec(; name="CMake_jll", version = v"3.28.1")), where 3.28.1 is listed as the highest available version, I get the error message LoadError: KeyError: key v"3.28.1" not found.

Hard to tell anything without a stacktrace or, even better, a PR in Yggdrasil where this fails.

If I add the line apk add --upgrade cmake --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main in my script instead, I get the error message Error relocating /usr/bin/cmake: _ZSt21__glibcxx_assert_failPKciS0S0: symbol not found.

If you install a package from a different repo you should be ready to get that kind of errors.

abussy commented 4 months ago

Thanks for the swift answer @giordano.

Hard to tell anything without a stacktrace or, even better, a PR in Yggdrasil where this fails.

As a matter of fact, I just opened a PR in Yggdrasil for that package (https://github.com/JuliaPackaging/Yggdrasil/pull/8187). It is currently using my hack and all checks are passing. I am happy to modify the recipe to demonstrate the issue though.

In the near future, I'll also contribute a recipe for a package that requires CMake version 3.23 or higher. Even if I manage to set CMake as a HostBuildDependency, 3.28.1 will be too low. What is the best course of action for this? Opening a PR on Yggdrasil for a updated version of CMake_jll?

giordano commented 4 months ago

I am happy to modify the recipe to demonstrate the issue though.

Yes, please.

I'll also contribute a recipe for a package that requires CMake version 3.23 or higher. Even if I manage to set CMake as a HostBuildDependency, 3.28.1 will be too low.

I'm confused by this: why would 3.28.1 be too low for the 3.23 requirement?

Opening a PR on Yggdrasil for a updated version of CMake_jll?

That never hurts, thanks

abussy commented 4 months ago

I'm confused by this: why would 3.28.1 be too low for the 3.23 requirement?

I think I confused myself, 3.28.1 is certainly greater than 3.23. My bad.

It seems that adding CMake as a HostBuildDependency leads to issues on the CI as well.

giordano commented 4 months ago

It seems that adding CMake as a HostBuildDependency leads to issues on the CI as well.

You need to uninstall system CMake too: https://discourse.julialang.org/t/how-to-update-cmake-version-in-binarybuilders-wizard/109461/3. Maybe we'll change the priority of host_bindir at some point.

giordano commented 4 months ago

Maybe we'll change the priority of host_bindir at some point.

Also, in a future version of BinaryBuilder we may have more of these dev tools to be installed as JLLs instead of system packages, so that we have much better control and don't rely on whatever the supporting OS currently has (which makes things also less reproducible).

abussy commented 4 months ago

You need to uninstall system CMake too: https://discourse.julialang.org/t/how-to-update-cmake-version-in-binarybuilders-wizard/109461/3. Maybe we'll change the priority of host_bindir at some point.

Unfortunately, it seems that removing system CMake triggers issues on its own.