Skip to content

[mono] Reorganize zlib dependency logic - #63365

Merged
lambdageek merged 4 commits into
dotnet:mainfrom
lambdageek:have-sys-zlib-main
Jan 6, 2022
Merged

[mono] Reorganize zlib dependency logic #63365
lambdageek merged 4 commits into
dotnet:mainfrom
lambdageek:have-sys-zlib-main

Conversation

@lambdageek

@lambdageeklambdageek commented Jan 4, 2022

Copy link
Copy Markdown
Member

Instead of deciding whether features are enabled based on the presence or absence of zlib, add switches to control features (embedded PDB support, and compressed log profiler output) and based on that require zlib.

On some platforms we use the in-tree copy of zlib from src/native/external/zlib, otherwise we want to link against the system zlib.

Previously, if zlib was missing the build would quietly succeed, but the feature support would be missing. Now, if the feature isn't disabled but zlib is missing, we fail the build.

If both features are disabled, don't depend on zlib at all.

In particular this re-enables embedded PDB support on iOS and Android

The corresponding release/6.0-maui PR is #63359 and is more conservative - it just duplicates the mono/mono HAVE_SYS_ZLIB check. In this PR, we get rid of HAVE_SYS_ZLIB entirely.

In particular this re-enables embedded PDB support on iOS and Android
Comment threadsrc/mono/cmake/configure.cmake Outdated
@lambdageek

Copy link
Copy Markdown
MemberAuthor

/azp run runtime-manual

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@lambdageeklambdageek self-assigned this Jan 4, 2022
thaystg
thaystg previously approved these changes Jan 5, 2022
@lambdageek
lambdageek marked this pull request as draft January 5, 2022 14:21
@lambdageek

Copy link
Copy Markdown
MemberAuthor

See #63365 (comment)

I think we can do better for net7: have explicit options for enable/disable Embedded PDB support and compressed log profiler output, and use those to decide whether zlib is required or not, and if it is required, whether we should depend on the system zlib, or the in-tree copy.

Instead of deciding whether features are enabled based on the presence or
absense of zlib, add switches to control features (embedded PDB support, and
compressed log profiler output) and based on that require zlib.
On some platforms we use the in-tree copy of zlib from
src/native/external/zlib, otherwise we want to link against the system zlib.
Previously, if zlib was missing the build would quietly succeed, but the
feature support would be missing. Now, if the feature isn't disabled but zlib
is missing, we fail the build.
If both features are disabled, don't depend on zlib at all.
@lambdageeklambdageek changed the title [mono] Add back HAVE_SYS_ZLIB support[mono] Reorganize zlib dependency logic Jan 5, 2022
@lambdageek
lambdageek marked this pull request as ready for review January 5, 2022 17:31
@lambdageek
lambdageek dismissed thaystg’s stale reviewJanuary 5, 2022 17:32

Changed pretty much everything

Comment threadsrc/native/libs/System.IO.Compression.Native/extra_libs.cmake Outdated
Comment threadsrc/mono/CMakeLists.txt Outdated
Comment threadsrc/mono/CMakeLists.txt Outdated
Comment threadsrc/mono/cmake/config.h.in Outdated
#cmakedefine DISABLE_QCALLS 1

/* Embedded PDB support disabled */
#cmakedefine DISABLE_EMBEDDED_PDB 1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: when DISABLE_EMBEDDED_PDB is defined in cmake config, this produces:

#defineDISABLE_EMBEDDED_PDB 1

in coreclr, src/native etc., we use these two variants:

#cmakedefine TOKEN
#cmakedefine01 TOKEN

when TOKEN is defined in cmake config, it generates:

#defineTOKEN// usage: #ifdef TOKEN#defineTOKEN 1 // usage: #if TOKEN

and when undefined, produces:

// nothing for the first line#defineTOKEN 0 // usage: #if TOKEN

lambdageekand others added 2 commits January 5, 2022 12:59
Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com>
- reverse if() logic to avoid negation
- use cmakedefine without a value in config.h.in, same as CoreCLR
@steveisok
steveisok self-requested a review January 6, 2022 21:14
@lambdageek
lambdageek merged commit 0e800a6 into dotnet:mainJan 6, 2022
steveisok pushed a commit that referenced this pull request Jan 10, 2022
In particular this re-enables embedded PDB support on iOS and Android
The corresponding PR for main is #63365
@ghostghost locked as resolved and limited conversation to collaborators Feb 6, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@lambdageek@steveisok@am11@thaystg