0

I am trying to tweak the tutorial, Android NDK Endless-Tunnel in Android Studio.

https://github.com/googlesamples/android-ndk/tree/master/endless-tunnel/app/src/main/cpp

It worked great until i needed to use 'glBindVertexArray'/'glGenVertexArrays' and switched from GLESv2 to GLESv3.

Build command failed.
Error while executing process /root/Android/Sdk/cmake/3.6.4111459/bin/cmake with arguments {--build /pathx/app/.externalNativeBuild/cmake/debug/x86 --target game}
[1/1] Linking CXX shared library /pathx/app/build/intermediates/cmake/debug/obj/x86/libgame.so
FAILED: : && /root/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++  --target=i686-none-linux-android16 --gcc-toolchain=/root/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64 -fPIC --sysroot /root/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mstackrealign -fno-addrsig -Wa,--noexecstack -Wformat -Werror=format-security -stdlib=libc++  -std=gnu++11 -Wall -O0 -fno-limit-debug-info  -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a -static-libstdc++ -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--no-undefined -Qunused-arguments -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now  -u ANativeActivity_onCreate -shared -Wl,-soname,libgame.so -o /pathx/app/build/intermediates/cmake/debug/obj/x86/libgame.so CMakeFiles/game.dir/android_main.cpp.o CMakeFiles/game.dir/anim.cpp.o CMakeFiles/game.dir/ascii_to_geom.cpp.o CMakeFiles/game.dir/dialog_scene.cpp.o CMakeFiles/game.dir/indexbuf.cpp.o CMakeFiles/game.dir/input_util.cpp.o CMakeFiles/game.dir/jni_util.cpp.o CMakeFiles/game.dir/native_engine.cpp.o CMakeFiles/game.dir/obstacle.cpp.o CMakeFiles/game.dir/obstacle_generator.cpp.o CMakeFiles/game.dir/our_shader.cpp.o CMakeFiles/game.dir/play_scene.cpp.o CMakeFiles/game.dir/scene.cpp.o CMakeFiles/game.dir/scene_manager.cpp.o CMakeFiles/game.dir/sfxman.cpp.o CMakeFiles/game.dir/shader.cpp.o CMakeFiles/game.dir/shape_renderer.cpp.o CMakeFiles/game.dir/tex_quad.cpp.o CMakeFiles/game.dir/text_renderer.cpp.o CMakeFiles/game.dir/texture.cpp.o CMakeFiles/game.dir/ui_scene.cpp.o CMakeFiles/game.dir/util.cpp.o CMakeFiles/game.dir/vertexbuf.cpp.o CMakeFiles/game.dir/welcome_scene.cpp.o  -landroid libnative_app_glue.a -latomic -lEGL -lGLESv3 glm/libglm.a -llog -lOpenSLES -latomic -lm && :
/root/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin/ld: error: cannot find -lGLESv3
/pathx/app/src/main/cpp/android_main.cpp:147: error: undefined reference to 'glUseProgram'
/pathx/app/src/main/cpp/android_main.cpp:148: error: undefined reference to 'glUniformMatrix4fv'
/pathx/app/src/main/cpp/android_main.cpp:149: error: undefined reference to 'glUniformMatrix4fv'
/pathx/app/src/main/cpp/android_main.cpp:154: error: undefined reference to 'glClearColor'
/pathx/app/src/main/cpp/android_main.cpp:155: error: undefined reference to 'glClear'
/pathx/app/src/main/cpp/android_main.cpp:157: error: undefined reference to 'glBindVertexArray'
Zoe
  • 27,060
  • 21
  • 118
  • 148
Sadern Alwis
  • 104
  • 1
  • 4
  • 17
  • @Zoe possibly. but that answer is as vague as one could be. it has listed all the possible linker errors for generic c++ programming. – Sadern Alwis Mar 01 '19 at 17:08
  • Either way, you'll need to create a [mcve] - in the meanwhile, I'll leave my close vote. – Zoe Mar 01 '19 at 17:08
  • Fixed by changing the minimum SDK to 21. As found in [https://stackoverflow.com/questions/42239927/android-studio-ndk-error-couldnt-find-gles3-gl3-h-although-it-exist][1] – Sadern Alwis Mar 01 '19 at 17:34
  • 1
    I think you need to bump up the miniSDK version in https://github.com/googlesamples/android-ndk/blob/master/endless-tunnel/app/build.gradle#L24 . to above 18: GLESv3 is not available on older platforms. – Gerry Mar 01 '19 at 19:13
  • @Gerry understood. Thank you. – Sadern Alwis Mar 02 '19 at 07:08

0 Answers0