Skip to content

Commit fcf0b8b

Browse files
authored
Disable generating exports file for System.IO.Compression.Native on mobile (#46222)
#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.
1 parent 5ec6770 commit fcf0b8b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,18 @@ if (GEN_SHARED_LIB)
6868
${NATIVE_LIBS_EXTRA}
6969
)
7070

71-
set(DEF_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/System.IO.Compression.Native_unixexports.src)
72-
set(EXPORTS_FILE ${CMAKE_CURRENT_BINARY_DIR}/System.IO.Compression.Native.exports)
73-
generate_exports_file(${DEF_SOURCES} ${EXPORTS_FILE})
74-
set_exports_linker_option(${EXPORTS_FILE})
71+
if (NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID)
72+
set(DEF_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/System.IO.Compression.Native_unixexports.src)
73+
set(EXPORTS_FILE ${CMAKE_CURRENT_BINARY_DIR}/System.IO.Compression.Native.exports)
74+
generate_exports_file(${DEF_SOURCES} ${EXPORTS_FILE})
75+
set_exports_linker_option(${EXPORTS_FILE})
7576

76-
add_custom_target(System.IO.Compression.Native_exports DEPENDS ${EXPORTS_FILE})
77-
add_dependencies(System.IO.Compression.Native System.IO.Compression.Native_exports)
77+
add_custom_target(System.IO.Compression.Native_exports DEPENDS ${EXPORTS_FILE})
78+
add_dependencies(System.IO.Compression.Native System.IO.Compression.Native_exports)
7879

79-
set_property(TARGET System.IO.Compression.Native APPEND_STRING PROPERTY LINK_FLAGS ${EXPORTS_LINKER_OPTION})
80-
set_property(TARGET System.IO.Compression.Native APPEND_STRING PROPERTY LINK_DEPENDS ${EXPORTS_FILE})
80+
set_property(TARGET System.IO.Compression.Native APPEND_STRING PROPERTY LINK_FLAGS ${EXPORTS_LINKER_OPTION})
81+
set_property(TARGET System.IO.Compression.Native APPEND_STRING PROPERTY LINK_DEPENDS ${EXPORTS_FILE})
8182

82-
if (NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID)
8383
add_custom_command(TARGET System.IO.Compression.Native POST_BUILD
8484
COMMENT "Verifying System.IO.Compression.Native entry points against entrypoints.c "
8585
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../verify-entrypoints.sh

0 commit comments

Comments
 (0)