Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bullet PR: Unable to build for Android #12347

Closed
TritiatedWater opened this issue Oct 23, 2017 · 9 comments · Fixed by #12744
Closed

Bullet PR: Unable to build for Android #12347

TritiatedWater opened this issue Oct 23, 2017 · 9 comments · Fixed by #12744

Comments

@TritiatedWater
Copy link
Contributor

Operating system or device, Godot version, GPU Model and driver (if graphics related):
Manjaro Linux 17

Issue description:

Godot with bullet physics won't build for Android on Linux

Steps to reproduce:
git clone https://github.com/godotengine/godot
cd godot

Apply the patch:
wget https://patch-diff.githubusercontent.com/raw/godotengine/godot/pull/10013.patch
git am 10013.patch

Build:
scons platform=android target=release_debug

Logs:
platform=android target=release_debug
scons: Reading SConscript files ...
Building for Android (armv7) (with NEON)
Checking for C header file mntent.h... (cached) yes
scons: done reading SConscript files.
scons: Building targets ...
[Initial build] Compiling shared ==> platform/android/os_android.cpp
[Initial build] Compiling shared ==> platform/android/godot_android.cpp
[Initial build] Compiling shared ==> platform/android/file_access_android.cpp
[Initial build] Compiling shared ==> platform/android/dir_access_android.cpp
[Initial build] Compiling shared ==> platform/android/audio_driver_opensl.cpp
[Initial build] Compiling shared ==> platform/android/file_access_jandroid.cpp
[Initial build] Compiling shared ==> platform/android/dir_access_jandroid.cpp
[Initial build] Compiling shared ==> platform/android/thread_jandroid.cpp
[Initial build] Compiling shared ==> platform/android/audio_driver_jandroid.cpp
[Initial build] Compiling shared ==> platform/android/ifaddrs_android.cpp
[Initial build] Compiling shared ==> platform/android/android_native_app_glue.c
[Initial build] Compiling shared ==> platform/android/java_glue.cpp
[Initial build] Compiling shared ==> platform/android/cpu-features.c
[Initial build] Compiling shared ==> platform/android/java_class_wrapper.cpp
[Initial build] Compiling ==> main/performance.cpp
[Initial build] Compiling ==> main/input_default.cpp
[Initial build] make_app_icon(["main/app_icon.gen.h"], ["main/app_icon.png"])
[Initial build] make_splash(["main/splash.gen.h"], ["main/splash.png"])
[Initial build] Compiling ==> main/main.cpp
[Initial build] Linking Static Library ==> main/libmain.android.opt.debug.armv7.neon.a
Ranlib Library ==> main/libmain.android.opt.debug.armv7.neon.a
[Initial build] Compiling ==> main/tests/test_physics.cpp
[Initial build] Compiling ==> main/tests/test_render.cpp
[Initial build] Compiling ==> main/tests/test_physics_2d.cpp
[Initial build] Compiling ==> main/tests/test_gdscript.cpp
[Initial build] Compiling ==> main/tests/test_shader_lang.cpp
[Initial build] Compiling ==> main/tests/test_gui.cpp
[Initial build] Compiling ==> main/tests/test_ordered_hash_map.cpp
[Initial build] Compiling ==> main/tests/test_io.cpp
[Initial build] Compiling ==> main/tests/test_main.cpp
[Initial build] Compiling ==> main/tests/test_oa_hash_map.cpp
[Initial build] Compiling ==> main/tests/test_string.cpp
[Initial build] Compiling ==> main/tests/test_image.cpp
[Initial build] Compiling ==> main/tests/test_math.cpp
[Initial build] Linking Static Library ==> main/tests/libtests.android.opt.debug.armv7.neon.a
Ranlib Library ==> main/tests/libtests.android.opt.debug.armv7.neon.a
[Initial build] Compiling ==> modules/register_module_types.gen.cpp
[Initial build] Compiling ==> thirdparty/Bullet/src/BulletCollision/BroadphaseCollision/btAxisSweep3.cpp
In file included from thirdparty/Bullet/src/BulletCollision/BroadphaseCollision/btAxisSweep3.cpp:20:
In file included from thirdparty/Bullet/src/BulletCollision/BroadphaseCollision/btAxisSweep3.h:23:
In file included from thirdparty/Bullet/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.h:24:
thirdparty/Bullet/src/LinearMath/btAlignedObjectArray.h:39:10: fatal error:
'new' file not found
#include //for placement new
^~~~~
1 error generated.
scons: *** [thirdparty/Bullet/src/BulletCollision/BroadphaseCollision/btAxisSweep3.android.opt.debug.armv7.neon.o] Error 1
scons: building terminated because of errors.
`

@AndreaCatania
Copy link
Contributor

@volzhs
Copy link
Contributor

volzhs commented Nov 2, 2017

it's more like #11273

@AndreaCatania
Copy link
Contributor

@volzhs Thanks for report.

@SaracenOne @RandomShaper I'm including you in this issue because I saw that you are comfortable with android compilations.

So I found this: https://groups.google.com/forum/#!topic/android-ndk/BKvFNPmjBRs where is said that:

The header was not removed, just moved to sources/cxx-stl/system/include (and the NDK build system will use them by default).
This was done because they conflicted with the GNU libstdc++ headers.

If you use the make-standalone-toolchain.sh script to setup your standalone toolchain, it will automatically copy the GNU libstdc++ headers to its sysroot, and your code should compile easily.

On the other hand, if you're invoking the toolchain binaries directly (i.e. from $NDK/toolchains/arm-linux-androideabi/prebuilt//bin/), then you will have to add the path to the C++ headers
you want. Simply use -I in your compiler flags to do that.

If you want to use the old system headers, use -I$NDK/sources/cxx-stl/system/include
If you want to use STLport, use -I$NDK/sources/cxx-stl/stlport/stlport
If you want to use GNU libstdc++, it's better to generate your own toolchain instead, because this requires at least two directories, depending on the ABI you're targetting.

Linking with STLport / GNU libstdc++ also requires explicit paths.

Very frankly, just use build/tools/make-standalone-toolchain.sh instead and compile everything with it.

Or just use the NDK build system, it will handle the gory details for you.

Regards

Where is the right place where insert this parameter -l/path/to/STL?

@AndreaCatania
Copy link
Contributor

Also @endragor

@AndreaCatania
Copy link
Contributor

I've fixed the problem, just compile by adding this android_stl=true to the Godot compile command, so the command should be something like: scons platform=android target=release_debug android_stl=true

@volzhs This should resolve your problem #11273 too, can you please check it?

@reduz @akien-mga there's a reason why this https://github.com/godotengine/godot/blob/master/platform/android/detect.py#L28 is false by default?

If there isn't any reason I'll make a PR in order to change it

@TritiatedWater
Copy link
Contributor Author

@AndreaCatania adding android_stl=true works...

@RandomShaper
Copy link
Member

Godot is designed not to use the STL. It's available as an option for Android in case you need to build a module that does depend on it, but the standard is to have it disabled.

@AndreaCatania
Copy link
Contributor

Fixed: #12744

@ghost
Copy link

ghost commented Oct 10, 2018

Fixed: #12744

I'm still getting the same error when using scons platform=android

Version: 3.06-stable or 3.0 branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants