Skip to content

Disable generating exports file for System.IO.Compression.Native on mobile - #46222

Merged
akoeplinger merged 1 commit into
dotnet:masterfrom
akoeplinger:fix-android-mac-build
Dec 18, 2020
Merged

akoeplinger merged 1 commit into
dotnet:masterfrom
akoeplinger:fix-android-mac-build

Conversation

@akoeplinger

@akoeplinger akoeplinger commented Dec 18, 2020 •

Copy link
Copy Markdown
Member

#45995 added this and it relies on this code in configuretools.cmake to detect which linker is used:

if (NOT CLR_CMAKE_HOST_WIN32)
# Ensure that awk is present
find_program(AWK awk)
if (AWK STREQUAL "AWK-NOTFOUND")
message(FATAL_ERROR "AWK not found")
endif()
# detect linker
set(ldVersion ${CMAKE_C_COMPILER};-Wl,--version)
execute_process(COMMAND ${ldVersion}
ERROR_QUIET
OUTPUT_VARIABLE ldVersionOutput)
if("${ldVersionOutput}" MATCHES "GNU ld" OR "${ldVersionOutput}" MATCHES "GNU gold" OR "${ldVersionOutput}" MATCHES "GNU linkers")
set(LD_GNU 1)
elseif("${ldVersionOutput}" MATCHES "Solaris Link")
set(LD_SOLARIS 1)
else(CLR_CMAKE_HOST_OSX)
set(LD_OSX 1)
endif()
endif()

However passing -Wl,--version to the compiler doesn't seem to work when using the clang provided by the Android NDK, it still uses the system linker in /usr/bin/ld.
On OSX that one doesn't support the --version option so we don't detect LD_GNU which we'd need for providing the correct -Wl,--version-script compiler option.

It looks like this only passed on the PR because we build Android on Linux there and the system linker is GNU there so the check was successful.

Disable the generation of the exports file on mobile platforms since we don't use it there anyway.

…obile

dotnet#45995 added this and it relies on this code in configuretools.cmake to detect which linker is used: https://github.com/dotnet/runtime/blob/4bc323242d43dda85d490c0630c4637ffc092469/eng/native/configuretools.cmake#L66-L86

However passing `-Wl,--version` to the compiler doesn't seem to work when using the clang provided by the Android NDK, it still uses the system linker in /usr/bin/ld.
On OSX that one doesn't support the `--version` option so we don't detect LD_GNU which we'd need for providing the correct `-Wl,--version-script` compiler option.

It looks like this only passed on the PR because we build Android on Linux there and the system linker _is_ GNU there so the check was successful.

Disable the generation of the exports file on mobile platforms since we don't use it there anyway.
@VSadov

VSadov commented Dec 18, 2020

Copy link
Copy Markdown
Member

This is a bit unfortunate. The idea of exports file is to reduce the default exports from 3rd party code (Brotli primarily) to the minimum we need and perhaps let the linker trim away something unused.
Ideally there would be a way to do this for mobile too. If IO.Compression is actually used...

Not doing this would not be worse than before, so it is ok too.
I kind of hoped it would work. :-/

@akoeplinger

Copy link
Copy Markdown
Member Author

Yeah I'm sure we can find a way to make it work, just wanted to unbreak the macOS build first :)

@akoeplinger
akoeplinger merged commit fcf0b8b into dotnet:master Dec 18, 2020
@akoeplinger
akoeplinger deleted the fix-android-mac-build branch December 18, 2020 18:46
@ghost ghost locked as resolved and limited conversation to collaborators Jan 17, 2021
Sign up for free to 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.

3 participants