Skip to content

Remove system zlib packages from unix native dependencies #105373

Closed
@carlossanlop

Description

@carlossanlop

Follow up of #105371

We can't yet remove the system zlib packages from the package installation branches in install-native-dependencies.sh because we don't yet consume an SDK version that includes zlib-ng.

If we remove them from this script, and we attempt to run it in a new machine, then try to build runtime with:

eng/install-native-dependencies.sh
./build.sh clr+libs

We see this error:

cdac-build-tool -> /home/carlos/runtime/artifacts/bin/coreclr/linux.x64.Debug/cdac-build-tool/cdac-build-tool.dll
  /usr/bin/ld.bfd: cannot find -lz: No such file or directory
clang : error : linker command failed with exit code 1 (use -v to see invocation) [/home/carlos/runtime/src/native/managed/cdacreader/src/cdacreader.csproj]
/home/carlos/.nuget/packages/microsoft.dotnet.ilcompiler/9.0.0-preview.7.24371.6/build/Microsoft.NETCore.Native.targets(368,5): error MSB3073: The command ""clang" "/home/carlos/runtime/artifacts/obj/cdacreader/Debug/net9.0/linux-x64/native/libcdacreader.o" -o "/home/carlos/runtime/artifacts/bin/cdacreader/Debug/net9.0/linux-x64/native/libcdacreader.so" -Wl,--version-script=/home/carlos/runtime/artifacts/obj/cdacreader/Debug/net9.0/linux-x64/native/libcdacreader.exports -Wl,--export-dynamic -Wl,-soname=cdacreader.so -gz=zlib -fuse-ld=bfd /home/carlos/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/9.0.0-preview.7.24371.6/sdk/libbootstrapperdll.o /home/carlos/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/9.0.0-preview.7.24371.6/sdk/libRuntime.WorkstationGC.a /home/carlos/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/9.0.0-preview.7.24371.6/sdk/libeventpipe-disabled.a /home/carlos/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/9.0.0-preview.7.24371.6/sdk/libRuntime.VxsortEnabled.a /home/carlos/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/9.0.0-preview.7.24371.6/sdk/libstandalonegc-disabled.a /home/carlos/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/9.0.0-preview.7.24371.6/sdk/libstdc++compat.a /home/carlos/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/9.0.0-preview.7.24371.6/framework/libSystem.Native.a /home/carlos/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/9.0.0-preview.7.24371.6/framework/libSystem.IO.Compression.Native.a /home/carlos/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/9.0.0-preview.7.24371.6/framework/libSystem.Net.Security.Native.a /home/carlos/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/9.0.0-preview.7.24371.6/framework/libSystem.Security.Cryptography.Native.OpenSsl.a -g -Wl,-rpath,'$ORIGIN' -Wl,--build-id=sha1 -Wl,--as-needed -Wl,-e0x0 -pthread -ldl -lz -lrt -lm -shared -Wl,-z,relro -Wl,-z,now -Wl,--eh-frame-hdr -Wl,--discard-all -Wl,--gc-sections" exited with code 1. [/home/carlos/runtime/src/native/managed/cdacreader/src/cdacreader.csproj]

Once we start consuming an SDK version that includes zlib-ng, we can remove those 3 references from the script: zlib1g-dev, zlib-devel and zlib-dev.

apt install -y build-essential gettext locales cmake llvm clang lldb liblldb-dev libunwind8-dev libicu-dev liblttng-ust-dev \
libssl-dev libkrb5-dev zlib1g-dev
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
elif [ "$ID" = "fedora" ]; then
dnf install -y cmake llvm lld lldb clang python curl libicu-devel openssl-devel krb5-devel zlib-devel lttng-ust-devel
elif [ "$ID" = "alpine" ]; then
apk add build-base cmake bash curl clang llvm-dev krb5-dev lttng-ust-dev icu-dev zlib-dev openssl-dev

And also remove mentions of zlib in the instructions:

https://github.com/dotnet/runtime/blob/main/docs/workflow/requirements/linux-requirements.md

Metadata

Metadata

Assignees

Labels

area-Infrastructurein-prThere is an active PR which will close this issue when it is merged

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions