From 397b7af3f98a903f24e753bf08956ad409c9bf3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20S=C3=A1nchez=20L=C3=B3pez?= <1175054+carlossanlop@users.noreply.github.com> Date: Thu, 11 Jul 2024 11:28:54 -0700 Subject: [PATCH 1/6] Fix zlib-ng build failure caught in the sdk repo. Fixed by converting its NativeLibrary entry in Microsoft.NETCore.Native.Unix.targets to a NetCoreAppNativeLibrary, and place it after System.IO.Compression.Native, to ensure the linker detects the symbols, since it is unable to look back. --- .../BuildIntegration/Microsoft.NETCore.Native.Unix.targets | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets index 3ff044e94d9d2..5da40064acbc4 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets @@ -130,13 +130,13 @@ The .NET Foundation licenses this file to you under the MIT license. - + @@ -146,6 +146,9 @@ The .NET Foundation licenses this file to you under the MIT license. + + + From 26e04da44c2c45b8a05ea492471475e117dc8094 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20S=C3=A1nchez=20L=C3=B3pez?= <1175054+carlossanlop@users.noreply.github.com> Date: Thu, 11 Jul 2024 12:46:07 -0700 Subject: [PATCH 2/6] Do it in cmake instead --- .../BuildIntegration/Microsoft.NETCore.Native.Unix.targets | 3 --- src/native/libs/System.IO.Compression.Native/CMakeLists.txt | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets index 5da40064acbc4..1d61b02048c65 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets @@ -146,9 +146,6 @@ The .NET Foundation licenses this file to you under the MIT license. - - - diff --git a/src/native/libs/System.IO.Compression.Native/CMakeLists.txt b/src/native/libs/System.IO.Compression.Native/CMakeLists.txt index 69d333ae53f9c..3447461d620df 100644 --- a/src/native/libs/System.IO.Compression.Native/CMakeLists.txt +++ b/src/native/libs/System.IO.Compression.Native/CMakeLists.txt @@ -184,7 +184,7 @@ else () endif () if((NOT CLR_CMAKE_USE_SYSTEM_ZLIB) AND STATIC_LIBS_ONLY) - install_static_library(zlib aotsdk nativeaot) + install_static_library(zlib ${STATIC_LIB_DESTINATION} nativeaot) endif() install (TARGETS System.IO.Compression.Native-Static DESTINATION ${STATIC_LIB_DESTINATION} COMPONENT libs) From 2ec5befa8100c151da20f53da4c5512d36b41aad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20S=C3=A1nchez=20L=C3=B3pez?= <1175054+carlossanlop@users.noreply.github.com> Date: Thu, 11 Jul 2024 14:13:13 -0700 Subject: [PATCH 3/6] Exclude windows --- .../libs/System.IO.Compression.Native/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/native/libs/System.IO.Compression.Native/CMakeLists.txt b/src/native/libs/System.IO.Compression.Native/CMakeLists.txt index 3447461d620df..7fa92062d8e5b 100644 --- a/src/native/libs/System.IO.Compression.Native/CMakeLists.txt +++ b/src/native/libs/System.IO.Compression.Native/CMakeLists.txt @@ -184,7 +184,12 @@ else () endif () if((NOT CLR_CMAKE_USE_SYSTEM_ZLIB) AND STATIC_LIBS_ONLY) - install_static_library(zlib ${STATIC_LIB_DESTINATION} nativeaot) + if (CLR_CMAKE_TARGET_UNIX) + # zlib on Unix needs to be installed in the same location as System.IO.Compression.Native so that we can then treat is as a 'z' native library. + install_static_library(zlib ${STATIC_LIB_DESTINATION} nativeaot) + else() + install_static_library(zlib aotsdk nativeaot) + endif() endif() install (TARGETS System.IO.Compression.Native-Static DESTINATION ${STATIC_LIB_DESTINATION} COMPONENT libs) From 5daaa28642b2a37bfa5acb84dcb92c59aad6cc54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20S=C3=A1nchez=20L=C3=B3pez?= <1175054+carlossanlop@users.noreply.github.com> Date: Thu, 11 Jul 2024 19:48:09 -0700 Subject: [PATCH 4/6] Check in a different folder for the UseSystemZlib condition --- .../BuildIntegration/Microsoft.NETCore.Native.Unix.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets index 1d61b02048c65..d3ec9257a25d1 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets @@ -24,7 +24,7 @@ The .NET Foundation licenses this file to you under the MIT license. lld bfd 1572864 - true + true From 73d605f0335bb9d2a7ae73b1c212421ca2a3ab48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20S=C3=A1nchez=20L=C3=B3pez?= <1175054+carlossanlop@users.noreply.github.com> Date: Thu, 11 Jul 2024 20:18:27 -0700 Subject: [PATCH 5/6] Check for empty UseSystemZlib before checking Exists --- .../BuildIntegration/Microsoft.NETCore.Native.Unix.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets index d3ec9257a25d1..107e7b1209e50 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets @@ -24,7 +24,7 @@ The .NET Foundation licenses this file to you under the MIT license. lld bfd 1572864 - true + true From e7bd7a0a4ed6c1b36583564fa20a3e20907a737e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20S=C3=A1nchez=20L=C3=B3pez?= <1175054+carlossanlop@users.noreply.github.com> Date: Thu, 11 Jul 2024 20:52:44 -0700 Subject: [PATCH 6/6] nit order of condition and quotes Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com> --- .../BuildIntegration/Microsoft.NETCore.Native.Unix.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets index 107e7b1209e50..0783ab21a46c0 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets @@ -136,7 +136,7 @@ The .NET Foundation licenses this file to you under the MIT license. - +