Skip to content

Source-build should support CBL Mariner #3654

@directhex

Description

@directhex

The model used by CBL Mariner (the distro we use to build all official builds) is a minimal OS providing a compiler and tools, combined with a sysroot folder containing libraries and headers to compile/link against. This lets us use a consistent compiler, toolchain, etc, regardless of the target architecture or distribution, and easily use a compiler version which is newer than the old version bundled with the old distros we link against (for older glibc compatibility).

Right now, the VMR fails to build on mariner for two reasons:

  • There's no easy way to pass through the sysroot to the relevant repo builds which expect it (they're looking for a ROOTFS_DIR environment variable)
  • We need to make sure repos are coping with CBL Mariner eccentricities, particularly the lack of GNU ld linker (only LLVM lld is provided, and it must be opted in for every repo by passing -fuse-ld=lld to the linker flags)
    Right now, attempting to build with Mariner fails as follows:
$ docker run -e ROOTFS_DIR=/crossrootfs/x64 -w `pwd` --platform linux/amd64 -v `pwd`:`pwd` -it mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-amd64 ./prep.sh
[..]
$ docker run -e ROOTFS_DIR=/crossrootfs/x64 -w `pwd` --platform linux/amd64 -v `pwd`:`pwd` -it mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-amd64 ./build.sh --online -- /p:PortableBuild=true
[..]
      -- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_INCLUDE_DIR) 
      CMake Error at /home/directhex/Projects/dotnet/src/runtime/artifacts/source-build/self/src/src/native/libs/System.Security.Cryptography.Native/extra_libs.cmake:29 (message):
        !!! Cannot find libssl and System.Security.Cryptography.Native cannot build
        without it.  Try installing libssl-dev (on Linux, but this may vary by
        distro) or openssl (on macOS) !!!.  See the requirements document for your
        specific operating system:
        https://github.com/dotnet/runtime/tree/main/docs/workflow/requirements.
[..]
$ cat /home/directhex/Projects/dotnet/src/runtime/artifacts/source-build/self/src/artifacts/obj/coreclr/linux.x64.Release/CMakeFiles/CMakeError.log
[..]
clang-16: error: unable to execute command: Executable "ld" doesn't exist!
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
[..]

We also need to either check whether we need to be building the subsets we currently build, OR add the needed files to the sysroot folder, to ensure every expected lib/header is available (e.g. GSS.h isn't in our images)

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions