-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix name of zlib that the linker needs #104904
Conversation
It needs to be `z` so the linker argument becomes `-lz`. Otherwise the linker sees `-lzlib` which fails on Linux. To reproduce the error, I used: $ ./build.sh --cmakeargs -DCLR_CMAKE_USE_SYSTEM_ZLIB=true
Tagging subscribers to this area: @dotnet/area-system-io-compression |
Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com>
/azp run runtime-native-aot |
This comment was marked as outdated.
This comment was marked as outdated.
/azp runtime-nativeaot-outerloop |
This comment was marked as resolved.
This comment was marked as resolved.
/azp run runtime-community |
This comment was marked as outdated.
This comment was marked as outdated.
/azp run runtime-nativeaot-outerloop |
This comment was marked as outdated.
This comment was marked as outdated.
/azp run runtime-extra-platforms |
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving after confirming the CI looks good.
@@ -13,7 +13,7 @@ macro(append_extra_compression_libs NativeLibsExtra) | |||
find_package(ZLIB REQUIRED) | |||
list(APPEND ZLIB_LIBRARIES m) | |||
else() | |||
list(APPEND ZLIB_LIBRARIES zlib) | |||
list(APPEND ZLIB_LIBRARIES $<IF:$<BOOL:CLR_CMAKE_USE_SYSTEM_ZLIB>,z,zlib>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be able to delete the ANDROID special-case above since it should be handled by this condition just fine now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Done. I also added a comment.
/ba-g Failure is an unrelated timeout to download infra resources in a wasm leg. Other wasm legs passed:
|
@LoopedBard3 what this change did was make sure that when building, the Edit: Context is #105331 (comment) |
@carlossanlop We should be using the same build steps as the runtime runs unless something has updated for in the steps that we have not gotten. The current command line for building linux x64 ends up being |
I did some quick testing:
Looks like we still link to libz in a default build configuration? |
Could be that |
We are using generator pattern in many places in the repo, I don't think it's due to that. According to % git grep relro
eng/native/configurecompiler.cmake: add_linker_flag(-Wl,-z,relro,-z,now)
src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets: <LinkerArg Include="-Wl,-z,relro" Condition="'$(_IsApplePlatform)' != 'true'" />
src/mono/CMakeLists.txt: add_link_options(-Wl,-z,relro)
src/mono/CMakeLists.txt: add_compile_options(-Wl,-z,relro) |
@am11 can you share your configure log? |
Sorry, my bad. It was actually a syntax error. :( |
No worries, we found it on time :) |
It needs to be
z
so the linker argument becomes-lz
. Otherwise the linker sees-lzlib
which fails on Linux.To reproduce the error, I used: