Fix CI build for Android (#2836)

Summary:
I've been really sweating about this one. It looks like Google now removed NDK 21 as it's too old. However, we've been struggling with the upgrade because OpenSSL was built against an old version of the NDK/glibc/LLVM/some other stuff.

I've now managed to create an OpenSSL distribution for 1.1.1k (we had 1.1.0h before) that seems to build with this after some small modifications.

This seems to do the trick, but I wouldn't be shocked if we found some more incompatibilities further down the line.

Pull Request resolved: https://github.com/facebook/flipper/pull/2836

Test Plan:
- Locally: `./gradlew :tutorial:installDebug`. Builds, starts up. Cool.
- Public GitHub CI: Happy.
- Circle CI: Only triggers post-land. We'll see. But the setup is simple, so hopefully it should work there, too.
- Internal CI: Waiting for signal.

Reviewed By: fabiomassimo

Differential Revision: D30839209

Pulled By: passy

fbshipit-source-id: efe599f28cc0edfdf2149f905c3483555239edc0
This commit is contained in:
Pascal Hartig
2021-09-09 08:45:50 -07:00
committed by Facebook GitHub Bot
parent 9f7b7885e3
commit da9511a5bf
9 changed files with 14 additions and 20 deletions

View File

@@ -2,7 +2,7 @@ version: 2.1
executors: executors:
default-executor: default-executor:
docker: docker:
- image: circleci/android:api-29-ndk - image: circleci/android:api-30-ndk
resource_class: large resource_class: large
environment: environment:

View File

@@ -13,8 +13,6 @@ jobs:
uses: actions/setup-java@v1 uses: actions/setup-java@v1
with: with:
java-version: 1.8 java-version: 1.8
- name: Install NDK 21
run: echo "y" | sudo /usr/local/lib/android/sdk/tools/bin/sdkmanager --install "ndk;21.0.6113669" "ndk;20.0.5594570" --sdk_root=${ANDROID_SDK_ROOT}
- name: Compute build cache - name: Compute build cache
run: ./scripts/checksum-android.sh checksum-android.txt run: ./scripts/checksum-android.sh checksum-android.txt
- uses: actions/cache@v2 - uses: actions/cache@v2

View File

@@ -22,8 +22,6 @@ jobs:
uses: actions/setup-java@v1 uses: actions/setup-java@v1
with: with:
java-version: 1.8 java-version: 1.8
- name: Install NDK 20, 21
run: echo "y" | sudo /usr/local/lib/android/sdk/tools/bin/sdkmanager --install "ndk;21.0.6113669" "ndk;20.0.5594570" --sdk_root=${ANDROID_SDK_ROOT}
- name: Write GPG Sec Ring - name: Write GPG Sec Ring
run: echo '${{ secrets.GPG_KEY_CONTENTS }}' | base64 -d > /tmp/secring.gpg run: echo '${{ secrets.GPG_KEY_CONTENTS }}' | base64 -d > /tmp/secring.gpg
- name: Update gradle.properties - name: Update gradle.properties

View File

@@ -42,8 +42,6 @@ jobs:
uses: actions/setup-java@v1 uses: actions/setup-java@v1
with: with:
java-version: 1.8 java-version: 1.8
- name: Install NDK 21
run: echo "y" | sudo /usr/local/lib/android/sdk/tools/bin/sdkmanager --install "ndk;21.0.6113669" "ndk;20.0.5594570" --sdk_root=${ANDROID_SDK_ROOT}
- name: Compute build cache - name: Compute build cache
run: ${GITHUB_WORKSPACE}/scripts/checksum-android.sh checksum-android.txt run: ${GITHUB_WORKSPACE}/scripts/checksum-android.sh checksum-android.txt
- uses: actions/cache@v2 - uses: actions/cache@v2

View File

@@ -11,7 +11,7 @@ import org.apache.tools.ant.filters.ReplaceTokens
// Increment this when making changes to any of the native // Increment this when making changes to any of the native
// dependencies. // dependencies.
// !!! // !!!
final def CACHE_REVISION = 30 final def CACHE_REVISION = 31
final def externalDir = new File("$projectDir/external") final def externalDir = new File("$projectDir/external")
final def downloadsDir = new File("$externalDir/downloads") final def downloadsDir = new File("$externalDir/downloads")
@@ -195,7 +195,7 @@ task finalizeLibEvent(dependsOn: [prepareLibEvent2], type: Copy) {
task downloadOpenSSLSource(dependsOn: [], type: Download) { task downloadOpenSSLSource(dependsOn: [], type: Download) {
onlyIf { isCacheOutOfDate(CACHE_REVISION) } onlyIf { isCacheOutOfDate(CACHE_REVISION) }
src 'https://github.com/passy/openssl-android/releases/download/1.1.0h/openssl-1.1.0h.tar.gz' src 'https://github.com/passy/openssl-android/releases/download/1.1.1k/openssl-1.1.1k.tar.gz'
onlyIfNewer true onlyIfNewer true
overwrite false overwrite false
dest new File(downloadsDir, getDownloadFileName(src)) dest new File(downloadsDir, getDownloadFileName(src))
@@ -203,7 +203,7 @@ task downloadOpenSSLSource(dependsOn: [], type: Download) {
task downloadOpenSSLLibs(dependsOn: [], type: Download) { task downloadOpenSSLLibs(dependsOn: [], type: Download) {
onlyIf { isCacheOutOfDate(CACHE_REVISION) } onlyIf { isCacheOutOfDate(CACHE_REVISION) }
src 'https://github.com/passy/openssl-android/releases/download/1.1.0h-r2/openssl-1.1.0h-r2-prebuilt.tar.gz' src 'https://github.com/passy/openssl-android/releases/download/1.1.1k/openssl-1.1.1k-prebuilt.tar.gz'
onlyIfNewer true onlyIfNewer true
overwrite false overwrite false
dest new File(downloadsDir, getDownloadFileName(src)) dest new File(downloadsDir, getDownloadFileName(src))
@@ -214,7 +214,7 @@ task prepareOpenSSL(dependsOn: [downloadOpenSSLSource, downloadOpenSSLLibs], typ
from tarTree(downloadOpenSSLSource.dest) from tarTree(downloadOpenSSLSource.dest)
from tarTree(downloadOpenSSLLibs.dest) from tarTree(downloadOpenSSLLibs.dest)
from './overrides/OpenSSL/' from './overrides/OpenSSL/'
include 'openssl-1.1.0h/**/*' include 'openssl-1.1.1k/**/*'
include 'libs/**/*' include 'libs/**/*'
includeEmptyDirs = false includeEmptyDirs = false
into "$externalDir/OpenSSL/" into "$externalDir/OpenSSL/"
@@ -222,17 +222,17 @@ task prepareOpenSSL(dependsOn: [downloadOpenSSLSource, downloadOpenSSLLibs], typ
task configureOpenSSL(dependsOn: [prepareOpenSSL], type: Exec) { task configureOpenSSL(dependsOn: [prepareOpenSSL], type: Exec) {
onlyIf { isCacheOutOfDate(CACHE_REVISION) } onlyIf { isCacheOutOfDate(CACHE_REVISION) }
workingDir "$externalDir/OpenSSL/openssl-1.1.0h/" workingDir "$externalDir/OpenSSL/openssl-1.1.1k/"
// This is only to generate a buildconfig.h in the next step. I **believe** // This is only to generate a buildconfig.h in the next step. I **believe**
// that the options here don't really matter for that file. // that the options here don't really matter for that file.
commandLine './Configure', 'dist' commandLine './Configure', 'linux-generic64'
} }
task finalizeOpenSSL(dependsOn: [configureOpenSSL], type: Exec) { task finalizeOpenSSL(dependsOn: [configureOpenSSL], type: Exec) {
onlyIf { isCacheOutOfDate(CACHE_REVISION) } onlyIf { isCacheOutOfDate(CACHE_REVISION) }
workingDir "$externalDir/OpenSSL/openssl-1.1.0h/" workingDir "$externalDir/OpenSSL/openssl-1.1.1k/"
commandLine 'make', 'build_generated' commandLine 'make', 'build_generated'
onlyIf { !file("$externalDir/OpenSSL/openssl-1.1.0h/include/openssl/opensslconf.h").exists() } onlyIf { !file("$externalDir/OpenSSL/openssl-1.1.1k/include/openssl/opensslconf.h").exists() }
} }
task downloadRSocket(dependsOn: [], type: Download) { task downloadRSocket(dependsOn: [], type: Download) {

View File

@@ -16,7 +16,7 @@ list(APPEND dir_list ${FOLLY_DIR}/memory/detail)
set(BOOST_DIR ../boost/boost_1_63_0/) set(BOOST_DIR ../boost/boost_1_63_0/)
set(GLOG_DIR ../glog/) set(GLOG_DIR ../glog/)
set(OPENSSL_DIR ../OpenSSL/openssl-1.1.0h/) set(OPENSSL_DIR ../OpenSSL/openssl-1.1.1k/)
set(LIBEVENT_DIR ../LibEvent/libevent-2.1.11-stable/) set(LIBEVENT_DIR ../LibEvent/libevent-2.1.11-stable/)
set(DOUBLECONVERSION_DIR ../double-conversion/double-conversion-3.0.0/) set(DOUBLECONVERSION_DIR ../double-conversion/double-conversion-3.0.0/)

View File

@@ -12,7 +12,7 @@ set(glog_DIR ${third_party_ndk}/glog)
set(BOOST_DIR ${third_party_ndk}/boost/boost_1_63_0/) set(BOOST_DIR ${third_party_ndk}/boost/boost_1_63_0/)
set(LIBEVENT_DIR ${third_party_ndk}/LibEvent/libevent-2.1.11-stable/) set(LIBEVENT_DIR ${third_party_ndk}/LibEvent/libevent-2.1.11-stable/)
set(DOUBLECONVERSION_DIR ${third_party_ndk}/double-conversion/double-conversion-3.0.0/) set(DOUBLECONVERSION_DIR ${third_party_ndk}/double-conversion/double-conversion-3.0.0/)
set(OPENSSL_DIR ${third_party_ndk}/OpenSSL/openssl-1.1.0h/) set(OPENSSL_DIR ${third_party_ndk}/OpenSSL/openssl-1.1.1k/)
set(RSOCKET_ROOT_DIR ${PROJECT_SOURCE_DIR}/rsocket-cpp-${RSOCKET_VERSION}) set(RSOCKET_ROOT_DIR ${PROJECT_SOURCE_DIR}/rsocket-cpp-${RSOCKET_VERSION})
set(RSOCKET_DIR ${PROJECT_SOURCE_DIR}/rsocket-cpp-${RSOCKET_VERSION}/rsocket) set(RSOCKET_DIR ${PROJECT_SOURCE_DIR}/rsocket-cpp-${RSOCKET_VERSION}/rsocket)

View File

@@ -11,7 +11,7 @@ buildscript {
mavenCentral() mavenCentral()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:4.2.1' classpath 'com.android.tools.build:gradle:4.2.2'
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.17.0' classpath 'com.vanniktech:gradle-maven-publish-plugin:0.17.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VERSION" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VERSION"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.5.0" classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.5.0"
@@ -49,7 +49,7 @@ ext {
targetSdkVersion = 30 targetSdkVersion = 30
compileSdkVersion = 30 compileSdkVersion = 30
buildToolsVersion = '30.0.2' buildToolsVersion = '30.0.2'
ndkVersion = '21.3.6528147' ndkVersion = '23.0.7599858'
} }
ext.deps = [ ext.deps = [

View File

@@ -17,7 +17,7 @@ set(glog_DIR ${external_DIR}/glog)
set(BOOST_DIR ${external_DIR}/boost/boost_1_63_0/) set(BOOST_DIR ${external_DIR}/boost/boost_1_63_0/)
set(LIBEVENT_DIR ${external_DIR}/LibEvent/libevent-2.1.11-stable/) set(LIBEVENT_DIR ${external_DIR}/LibEvent/libevent-2.1.11-stable/)
set(DOUBLECONVERSION_DIR ${external_DIR}/double-conversion/double-conversion-3.0.0/) set(DOUBLECONVERSION_DIR ${external_DIR}/double-conversion/double-conversion-3.0.0/)
set(OPENSSL_DIR ${external_DIR}/OpenSSL/openssl-1.1.0h/) set(OPENSSL_DIR ${external_DIR}/OpenSSL/openssl-1.1.1k/)
list(APPEND dir_list ./) list(APPEND dir_list ./)
list(APPEND dir_list ./Flipper) list(APPEND dir_list ./Flipper)