Fix freebsd cross build with cmake 3.25#78534
Conversation
|
Tagging subscribers to this area: @dotnet/area-infrastructure-libraries Issue DetailsIn cmake 3.25, the toolchain file is called with context containing Upstream PR: dotnet/arcade#11672
|
9b92609 to
9ff3fc2
Compare
|
cc @jkotas, reverted pinned container reference. FreeBSD legs are green. It was this change in cmake 3.25 which sets LINUX to 1: Kitware/CMake@62cd390. |
|
We have similar code in eng/native/tryrun.cmake. This sounds like a cmake bug to me, could you please report it to them? The changelog only mentions this so I don't think it should be set on freebsd:
Maybe we should also stop relying on these variables and introduce our own (e.g. similar to the |
|
Ah this is in the cross-build docker images so the host system is actually Linux right? That makes more sense then and makes me wish we'd stop using these variables even more. |
|
It can refactored separately, I don't feel strongly that we should; because:
|
|
Yeah I'm mostly worried that we're basically overriding CMake-internal variables and who knows what impact that has. |
|
It is a predefined variable. We overwrite predefined variables all over the place. All CMAKE_* are predefined variables, for example. I don't think there is anything to worry about here. |
|
I agree with @am11 that overwriting built-in CMake variables during cross-compilation seems to be pretty standard pattern. It is even suggested in official CMake docs. |
|
All failures are known issues according to the Build Analysis. |
|
Right but we're apparently using these variables not in the way that cmake intended (i.e. for cross compilation targets rather than the host OS). I think refactoring to use e.g. a |
|
We also need to backport this or some other fix to all servicing branches. |
CMake documentation says that it is meant to represent target system: Kitware/CMake@62cd390#diff-186bb1bd28bd5ab49edaeb9820e3a5218c73bf02fec15bd71d221da5a130608bR4 |
|
Ah ok, yeah then this approach looks good to me. |
I have triggered the backports in arcade repo. We can let the codeflow to take care of the rest in the servicing trees. |
In cmake 3.25, the toolchain file is called with context containing
LINUXvariable set. This causes problem for non-Linux platform. Fix is to unset platform variables which we use in the toolchain file.Upstream PR: dotnet/arcade#11672
Fixes: #78528