Error occured when compiling export template for android

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By att2018

I cloned the latest engine code and compile it with following command:

scons platform=android target=release

but failed, the compile log is

    In file included from core/hashfuncs.h:35:
In file included from core/math/math_funcs.h:40:
/Users/att/Work/SDK/Android/android-ndk-r13b/sources/cxx-stl/llvm-libc++/include/math.h:661:91: error: 
      use of undeclared identifier 'acosl'
  ...long double acos(long double __lcpp_x) _NOEXCEPT {return acosl(__lcpp_x);}
                                                              ^
/Users/att/Work/SDK/Android/android-ndk-r13b/sources/cxx-stl/llvm-libc++/include/math.h:673:91: error: 
      use of undeclared identifier 'asinl'
  ...long double asin(long double __lcpp_x) _NOEXCEPT {return asinl(__lcpp_x);}
                                                              ^
/Users/att/Work/SDK/Android/android-ndk-r13b/sources/cxx-stl/llvm-libc++/include/math.h:685:91: error: 
      use of undeclared identifier 'atanl'
  ...long double atan(long double __lcpp_x) _NOEXCEPT {return atanl(__lcpp_x);}
                                                              ^
/Users/att/Work/SDK/Android/android-ndk-r13b/sources/cxx-stl/llvm-libc++/include/math.h:697:114: error: 
      use of undeclared identifier 'atan2l'
  ...double __lcpp_y, long double __lcpp_x) _NOEXCEPT {return atan2l(__lcpp_y...
                                                              ^
/Users/att/Work/SDK/Android/android-ndk-r13b/sources/cxx-stl/llvm-libc++/include/math.h:732:90: error: 
      use of undeclared identifier 'cosl'
  ...long double cos(long double __lcpp_x) _NOEXCEPT {return cosl(__lcpp_x);}
                                                             ^
/Users/att/Work/SDK/Android/android-ndk-r13b/sources/cxx-stl/llvm-libc++/include/math.h:744:91: error: 
      use of undeclared identifier 'coshl'
  ...long double cosh(long double __lcpp_x) _NOEXCEPT {return coshl(__lcpp_x);}
                                                              ^
/Users/att/Work/SDK/Android/android-ndk-r13b/sources/cxx-stl/llvm-libc++/include/math.h:756:90: error: 
      use of undeclared identifier 'expl'
  ...long double exp(long double __lcpp_x) _NOEXCEPT {return expl(__lcpp_x);}
                                                             ^
/Users/att/Work/SDK/Android/android-ndk-r13b/sources/cxx-stl/llvm-libc++/include/math.h:792:113: error: 
      use of undeclared identifier 'fmodl'
  ...double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fmodl(__lcpp_x...
                                                              ^
/Users/att/Work/SDK/Android/android-ndk-r13b/sources/cxx-stl/llvm-libc++/include/math.h:839:90: error: 
      use of undeclared identifier 'logl'
  ...long double log(long double __lcpp_x) _NOEXCEPT {return logl(__lcpp_x);}
                                                             ^
/Users/att/Work/SDK/Android/android-ndk-r13b/sources/cxx-stl/llvm-libc++/include/math.h:851:92: error: 
      use of undeclared identifier 'log10l'
  ...long double log10(long double __lcpp_x) _NOEXCEPT {return log10l(__lcpp_...
                                                               ^
/Users/att/Work/SDK/Android/android-ndk-r13b/sources/cxx-stl/llvm-libc++/include/math.h:863:114: error: 
      use of undeclared identifier 'modfl'
  ...double __lcpp_x, long double* __lcpp_y) _NOEXCEPT {return modfl(__lcpp_x...
                                                               ^
/Users/att/Work/SDK/Android/android-ndk-r13b/sources/cxx-stl/llvm-libc++/include/math.h:870:112: error: 
      use of undeclared identifier 'powl'
  ...double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return powl(__lcpp_x, ...
                                                              ^
/Users/att/Work/SDK/Android/android-ndk-r13b/sources/cxx-stl/llvm-libc++/include/math.h:893:90: error: 
      use of undeclared identifier 'sinl'
  ...long double sin(long double __lcpp_x) _NOEXCEPT {return sinl(__lcpp_x);}
                                                             ^
/Users/att/Work/SDK/Android/android-ndk-r13b/sources/cxx-stl/llvm-libc++/include/math.h:905:91: error: 
      use of undeclared identifier 'sinhl'
  ...long double sinh(long double __lcpp_x) _NOEXCEPT {return sinhl(__lcpp_x);}
                                                              ^
/Users/att/Work/SDK/Android/android-ndk-r13b/sources/cxx-stl/llvm-libc++/include/math.h:917:91: error: 
      use of undeclared identifier 'sqrtl'
  ...long double sqrt(long double __lcpp_x) _NOEXCEPT {return sqrtl(__lcpp_x);}
                                                              ^
/Users/att/Work/SDK/Android/android-ndk-r13b/sources/cxx-stl/llvm-libc++/include/math.h:931:90: error: 
      use of undeclared identifier 'tanl'
  ...long double tan(long double __lcpp_x) _NOEXCEPT {return tanl(__lcpp_x);}
                                                             ^
/Users/att/Work/SDK/Android/android-ndk-r13b/sources/cxx-stl/llvm-libc++/include/math.h:943:91: error: 
      use of undeclared identifier 'tanhl'
  ...long double tanh(long double __lcpp_x) _NOEXCEPT {return tanhl(__lcpp_x);}
                                                              ^
/Users/att/Work/SDK/Android/android-ndk-r13b/sources/cxx-stl/llvm-libc++/include/math.h:955:92: error: 
      use of undeclared identifier 'acoshl'
  ...long double acosh(long double __lcpp_x) _NOEXCEPT {return acoshl(__lcpp_...
                                                               ^
/Users/att/Work/SDK/Android/android-ndk-r13b/sources/cxx-stl/llvm-libc++/include/math.h:967:92: error: 
      use of undeclared identifier 'asinhl'
  ...long double asinh(long double __lcpp_x) _NOEXCEPT {return asinhl(__lcpp_...
                                                               ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

Please help!

I get a very similar error, please see below. Please take a look at the compiler switches and tool chain.

Android NDK = Pkg.Revision = 18.1.506304

scons --debug=presub platform=android target=debug verbose=true
I get the same error with:
scons --debug=presub platform=android target=debug android_stl=true verbose=true

scons: Reading SConscript files …
Building for Android (armv7) (with NEON)
Using NDK unified headers
Checking for C header file mntent.h… (cached) yes
scons: done reading SConscript files.
scons: Building targets …
[ 24%] Building thirdparty/bullet/BulletInverseDynamics/IDMath.android.debug.armv7.neon.o with action:
$CXX -o $TARGET -c $CXXFLAGS $CCFLAGS $_CCCOMCOM $SOURCES

/home/stewart/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -o thirdparty/bullet/BulletInverseDynamics/IDMath.android.debug.armv7.neon.o -c -frtti -std=gnu++14 -w -Werror=return-type -DZSTD_STATIC_LINKING_ONLY -DDEBUG_MEMORY_ALLOC -DSCI_NAMESPACE -O0 -D_DEBUG -UNDEBUG -DDEBUG_ENABLED -DDEBUG_MEMORY_ENABLED -g -fno-limit-debug-info -isystem /home/stewart/Android/Sdk/ndk-bundle/sysroot/usr/include -isystem /home/stewart/Android/Sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi -D__ANDROID_API__=18 -fpic -ffunction-sections -funwind-tables -fstack-protector-strong -fvisibility=hidden -fno-strict-aliasing -DNO_STATVFS -DGLES_ENABLED -D__ARM_ARCH_7__ -D__ARM_ARCH_7A__ -march=armv7-a -mfloat-abi=softfp -mfpu=neon -D__ARM_NEON__ -target armv7-none-linux-androideabi -fno-integrated-as -gcc-toolchain /home/stewart/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 -isystem /home/stewart/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include -isystem /home/stewart/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++abi/include -DANDROID_ENABLED -DUNIX_ENABLED -DNO_FCNTL -DMPC_FIXED_POINT -DPTRCALL_ENABLED -DGDSCRIPT_ENABLED -DMINIZIP_ENABLED -DXML_ENABLED -DMODULE_BULLET_ENABLED -Icore -Icore/math -Ieditor -Idrivers -I. -Iplatform/android -Ithirdparty/zstd -Ithirdparty/zstd/common -Ithirdparty/zlib -Ithirdparty/bullet thirdparty/bullet/BulletInverseDynamics/IDMath.cpp

In file included from thirdparty/bullet/BulletInverseDynamics/IDMath.cpp:3:
/home/stewart/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/cmath:313:9: error: no member named ‘signbit’ in the global namespace
using ::signbit;

StewartNJohnston | 2018-10-17 10:33

I also just tried NDK = android-ndk-r13b = r13b and get a very similar error (see below error).

However when I build for X11 the build works well with no errors.

scons --debug=presub platform=android target=debug android_stl=true verbose=true

/home/stewart/Android/Sdk/android-ndk-r13b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -o thirdparty/bullet/BulletInverseDynamics/IDMath.android.debug.armv7.neon.o -c -frtti -std=gnu++14 -w -Werror=return-type -DZSTD_STATIC_LINKING_ONLY -DDEBUG_MEMORY_ALLOC -DSCI_NAMESPACE -O0 -D_DEBUG -UNDEBUG -DDEBUG_ENABLED -DDEBUG_MEMORY_ENABLED -g -fno-limit-debug-info -isystem /home/stewart/Android/Sdk/android-ndk-r13b/platforms/android-18/arch-arm/usr/include -fpic -ffunction-sections -funwind-tables -fstack-protector-strong -fvisibility=hidden -fno-strict-aliasing -DNO_STATVFS -DGLES_ENABLED -D__ARM_ARCH_7__ -D__ARM_ARCH_7A__ -march=armv7-a -mfloat-abi=softfp -mfpu=neon -D__ARM_NEON__ -target armv7-none-linux-androideabi -fno-integrated-as -gcc-toolchain /home/stewart/Android/Sdk/android-ndk-r13b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 -isystem /home/stewart/Android/Sdk/android-ndk-r13b/sources/cxx-stl/llvm-libc++/include -isystem /home/stewart/Android/Sdk/android-ndk-r13b/sources/cxx-stl/llvm-libc++abi/include -DANDROID_ENABLED -DUNIX_ENABLED -DNO_FCNTL -DMPC_FIXED_POINT -DPTRCALL_ENABLED -DGDSCRIPT_ENABLED -DMINIZIP_ENABLED -DXML_ENABLED -DMODULE_BULLET_ENABLED -Icore -Icore/math -Ieditor -Idrivers -I. -Iplatform/android -Ithirdparty/zstd -Ithirdparty/zstd/common -Ithirdparty/zlib -Ithirdparty/bullet thirdparty/bullet/BulletInverseDynamics/IDMath.cpp
In file included from thirdparty/bullet/BulletInverseDynamics/IDMath.cpp:1:
In file included from thirdparty/bullet/BulletInverseDynamics/IDMath.hpp:6:
In file included from thirdparty/bullet/BulletInverseDynamics/IDConfig.hpp:105:
In file included from thirdparty/bullet/BulletInverseDynamics/details/IDLinearMathInterface.hpp:4:
/home/stewart/Android/Sdk/android-ndk-r13b/sources/cxx-stl/llvm-libc++/include/cstdlib:108:9: error: no member named ‘strtold’ in the global namespace
using ::strtold;
~~^
/home/stewart/Android/Sdk/android-ndk-r13b/sources/cxx-stl/llvm-libc++/include/cstdlib:126:9: error: no member named ‘_Exit’ in the global namespace
using ::_Exit;

StewartNJohnston | 2018-10-17 10:32

:bust_in_silhouette: Reply From: StewartNJohnston

I have resolved my above issue.

My change was that I am no longer compiling with “godot-3.0.6-stable” I using using the latest godot source from the main git trunk.

This is the environment that worked:

  • build machine Ubuntu 16.04
  • env variables:
    export NDK_TARGET=arm-linux-androideabi-4.9 (I’m not sure if this has anything to do with success)
    export ANDROID_HOME=/home/stewart/Android/Sdk
    export J2SDKDIR=/usr/lib/jvm/java-8-oracle
    export ANDROID_NDK_ROOT=/home/stewart/Android/Sdk/ndk-bundle

Where Android NDK = Pkg.Revision = 18.1.506304

My Godot source code is the latest from: " GitHub - godotengine/godot: Godot Engine – Multi-platform 2D and 3D game engine"

Build command:
scons --debug=presub platform=android target=debug android_stl=true verbose=true

which resulted in the following compiler switches:

/home/stewart/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++
-o core/string_db.android.debug.armv7.neon.o
-c
-frtti
-std=gnu++14
-Wall
-Wno-sign-compare
-Werror=return-type
-DZSTD_STATIC_LINKING_ONLY
-DFREETYPE_ENABLED
-DSVG_ENABLED
-O0
-D_DEBUG
-UNDEBUG
-DDEBUG_ENABLED
-DDEBUG_MEMORY_ENABLED
-g
-fno-limit-debug-info
-isystem /home/stewart/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include
-isystem /home/stewart/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++abi/include
–sysroot=/home/stewart/Android/Sdk/ndk-bundle/sysroot
-isystem /home/stewart/Android/Sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi
-isystem /home/stewart/Android/Sdk/ndk-bundle/sources/android/support/include
-D__ANDROID_API__=18
-fpic
-ffunction-sections
-funwind-tables
-fstack-protector-strong
-fvisibility=hidden
-fno-strict-aliasing
-DNO_STATVFS
-DGLES_ENABLED
-D__ARM_ARCH_7__
-D__ARM_ARCH_7A__
-march=armv7-a
-mfloat-abi=softfp
-mfpu=neon
-D__ARM_NEON__
-target armv7-none-linux-androideabi
-fno-integrated-as-gcc-toolchain /home/stewart/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64
-DANDROID_ENABLED
-DUNIX_ENABLED
-DNO_FCNTL
-DMPC_FIXED_POINT
-DDEBUG_MEMORY_ALLOC
-DDISABLE_FORCED_INLINE
-DPTRCALL_ENABLED
-DGDSCRIPT_ENABLED
-DMINIZIP_ENABLED
-DHAVE_MNTENT -Ieditor
-I.
-Iplatform/android
-Ithirdparty/zlib
-Ithirdparty/zstd
-Ithirdparty/libpng
-Ithirdparty/freetype/include
-Ithirdparty/nanosvg core/string_db.cpp