OpenRCT2 / openrct2-dependencies-android

3 stars 4 forks source link

Add boringssl #8

Open janisozaur opened 6 years ago

janisozaur commented 6 years ago

This adds boringssl to all architectures.

I couldn't rebuild all the libraries, it failed on my system, so libpng and sdl2 are still outdated.

With this and https://github.com/OpenRCT2/OpenRCT2/pull/6760 I could connect to a multiplayer server: screenshot_20171202-221121

I had to manually copy the key from my desktop, as OpenRCT2 crashed with the one generated on device, as it had 0 bytes.

It crashed on this line:

https://github.com/OpenRCT2/OpenRCT2/blob/33d0fa9b8c506c6d56777df940fbb2228268d9aa/src/openrct2/network/NetworkKey.cpp#L315

The stack trace was:

/home/janisozaur/workspace/OpenRCT2/src/openrct2/network/Network.cpp: Connecting to 65.29.70.58:11753
/home/janisozaur/workspace/OpenRCT2/src/openrct2/network/NetworkKey.cpp: Failed to set keygen params
/home/janisozaur/workspace/OpenRCT2/src/openrct2/network/NetworkKey.cpp: No key loaded
/home/janisozaur/workspace/OpenRCT2/src/openrct2/network/NetworkKey.cpp: No key loaded
Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 19538 (SDLThread)
debuggerd: handling request: pid=18948 uid=10174 gid=10174 tid=19538
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'OnePlus/OnePlus5/OnePlus5:7.1.1/NMF26X/10171617:user/release-keys'
Revision: '0'
ABI: 'arm64'
pid: 18948, tid: 19538, name: SDLThread  >>> website.openrct2.debug <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
    x0   0000000000000000  x1   0000000000000000  x2   0000000000000008  x3   0000000000000010
    x4   0000007f598f7c28  x5   000000000000007f  x6   0000000000000001  x7   0000000000000000
    x8   0000007f598f7c40  x9   43554a44a5f68009  x10  0000000000000000  x11  0101010101010101
    x12  0000000000000000  x13  0000000000000000  x14  0000000000000000  x15  00308da3e5ff5107
    x16  0000007f5a8ef148  x17  0000007f7be237a8  x18  000000000000000e  x19  0000007f734290c0
    x20  0000000000000001  x21  0000007f707bc740  x22  0000000000000000  x23  0000007f5ba2424d
    x24  0000000000000004  x25  43554a44a5f68009  x26  0000007f5b2b5a98  x27  0000007f7b890600
    x28  43554a44a5f68009  x29  0000007f598f7700  x30  0000007f5a1380c8
    sp   0000007f598f76f0  pc   0000007f7be237b8  pstate 0000000040000000

backtrace:
    #00 pc 000000000001b7b8  /system/lib64/libc.so (strlen+16)
    #01 pc 00000000001cb0c4  /data/app/website.openrct2.debug-2/lib/arm64/libopenrct2.so (_ZNSt6__ndk111char_traitsIcE6lengthEPKc+20)
    #02 pc 00000000002886c0  /data/app/website.openrct2.debug-2/lib/arm64/libopenrct2.so (_ZN10NetworkKey15PublicKeyStringEv+156)
    #03 pc 0000000000288a98  /data/app/website.openrct2.debug-2/lib/arm64/libopenrct2.so (_ZN10NetworkKey13PublicKeyHashEv+56)
    #04 pc 000000000025ae94  /data/app/website.openrct2.debug-2/lib/arm64/libopenrct2.so (_ZN7Network11BeginClientEPKct+744)
    #05 pc 00000000002710c0  /data/app/website.openrct2.debug-2/lib/arm64/libopenrct2.so (network_begin_client+40)
    #06 pc 00000000000a6adc  /data/app/website.openrct2.debug-2/lib/arm64/libopenrct2-ui.so
    #07 pc 00000000000a5a00  /data/app/website.openrct2.debug-2/lib/arm64/libopenrct2-ui.so
    #08 pc 0000000000148494  /data/app/website.openrct2.debug-2/lib/arm64/libopenrct2.so (window_event_dropdown_call+68)
    #09 pc 000000000012f4e0  /data/app/website.openrct2.debug-2/lib/arm64/libopenrct2.so (input_state_widget_pressed+1052)
    #10 pc 000000000012e94c  /data/app/website.openrct2.debug-2/lib/arm64/libopenrct2.so
    #11 pc 000000000012e3c4  /data/app/website.openrct2.debug-2/lib/arm64/libopenrct2.so (game_handle_input+124)
    #12 pc 0000000000749e40  /data/app/website.openrct2.debug-2/lib/arm64/libopenrct2.so (_ZN11TitleScreen6UpdateEv+260)
    #13 pc 00000000001c804c  /data/app/website.openrct2.debug-2/lib/arm64/libopenrct2.so (_ZN8OpenRCT27Context6UpdateEv+320)
    #14 pc 00000000001c7e1c  /data/app/website.openrct2.debug-2/lib/arm64/libopenrct2.so (_ZN8OpenRCT27Context13RunFixedFrameEv+196)
    #15 pc 00000000001c7c0c  /data/app/website.openrct2.debug-2/lib/arm64/libopenrct2.so (_ZN8OpenRCT27Context8RunFrameEv+108)
    #16 pc 00000000001c7ac0  /data/app/website.openrct2.debug-2/lib/arm64/libopenrct2.so (_ZN8OpenRCT27Context11RunGameLoopEv+76)
    #17 pc 00000000001c7a38  /data/app/website.openrct2.debug-2/lib/arm64/libopenrct2.so (_ZN8OpenRCT27Context6LaunchEv+940)
    #18 pc 00000000001c5af4  /data/app/website.openrct2.debug-2/lib/arm64/libopenrct2.so (_ZN8OpenRCT27Context11RunOpenRCT2EiPPKc+44)
    #19 pc 0000000000035194  /data/app/website.openrct2.debug-2/lib/arm64/libopenrct2-ui.so (main+224)
    #20 pc 0000000000035238  /data/app/website.openrct2.debug-2/lib/arm64/libopenrct2-ui.so (SDL_main+28)
    #21 pc 00000000000cbbf4  /data/app/website.openrct2.debug-2/lib/arm64/libopenrct2-ui.so (Java_org_libsdl_app_SDLActivity_nativeInit+320)
    #22 pc 00000000003f3508  /data/app/website.openrct2.debug-2/oat/arm64/base.odex (offset 0x3b8000)
Frames 1 through 4 of that stack trace resolve respectively:
# 01 ndk-bundle/sources/cxx-stl/llvm-libc++/include/__string:217
# 02 ndk-bundle/sources/cxx-stl/llvm-libc++/include/string:1569
# 03 src/openrct2/network/NetworkKey.cpp:L315
# 04 src/openrct2/network/Network.cpp:L253

The build command:

cmake -DANDROID_ABI=arm64-v8a -DBUILD_SHARED_LIBS=on -DCMAKE_BUILD_TYPE=relwithdebinfo \
      -DCMAKE_ASM_FLAGS="-DBORINGSSL_CLANG_SUPPORTS_DOT_ARCH" \
      -DCMAKE_TOOLCHAIN_FILE=/home/janisozaur/Android/Sdk/ndk-bundle/build/cmake/android.toolchain.cmake \
      -DANDROID_NATIVE_API_LEVEL=16 \
      -GNinja ..

The built libs use https://github.com/google/boringssl/commit/bc37ad91fe74da35f97cd2748e38fd572ce5decd

The binaries in question: openrct2-libs-android-arm64-v8a.zip openrct2-libs-android-armeabi-v7a.zip openrct2-libs-android-x86.zip openrct2-libs-android-x86_64.zip

janisozaur commented 6 years ago

I have submitted a build fix for bio_test.cc: https://boringssl-review.googlesource.com/c/boringssl/+/23764

EDIT: The fix is now merged in https://github.com/google/boringssl/commit/d3ec6f1adb389de1a5d9159f56ccce225a17c363

janisozaur commented 6 years ago

Ping @marijnvdwerf

janisozaur commented 6 years ago

Note to self: jansson fails due to the script executing install target without setting any DESTDIR.

An invocation like

DESTDIR=`pwd`/out ANDROID_HOME=/home/janisozaur/Android/Sdk ANDROID_NDK_HOME=/home/janisozaur/Android/Sdk/ndk-bundle ./build.sh

gets it going a bit further, but then fails on libpng:

/home/janisozaur/Android/Sdk/ndk-bundle/prebuilt/linux-x86_64/bin/make  all-am
make[1]: Entering directory `/home/janisozaur/workspace/openrct2-dependencies-android/build/arm64-v8a/build/png/src/png_ext'
/bin/sh ./libtool  --tag=CC   --mode=link aarch64-linux-android-gcc  -g -O2   -o pngfix contrib/tools/pngfix.o libpng16.la -lm -lz -lm 
libtool: link: aarch64-linux-android-gcc -g -O2 -o .libs/pngfix contrib/tools/pngfix.o  ./.libs/libpng16.so -lz -lm -L/home/janisozaur/workspace/openrct2-dependencies-android/build/arm64-v8a/build/contrib/lib
contrib/tools/pngfix.o: In function `main':
/home/janisozaur/workspace/openrct2-dependencies-android/build/arm64-v8a/build/png/src/png_ext/contrib/tools/pngfix.c:4025: undefined reference to `stderr'
/home/janisozaur/workspace/openrct2-dependencies-android/build/arm64-v8a/build/png/src/png_ext/contrib/tools/pngfix.c:4025: undefined reference to `stderr'
collect2: error: ld returned 1 exit status
make[1]: *** [pngfix] Error 1
make[1]: Leaving directory `/home/janisozaur/workspace/openrct2-dependencies-android/build/arm64-v8a/build/png/src/png_ext'
make: *** [all] Error 2