Skip to content

Conversation

am11
Copy link
Member

@am11 am11 commented Jul 23, 2024

Fix cmake expression syntax in System.IO.Compression.Native.

@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Jul 23, 2024
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-io-compression
See info in area-owners.md if you want to be subscribed.

@am11 am11 changed the title Fix expression syntax Fix cmake expression syntax in System.IO.Compression.Native Jul 23, 2024
@ericstj ericstj changed the title Fix cmake expression syntax in System.IO.Compression.Native Ensure linux uses zlib-ng and not system ZLIB Jul 23, 2024
@am11
Copy link
Member Author

am11 commented Jul 23, 2024

Before:

ldd artifacts/bin/runtime/net9.0-linux-Release-arm64/libSystem.IO.Compression.Native.so
	linux-vdso.so.1 (0x0000ffff86e02000)
	libz.so.1 => /lib/aarch64-linux-gnu/libz.so.1 (0x0000ffff86c90000)
	libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000ffff86ad0000)
	/lib/ld-linux-aarch64.so.1 (0x0000ffff86dc5000)

After:

ldd artifacts/bin/runtime/net9.0-linux-Release-arm64/libSystem.IO.Compression.Native.so 
	linux-vdso.so.1 (0x0000ffff8970d000)
	libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000ffff89420000)
	/lib/ld-linux-aarch64.so.1 (0x0000ffff896d0000)

@carlossanlop
Copy link
Contributor

It's causing build failures.

@carlossanlop carlossanlop self-requested a review July 23, 2024 20:58
@carlossanlop
Copy link
Contributor

I applied the suggestion because the build is breaking and we're short on time since we need to backport this to Preview7 too.

@am11
Copy link
Member Author

am11 commented Jul 23, 2024

Yes macOS wasn't liking the syntax, while linux was passing. $<IF requires ${}, which works on both platforms.

@carlossanlop
Copy link
Contributor

/backport to release/9.0-preview7

Copy link
Contributor

Started backporting to release/9.0-preview7: https://github.com/dotnet/runtime/actions/runs/10066382223

@carlossanlop
Copy link
Contributor

carlossanlop commented Jul 23, 2024

I see that most of the Unix build legs have finished and they were successful.

Strangely, the build is still breaking for me in ubuntu after applying the latest fix. I just ran ./build.sh:

  LibraryImportGenerator -> /home/carlos/repos/runtime/artifacts/bin/LibraryImportGenerator/Debug/netstandard2.0/Microsoft.Interop.LibraryImportGenerator.dll
  System.Private.CoreLib -> /home/carlos/repos/runtime/artifacts/bin/System.Private.CoreLib/ref/Debug/net9.0/System.Private.CoreLib.dll
  System.Private.CoreLib -> /home/carlos/repos/runtime/artifacts/bin/coreclr/linux.x64.Debug/IL/System.Private.CoreLib.dll
  cdac-build-tool -> /home/carlos/repos/runtime/artifacts/bin/coreclr/linux.x64.Debug/cdac-build-tool/cdac-build-tool.dll
  Generating native code
  /usr/bin/ld.bfd: cannot find -lz: No such file or directory
clang-17 : error : linker command failed with exit code 1 (use -v to see invocation) [/home/carlos/repos/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/repos/runtime/artifacts/obj/cdacreader/Debug/net9.0/linux-x64/native/libcdacreader.o" -o "/home/carlos/repos/runtime/artifacts/bin/cdacreader/Debug/net9.0/linux-x64/native/libcdacreader.so" -Wl,--version-script=/home/carlos/repos/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/repos/runtime/src/native/managed/cdacreader/src/cdacreader.csproj]

Still appending -lz.

@am11
Copy link
Member Author

am11 commented Jul 23, 2024

Have you tried with a clean build:

rm -rf artifacts
./build.sh

@carlossanlop
Copy link
Contributor

Yes, it's completely clean.

Note that I do not have zlib1g-dev installed here. So I'm trying to determine why in my machine we're trying to use the system zlib.

@am11
Copy link
Member Author

am11 commented Jul 23, 2024

It's the build ordering issue. cdac-build-tool is built before clr and libs subsets, so it fails this condition:

<UseSystemZlib Condition="'$(UseSystemZlib)' == '' and !Exists('$(IlcFrameworkNativePath)libz.a')">true</UseSystemZlib>

and tries to use system libz.

@carlossanlop
Copy link
Contributor

I'm being told that this is expected but it's also temporary: cdacreader.csproj uses the LKG toolchain, so it won't have zlib-ng available until we consume an SDK that has it. The workaround is to keep installing zlib1g-dev.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.IO.Compression community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants