o3de / o3de

Open 3D Engine (O3DE) is an Apache 2.0-licensed multi-platform 3D engine that enables developers and content creators to build AAA games, cinema-quality 3D worlds, and high-fidelity simulations without any fees or commercial obligations.
https://o3de.org
Other
7.8k stars 2.2k forks source link

[Android] [Linux] Building project created from default template fails #13968

Closed LB-KacperKapusta closed 7 months ago

LB-KacperKapusta commented 1 year ago

Describe the bug Building the Android project using Linux's terminal fails with the following error:

FAILED: Code/Framework/AzCore/CMakeFiles/AzCore.dir/AzCore/Math/IntersectSegment.cpp.o 
/home/gpc-589/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android30 --sysroot=/home/gpc-589/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/sysroot -DANDROID -DAZ_BUILD_CONFIGURATION_TYPE=\"profile\" -DAZ_ENABLE_DEBUG_TOOLS -DAZ_ENABLE_TRACING -DAZ_PROFILE_BUILD -DENABLE_TYPE_INFO -DLINUX -DLINUX64 -DMOBILE -DNDEBUG -DNDK_REV_MAJOR=25 -DNDK_REV_MINOR=1 -DO3DE_STACK_CAPTURE_DEPTH=3 -D_FORTIFY_SOURCE=2 -D_HAS_C9X -D_HAS_EXCEPTIONS=0 -D_LINUX -D_PROFILE -D__ARM_NEON__ -I/home/gpc-589/o3de/Code/Framework/AzCore/. -I/home/gpc-589/o3de/Code/Framework/AzCore/Platform/Android -I/home/gpc-589/o3de/Code/Framework/AzCore/Platform/Common -isystem /home/gpc-589/.o3de/3rdParty/packages/Lua-5.4.4-rev1-android/Lua/include -isystem /home/gpc-589/.o3de/3rdParty/packages/RapidJSON-1.1.0-rev1-multiplatform/RapidJSON/include -isystem /home/gpc-589/.o3de/3rdParty/packages/RapidXML-1.13-rev1-multiplatform/RapidXML/include -isystem /home/gpc-589/.o3de/3rdParty/packages/zlib-1.2.11-rev5-android/zlib/include -isystem /home/gpc-589/.o3de/3rdParty/packages/zstd-1.35-multiplatform/zstd/lib -isystem /home/gpc-589/.o3de/3rdParty/packages/cityhash-1.1-multiplatform/cityhash/src -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Werror -Wno-inconsistent-missing-override -Wrange-loop-analysis -Wno-unknown-warning-option -Wno-parentheses -Wno-reorder -Wno-switch -Wno-undefined-var-template -femulated-tls -ffast-math -fno-aligned-allocation -fms-extensions -fno-aligned-allocation -stdlib=libc++  -O2 -g -fstack-protector-all -fstack-check -g -gdwarf-2 -fPIC -std=c++17 -fno-fast-math -MD -MT Code/Framework/AzCore/CMakeFiles/AzCore.dir/AzCore/Math/IntersectSegment.cpp.o -MF Code/Framework/AzCore/CMakeFiles/AzCore.dir/AzCore/Math/IntersectSegment.cpp.o.d -o Code/Framework/AzCore/CMakeFiles/AzCore.dir/AzCore/Math/IntersectSegment.cpp.o -c /home/gpc-589/o3de/Code/Framework/AzCore/AzCore/Math/IntersectSegment.cpp
clang-14: error: overriding '-ffp-contract=fast' option with '-ffp-contract=on' [-Werror,-Woverriding-t-option]
ninja: build stopped: subcommand failed.

It has been verified that the same error occurs with and without unity build enabled. Note that Android instructions are only available for Windows and the commands have been adjusted to work on Linux. Please refer to the attached log and screenshot for more information.

Prerequisites

In this test the following settings have been used:

export O3DE_ENGINE_PATH=/home/gpc-589/o3de
export O3DE_PROJECT_PATH=/home/gpc-589/O3DE/Projects/DefaultProject
export O3DE_BUILD_ROOT=/home/gpc-589/o3de-build/android_apk
export O3DE_ANDROID_SIGNCONFIG_FILE=$O3DE_BUILD_ROOT/o3de.keystore
export O3DE_ANDROID_SIGNCONFIG_STORE_PASSWORD=o3de_android
export O3DE_ANDROID_SIGNCONFIG_KEY_ALIAS=o3de_key
export O3DE_ANDROID_SIGNCONFIG_KEY_PASSWORD=o3de_android
export O3DE_ANDROID_SIGNCONFIG_KEY_SIZE=2048
export O3DE_ANDROID_SIGNCONFIG_VALIDITY_DAYS=10000
export O3DE_ANDROID_DN="cn=DefaultProject, ou=o3de, o=LF, c=US"
export O3DE_ANDROID_SDK_PATH=/home/gpc-589/Android/Sdk
export O3DE_ANDROID_NDK_VERSION=25.1.8937393
export O3DE_ANDROID_SDK_API_LEVEL=30
export O3DE_ANDROID_ASSET_MODE=LOOSE
export O3DE_ANDROID_DEPLOY_TYPE=APK

Steps to reproduce

  1. Generate KeyStore to allow APK signing: keytool -genkey -keystore $O3DE_ANDROID_SIGNCONFIG_FILE -storepass $O3DE_ANDROID_SIGNCONFIG_STORE_PASSWORD -alias $O3DE_ANDROID_SIGNCONFIG_KEY_ALIAS -keypass $O3DE_ANDROID_SIGNCONFIG_KEY_PASSWORD -keyalg RSA -keysize $O3DE_ANDROID_SIGNCONFIG_KEY_SIZE -validity $O3DE_ANDROID_SIGNCONFIG_VALIDITY_DAYS -dname "cn=DefaultProject, ou=o3de, o=LF, c=US"
  2. Use Python to run generate_android_project.py: bash $O3DE_ENGINE_PATH/python/python.sh $O3DE_ENGINE_PATH/cmake/Tools/Platform/Android/generate_android_project.py --engine-root $O3DE_ENGINE_PATH --project-path $O3DE_PROJECT_PATH --build-dir $O3DE_BUILD_ROOT/android --third-party-path ~/.o3de/3rdParty --android-sdk-path $O3DE_ANDROID_SDK_PATH --android-ndk-version $O3DE_ANDROID_NDK_VERSION --android-sdk-platform $O3DE_ANDROID_SDK_API_LEVEL --enable-unity-build --include-apk-assets --asset-mode $O3DE_ANDROID_ASSET_MODE --signconfig-store-file $O3DE_ANDROID_SIGNCONFIG_FILE --signconfig-store-password $O3DE_ANDROID_SIGNCONFIG_STORE_PASSWORD --signconfig-key-alias $O3DE_ANDROID_SIGNCONFIG_KEY_ALIAS --signconfig-key-password $O3DE_ANDROID_SIGNCONFIG_KEY_PASSWORD
  3. Build the Android project: cd $O3DE_BUILD_ROOT/android ./gradlew assembleProfile

Expected behavior Building finishes successfully.

Actual behavior Building fails.

Screenshots/Video Versions

Found in Branch Development (483c154)

Commit ID from o3de/o3de Repository 483c154

Desktop/Device:

Additional context AndroidLinuxError.txt

byrcolin commented 1 year ago

Currently we do not test building android on linux, we test building android on windows. We should look into this, perhaps have a nightly build of android on linux.

byrcolin commented 7 months ago

This is no longer an issue, the android setup was overhauled since this issue was created.