Skip to content

Commit

Permalink
Update Android and Linux-Bionic images (#102928)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
  • Loading branch information
jkoritzinsky and akoeplinger authored Jun 4, 2024
1 parent 43dbffa commit 390973d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
8 changes: 4 additions & 4 deletions eng/pipelines/common/platform-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ jobs:
targetRid: android-x64
platform: android_x64
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
container: linux_bionic
container: android
jobParameters:
runtimeFlavor: mono
buildConfig: ${{ parameters.buildConfig }}
Expand Down Expand Up @@ -611,7 +611,7 @@ jobs:
targetRid: android-x86
platform: android_x86
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
container: linux_bionic
container: android
jobParameters:
runtimeFlavor: mono
buildConfig: ${{ parameters.buildConfig }}
Expand All @@ -631,7 +631,7 @@ jobs:
targetRid: android-arm
platform: android_arm
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
container: linux_bionic
container: android
jobParameters:
runtimeFlavor: mono
buildConfig: ${{ parameters.buildConfig }}
Expand All @@ -651,7 +651,7 @@ jobs:
targetRid: android-arm64
platform: android_arm64
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
container: linux_bionic
container: android
jobParameters:
runtimeFlavor: mono
buildConfig: ${{ parameters.buildConfig }}
Expand Down
6 changes: 5 additions & 1 deletion eng/pipelines/common/templates/pipeline-with-resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,12 @@ extends:
ROOTFS_DIR: /crossrootfs/arm64

# This container contains all required toolsets to build for Android and for Linux with bionic libc.
android:
image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-cross-android-amd64-net9.0

# This container contains all required toolsets to build for Android and for Linux with bionic libc and a special layout of OpenSSL.
linux_bionic:
image: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-android-amd64
image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-android-openssl-net9.0

# This container contains all required toolsets to build for Android as well as tooling to build docker images.
android_docker:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,27 @@ macro(append_extra_cryptography_libs NativeLibsExtra)
set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
endif(CMAKE_STATIC_LIB_LINK)

find_package(OpenSSL)
# This is bad and wrong, but good enough to satisfy the build
# We only care about having "enough" OpenSSL to get the native lib built
# here, and it's on the end user to ship libssl/libcrypto from Google
if(FORCE_ANDROID_OPENSSL)
set(OPENSSL_CRYPTO_LIBRARY /usr/lib/x86_64-linux-gnu/libcrypto.so)
set(OPENSSL_SSL_LIBRARY /usr/lib/x86_64-linux-gnu/libssl.so)
if(FORCE_ANDROID_OPENSSL AND NOT OPENSSL_FOUND)
set(OPENSSL_CRYPTO_LIBRARY /usr/lib/x86_64-linux-gnu/libcrypto.so CACHE PATH "libcrypto.so" FORCE)
set(OPENSSL_SSL_LIBRARY /usr/lib/x86_64-linux-gnu/libssl.so CACHE PATH "libcrypto.so" FORCE)
# Things get more wrong. We need Desktop OpenSSL headers, but
# /usr/include is special cased and forbidden. We need to copy
# the headers to a different location and use them
if(NOT DEFINED OPENSSL_INCLUDE_DIR)
if(NOT OPENSSL_INCLUDE_DIR)
string(RANDOM LENGTH 24 _s)
set(OPENSSL_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/${_s}/opensslheaders CACHE PATH "temporary directory")
set(OPENSSL_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/${_s}/opensslheaders CACHE PATH "temporary directory" FORCE)
file(MAKE_DIRECTORY ${OPENSSL_INCLUDE_DIR})
file(COPY /usr/include/openssl DESTINATION ${OPENSSL_INCLUDE_DIR})
file(GLOB_RECURSE opensslconf /usr/include/*/openssl/*conf*.h)
file(COPY ${opensslconf} DESTINATION ${OPENSSL_INCLUDE_DIR}/openssl/)
endif()
set(OPENSSL_FOUND TRUE CACHE BOOL "OpenSSL found" FORCE)
endif()

find_package(OpenSSL)

if(NOT OPENSSL_FOUND)
message(FATAL_ERROR "!!! Cannot find libssl and System.Security.Cryptography.Native cannot build without it. Try installing libssl-dev (on Linux, but this may vary by distro) or openssl (on macOS) !!!. See the requirements document for your specific operating system: https://github.com/dotnet/runtime/tree/main/docs/workflow/requirements.")
Expand Down

0 comments on commit 390973d

Please sign in to comment.