floooh / oryol

A small, portable and extensible C++ 3D coding framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Android build failure

elix22 opened this issue · comments

Android build is failing on my Windows PC.

"fips setup android" is successful .
"fips build android-ninja-debug" is failing .

See logs below .

P.S. it is an amazing framework .

November 20, 2015

Accept? (y/N): y
Info: Preparing "Install Android SDK Platform 21 (revision: 2)".
Info: "Install Android SDK Platform 21 (revision: 2)" ready.
Info: Finishing "Install Android SDK Platform 21 (revision: 2)"
Info: Installing Android SDK Platform 21 in C:\GAME-ENGINES\Oryol\fips-sdks\android\platforms\android-21
Info: "Install Android SDK Platform 21 (revision: 2)" complete.
Info: "Install Android SDK Platform 21 (revision: 2)" finished.
done

install Android SDK package: "build-tools;27.0.3"
Info: Parsing C:\GAME-ENGINES\Oryol\fips-sdks\android\platforms\android-21\package.xml
Info: Parsing C:\GAME-ENGINES\Oryol\fips-sdks\android\tools\package.xml
Info: Parsing C:\GAME-ENGINES\Oryol\fips-sdks\android\platforms\android-21\package.xml
Info: Parsing C:\GAME-ENGINES\Oryol\fips-sdks\android\tools\package.xml
Info: Preparing "Install Android SDK Build-Tools 27.0.3 (revision: 27.0.3)".
Info: "Install Android SDK Build-Tools 27.0.3 (revision: 27.0.3)" ready.
Info: Finishing "Install Android SDK Build-Tools 27.0.3 (revision: 27.0.3)"
Info: Installing Android SDK Build-Tools 27.0.3 in C:\GAME-ENGINES\Oryol\fips-sdks\android\build-tools\27.0.3
Info: "Install Android SDK Build-Tools 27.0.3 (revision: 27.0.3)" complete.
Info: "Install Android SDK Build-Tools 27.0.3 (revision: 27.0.3)" finished.
done
install Android SDK package: platform-tools
Info: Parsing C:\GAME-ENGINES\Oryol\fips-sdks\android\build-tools\27.0.3\package.xml
Info: Parsing C:\GAME-ENGINES\Oryol\fips-sdks\android\platforms\android-21\package.xml
Info: Parsing C:\GAME-ENGINES\Oryol\fips-sdks\android\tools\package.xml
Info: Parsing C:\GAME-ENGINES\Oryol\fips-sdks\android\build-tools\27.0.3\package.xml
Info: Parsing C:\GAME-ENGINES\Oryol\fips-sdks\android\platforms\android-21\package.xml
Info: Parsing C:\GAME-ENGINES\Oryol\fips-sdks\android\tools\package.xml
Info: Preparing "Install Android SDK Platform-Tools (revision: 28.0.1)".
Info: "Install Android SDK Platform-Tools (revision: 28.0.1)" ready.
Info: Finishing "Install Android SDK Platform-Tools (revision: 28.0.1)"
Info: Installing Android SDK Platform-Tools in C:\GAME-ENGINES\Oryol\fips-sdks\android\platform-tools
Info: "Install Android SDK Platform-Tools (revision: 28.0.1)" complete.
Info: "Install Android SDK Platform-Tools (revision: 28.0.1)" finished.
done
install Android SDK package: ndk-bundle
Info: Parsing C:\GAME-ENGINES\Oryol\fips-sdks\android\build-tools\27.0.3\package.xml
Info: Parsing C:\GAME-ENGINES\Oryol\fips-sdks\android\platform-tools\package.xml
Info: Parsing C:\GAME-ENGINES\Oryol\fips-sdks\android\platforms\android-21\package.xml
Info: Parsing C:\GAME-ENGINES\Oryol\fips-sdks\android\tools\package.xml
Info: Parsing C:\GAME-ENGINES\Oryol\fips-sdks\android\build-tools\27.0.3\package.xml
Info: Parsing C:\GAME-ENGINES\Oryol\fips-sdks\android\platform-tools\package.xml
Info: Parsing C:\GAME-ENGINES\Oryol\fips-sdks\android\platforms\android-21\package.xml
Info: Parsing C:\GAME-ENGINES\Oryol\fips-sdks\android\tools\package.xml
Info: Preparing "Install SDK Patch Applier v4 (revision: 1)".
Info: "Install SDK Patch Applier v4 (revision: 1)" ready.
Info: Finishing "Install SDK Patch Applier v4 (revision: 1)"
Info: Installing SDK Patch Applier v4 in C:\GAME-ENGINES\Oryol\fips-sdks\android\patcher\v4
Info: "Install SDK Patch Applier v4 (revision: 1)" complete.
Info: "Install SDK Patch Applier v4 (revision: 1)" finished.
Info: Preparing "Install NDK (revision: 18.1.5063045)".
Info: "Install NDK (revision: 18.1.5063045)" ready.
Info: Finishing "Install NDK (revision: 18.1.5063045)"
Info: Installing NDK in C:\GAME-ENGINES\Oryol\fips-sdks\android\ndk-bundle
Info: "Install NDK (revision: 18.1.5063045)" complete.
Info: "Install NDK (revision: 18.1.5063045)" finished.
done
done.

C:\GAME-ENGINES\Oryol\oryol>fips build android-ninja-debug
=== dependency: 'fips-unittestpp':
dir 'C:/GAME-ENGINES/Oryol/fips-unittestpp' exists
=== dependency: 'fips-remotery':
dir 'C:/GAME-ENGINES/Oryol/fips-remotery' exists
=== dependency: 'fips-glm':
dir 'C:/GAME-ENGINES/Oryol/fips-glm' exists
=== dependency: 'fips-glfw':
dir 'C:/GAME-ENGINES/Oryol/fips-glfw' exists
=== dependency: 'gliml':
dir 'C:/GAME-ENGINES/Oryol/gliml' exists
=== dependency: 'fips-zlib':
dir 'C:/GAME-ENGINES/Oryol/fips-zlib' exists
=== dependency: 'fips-vld':
dir 'C:/GAME-ENGINES/Oryol/fips-vld' exists
=== dependency: 'fips-libcurl':
dir 'C:/GAME-ENGINES/Oryol/fips-libcurl' exists
=== building: android-ninja-debug
=== generating: android-ninja-debug
config file: C:/GAME-ENGINES/Oryol/fips/configs/android-ninja-debug.yml
Using Toolchain File: C:/GAME-ENGINES/Oryol/fips/cmake-toolchains/android.toolchain.cmake
cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=C:/GAME-ENGINES/Oryol/fips/tools/win32/ninja.exe -DCMAKE_TOOLCHAIN_FILE=C:/GAME-ENGINES/Oryol/fips/cmake-toolchains/android.toolchain.cmake -DFIPS_CONFIG=android-ninja-debug -DANDROID_ABI="armeabi-v7a" -DANDROID_PLATFORM="android-21" -DF
IPS_USE_CCACHE=OFF -DFIPS_AUTO_IMPORT=ON -BC:/GAME-ENGINES/Oryol/fips-build/oryol/android-ninja-debug -HC:/GAME-ENGINES/Oryol/oryol
-- Check for working C compiler: C:/GAME-ENGINES/Oryol/fips-sdks/android/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe
-- Check for working C compiler: C:/GAME-ENGINES/Oryol/fips-sdks/android/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/GAME-ENGINES/Oryol/fips-sdks/android/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe
-- Check for working CXX compiler: C:/GAME-ENGINES/Oryol/fips-sdks/android/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe -- broken
CMake Error at C:/cmake/share/cmake-3.10/Modules/CMakeTestCXXCompiler.cmake:45 (message):
The C++ compiler

"C:/GAME-ENGINES/Oryol/fips-sdks/android/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: C:/GAME-ENGINES/Oryol/fips-build/oryol/android-ninja-debug/CMakeFiles/CMakeTmp

Run Build Command:"C:/GAME-ENGINES/Oryol/fips/tools/win32/ninja.exe" "cmTC_4d0ee"
[1/2] Building CXX object CMakeFiles/cmTC_4d0ee.dir/testCXXCompiler.cxx.o
[2/2] Linking CXX executable cmTC_4d0ee
FAILED: cmTC_4d0ee
cmd.exe /C "cd . && C:\GAME-ENGINES\Oryol\fips-sdks\android\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=armv7-none-linux-androideabi --gcc-toolchain=C:/GAME-ENGINES/Oryol/fips-sdks/android/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64 --s

ysroot=C:/GAME-ENGINES/Oryol/fips-sdks/android/ndk-bundle/sysroot -Wno-expansion-to-defined -isystem C:/GAME-ENGINES/Oryol/fips-sdks/android/ndk-bundle/sysroot/usr/include/arm-linux-androideabi -D__ANDROID_API__=21 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canoni
cal-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fno-integrated-as -mthumb -Wa,--noexecstack -Wformat -Werror=format-security -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a --sysroot C:/GAME-ENGINES/Oryol/fips-sdks/android/ndk-bundle/platforms/android-21/arch-arm -Wl,--bu
ild-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now -Wl,--gc-sections -Wl,-z,nocopyreloc -pie -fPIE CMakeFiles/cmTC_4d0ee.dir/testCXXCompiler.cxx.o -o cmTC_4d0ee -latomic -lm "C:/GAME-ENGINES/Ory
ol/fips-sdks/android/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/libgnustl_static.a" && cd ."
clang++.exe: error: no such file or directory: 'C:/GAME-ENGINES/Oryol/fips-sdks/android/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/libgnustl_static.a'
ninja: build stopped: subcommand failed.

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt

-- Configuring incomplete, errors occurred!
See also "C:/GAME-ENGINES/Oryol/fips-build/oryol/android-ninja-debug/CMakeFiles/CMakeOutput.log".
See also "C:/GAME-ENGINES/Oryol/fips-build/oryol/android-ninja-debug/CMakeFiles/CMakeError.log".
[ERROR] Failed to generate 'android-ninja-debug' of project 'oryol'
C:\GAME-ENGINES\Oryol\oryol>

Hmm, the Android SDK/NDK tends to break every couple of months so this isn't surprising.

Looks like one of the STL implementations in the Android NDK is missing, because cmake can't find the static STL runtime library libgnustl_static.a.

I tried switching to libc++_static.a, which fixes this specific problem, but then fails when compiling later with some other error.

You can do an update on Oryol and fips, do a ./fips clean and then a ./fips gen, this gets past the cmake problem, but then fails with errors like this when compiling Oryol:

/Volumes/Android/buildbot/src/android/ndk-release-r18/external/libcxx/src/future.cpp:97: error: undefined reference to '__cxa_free_exception'

At the moment I don't have time (and motivation) to investigate, and frankly, with all the hassle and pain the Android NDK has been over the years I'm thinking about dropping native Android support and just go with WebAssembly + Apache Cordova ;)

Thanks for the quick response .
I have another more recent ndk-bundle on my PC , so I copied the missing "gnu-libstdc++" folder .
And implemented your latest fix on androidBridge.h .
The compilation passed, ran some examples on an Android device , works like a charm .

Maybe the urls in android.py should be modified to point to a more recent SDK ?
tools_urls = {
'win': 'https://dl.google.com/android/repository/sdk-tools-windows-3859397.zip',
'osx': 'https://dl.google.com/android/repository/sdk-tools-darwin-3859397.zip',
'linux': 'https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip'
}

Please don't abandon Android ,.
Your framework is unique , supporting both Metal and GLES2/GLES3 .
This is important a specially since Apple is dropping GLES in the next release.

Thanks for your help.

Ah ok, good to know, this looks like a good fix. I'll try that out when I have a free minute :)

This should be fixed now with the above fips PR by @gustavolsson.