SDL2 编译报错error: undefined reference to 'openslES_ResumeDevices' 求解决思路

android studio编译SDL2生成.so文件时,报错如下:

Build command failed.
Error while executing process /Users/ing/sdk/ndk-bundle/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/Android.mk NDK_APPLICATION_MK=/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/Application.mk APP_ABI=x86_64 NDK_ALL_ABIS=x86_64 NDK_DEBUG=1 APP_PLATFORM=android-16 NDK_OUT=/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/build/intermediates/ndkBuild/debug/lib /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/build/intermediates/ndkBuild/debug/obj/local/x86_64/libSDL2.so}
[x86_64] Compile        : SDL2 <= SDL.c
[x86_64] Compile        : SDL2 <= SDL_assert.c
[x86_64] Compile        : SDL2 <= SDL_dataqueue.c
[x86_64] Compile        : SDL2 <= SDL_error.c
[x86_64] Compile        : SDL2 <= SDL_hints.c
[x86_64] Compile        : SDL2 <= SDL_log.c
[x86_64] Compile        : SDL2 <= SDL_audio.c
[x86_64] Compile        : SDL2 <= SDL_audiocvt.c
[x86_64] Compile        : SDL2 <= SDL_audiodev.c
[x86_64] Compile        : SDL2 <= SDL_audiotypecvt.c
[x86_64] Compile        : SDL2 <= SDL_mixer.c
[x86_64] Compile        : SDL2 <= SDL_wave.c
[x86_64] Compile        : SDL2 <= SDL_androidaudio.c
[x86_64] Compile        : SDL2 <= SDL_dummyaudio.c
[x86_64] Compile        : SDL2 <= SDL_atomic.c
[x86_64] Compile        : SDL2 <= SDL_spinlock.c
[x86_64] Compile        : SDL2 <= SDL_android.c
[x86_64] Compile        : SDL2 <= SDL_cpuinfo.c
[x86_64] Compile        : SDL2 <= SDL_dynapi.c
[x86_64] Compile        : SDL2 <= SDL_clipboardevents.c
[x86_64] Compile        : SDL2 <= SDL_displayevents.c
[x86_64] Compile        : SDL2 <= SDL_dropevents.c
[x86_64] Compile        : SDL2 <= SDL_events.c
/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:285:59: warning: format specifies type 'long long' but the argument has type 'SDL_TouchID' (aka 'long') [-Wformat]
        SDL_EVENT_CASE(SDL_FINGERDOWN) PRINT_FINGER_EVENT(event); break;
                                       ~~~~~~~~~~~~~~~~~~~^~~~~~
/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:282:50: note: expanded from macro 'PRINT_FINGER_EVENT'
                (uint) event->tfinger.timestamp, event->tfinger.touchId, \
                                                 ^~~~~~~~~~~~~~~~~~~~~~
/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:285:59: warning: format specifies type 'long long' but the argument has type 'SDL_FingerID' (aka 'long') [-Wformat]
        SDL_EVENT_CASE(SDL_FINGERDOWN) PRINT_FINGER_EVENT(event); break;
                                       ~~~~~~~~~~~~~~~~~~~^~~~~~
/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:283:17: note: expanded from macro 'PRINT_FINGER_EVENT'
                event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, \
                ^~~~~~~~~~~~~~~~~~~~~~~
/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:286:57: warning: format specifies type 'long long' but the argument has type 'SDL_TouchID' (aka 'long') [-Wformat]
        SDL_EVENT_CASE(SDL_FINGERUP) PRINT_FINGER_EVENT(event); break;
                                     ~~~~~~~~~~~~~~~~~~~^~~~~~
/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:282:50: note: expanded from macro 'PRINT_FINGER_EVENT'
                (uint) event->tfinger.timestamp, event->tfinger.touchId, \
                                                 ^~~~~~~~~~~~~~~~~~~~~~
/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:286:57: warning: format specifies type 'long long' but the argument has type 'SDL_FingerID' (aka 'long') [-Wformat]
        SDL_EVENT_CASE(SDL_FINGERUP) PRINT_FINGER_EVENT(event); break;
                                     ~~~~~~~~~~~~~~~~~~~^~~~~~
/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:283:17: note: expanded from macro 'PRINT_FINGER_EVENT'
                event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, \
                ^~~~~~~~~~~~~~~~~~~~~~~
/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:287:61: warning: format specifies type 'long long' but the argument has type 'SDL_TouchID' (aka 'long') [-Wformat]
        SDL_EVENT_CASE(SDL_FINGERMOTION) PRINT_FINGER_EVENT(event); break;
                                         ~~~~~~~~~~~~~~~~~~~^~~~~~
/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:282:50: note: expanded from macro 'PRINT_FINGER_EVENT'
                (uint) event->tfinger.timestamp, event->tfinger.touchId, \
                                                 ^~~~~~~~~~~~~~~~~~~~~~
/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:287:61: warning: format specifies type 'long long' but the argument has type 'SDL_FingerID' (aka 'long') [-Wformat]
        SDL_EVENT_CASE(SDL_FINGERMOTION) PRINT_FINGER_EVENT(event); break;
                                         ~~~~~~~~~~~~~~~~~~~^~~~~~
/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:283:17: note: expanded from macro 'PRINT_FINGER_EVENT'
                event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, \
                ^~~~~~~~~~~~~~~~~~~~~~~
/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:295:62: warning: format specifies type 'long long' but the argument has type 'SDL_TouchID' (aka 'long') [-Wformat]
        SDL_EVENT_CASE(SDL_DOLLARGESTURE) PRINT_DOLLAR_EVENT(event); break;
                                          ~~~~~~~~~~~~~~~~~~~^~~~~~
/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:292:51: note: expanded from macro 'PRINT_DOLLAR_EVENT'
                (uint) event->dgesture.timestamp, event->dgesture.touchId, \
                                                  ^~~~~~~~~~~~~~~~~~~~~~~
/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:295:62: warning: format specifies type 'long long' but the argument has type 'SDL_GestureID' (aka 'long') [-Wformat]
        SDL_EVENT_CASE(SDL_DOLLARGESTURE) PRINT_DOLLAR_EVENT(event); break;
                                          ~~~~~~~~~~~~~~~~~~~^~~~~~
/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:293:17: note: expanded from macro 'PRINT_DOLLAR_EVENT'
                event->dgesture.gestureId, (uint) event->dgesture.numFingers, \
                ^~~~~~~~~~~~~~~~~~~~~~~~~
/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:296:61: warning: format specifies type 'long long' but the argument has type 'SDL_TouchID' (aka 'long') [-Wformat]
        SDL_EVENT_CASE(SDL_DOLLARRECORD) PRINT_DOLLAR_EVENT(event); break;
                                         ~~~~~~~~~~~~~~~~~~~^~~~~~
/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:292:51: note: expanded from macro 'PRINT_DOLLAR_EVENT'
                (uint) event->dgesture.timestamp, event->dgesture.touchId, \
                                                  ^~~~~~~~~~~~~~~~~~~~~~~
/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:296:61: warning: format specifies type 'long long' but the argument has type 'SDL_GestureID' (aka 'long') [-Wformat]
        SDL_EVENT_CASE(SDL_DOLLARRECORD) PRINT_DOLLAR_EVENT(event); break;
                                         ~~~~~~~~~~~~~~~~~~~^~~~~~
/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:293:17: note: expanded from macro 'PRINT_DOLLAR_EVENT'
                event->dgesture.gestureId, (uint) event->dgesture.numFingers, \
                ^~~~~~~~~~~~~~~~~~~~~~~~~
/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:301:51: warning: format specifies type 'long long' but the argument has type 'SDL_TouchID' (aka 'long') [-Wformat]
                (uint) event->mgesture.timestamp, event->mgesture.touchId,
                                                  ^~~~~~~~~~~~~~~~~~~~~~~
11 warnings generated.
[x86_64] Compile        : SDL2 <= SDL_gesture.c
[x86_64] Compile        : SDL2 <= SDL_keyboard.c
[x86_64] Compile        : SDL2 <= SDL_mouse.c
[x86_64] Compile        : SDL2 <= SDL_quit.c
[x86_64] Compile        : SDL2 <= SDL_touch.c
[x86_64] Compile        : SDL2 <= SDL_windowevents.c
[x86_64] Compile        : SDL2 <= SDL_rwops.c
[x86_64] Compile        : SDL2 <= SDL_haptic.c
[x86_64] Compile        : SDL2 <= SDL_syshaptic.c
[x86_64] Compile        : SDL2 <= SDL_gamecontroller.c
[x86_64] Compile        : SDL2 <= SDL_joystick.c
[x86_64] Compile        : SDL2 <= SDL_sysjoystick.c
[x86_64] Compile        : SDL2 <= SDL_hidapi_ps4.c
[x86_64] Compile        : SDL2 <= SDL_hidapi_switch.c
[x86_64] Compile        : SDL2 <= SDL_hidapi_xbox360.c
[x86_64] Compile        : SDL2 <= SDL_hidapi_xboxone.c
[x86_64] Compile        : SDL2 <= SDL_hidapijoystick.c
[x86_64] Compile        : SDL2 <= SDL_sysloadso.c
[x86_64] Compile        : SDL2 <= SDL_power.c
[x86_64] Compile        : SDL2 <= SDL_syspower.c
[x86_64] Compile        : SDL2 <= SDL_sysfilesystem.c
[x86_64] Compile        : SDL2 <= SDL_sensor.c
[x86_64] Compile        : SDL2 <= SDL_androidsensor.c
[x86_64] Compile        : SDL2 <= SDL_d3dmath.c
[x86_64] Compile        : SDL2 <= SDL_render.c
[x86_64] Compile        : SDL2 <= SDL_yuv_sw.c
[x86_64] Compile        : SDL2 <= SDL_render_d3d.c
[x86_64] Compile        : SDL2 <= SDL_shaders_d3d.c
[x86_64] Compile        : SDL2 <= SDL_render_d3d11.c
[x86_64] Compile        : SDL2 <= SDL_shaders_d3d11.c
[x86_64] Compile        : SDL2 <= SDL_render_gl.c
[x86_64] Compile        : SDL2 <= SDL_shaders_gl.c
[x86_64] Compile        : SDL2 <= SDL_render_gles.c
[x86_64] Compile        : SDL2 <= SDL_render_gles2.c
In file included from /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/render/opengles2/SDL_render_gles2.c:273:
/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/render/opengles2/SDL_gles2funcs.h:58:1: warning: incompatible pointer types assigning to 'void (*)(GLuint, GLsizei, const GLchar **, const GLint *)' (aka 'void (*)(unsigned int, int, const char **, const int *)') from 'void (GLuint, GLsizei, const GLchar *const *, const GLint *)' (aka 'void (unsigned int, int, const char *const *, const int *)') [-Wincompatible-pointer-types]
SDL_PROC(void, glShaderSource, (GLuint, GLsizei, const GLchar **, const GLint *))
^              ~~~~~~~~~~~~~~
/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/render/opengles2/SDL_render_gles2.c:262:45: note: expanded from macro 'SDL_PROC'
#define SDL_PROC(ret,func,params) data->func=func;
                                            ^~~~~
1 warning generated.
[x86_64] Compile        : SDL2 <= SDL_shaders_gles2.c
[x86_64] Compile        : SDL2 <= SDL_render_psp.c
[x86_64] Compile        : SDL2 <= SDL_blendfillrect.c
[x86_64] Compile        : SDL2 <= SDL_blendline.c
[x86_64] Compile        : SDL2 <= SDL_blendpoint.c
[x86_64] Compile        : SDL2 <= SDL_drawline.c
[x86_64] Compile        : SDL2 <= SDL_drawpoint.c
[x86_64] Compile        : SDL2 <= SDL_render_sw.c
[x86_64] Compile        : SDL2 <= SDL_rotate.c
[x86_64] Compile        : SDL2 <= SDL_getenv.c
[x86_64] Compile        : SDL2 <= SDL_iconv.c
[x86_64] Compile        : SDL2 <= SDL_malloc.c
[x86_64] Compile        : SDL2 <= SDL_qsort.c
[x86_64] Compile        : SDL2 <= SDL_stdlib.c
[x86_64] Compile        : SDL2 <= SDL_string.c
[x86_64] Compile        : SDL2 <= SDL_thread.c
[x86_64] Compile        : SDL2 <= SDL_syscond.c
[x86_64] Compile        : SDL2 <= SDL_sysmutex.c
[x86_64] Compile        : SDL2 <= SDL_syssem.c
[x86_64] Compile        : SDL2 <= SDL_systhread.c
[x86_64] Compile        : SDL2 <= SDL_systls.c
[x86_64] Compile        : SDL2 <= SDL_timer.c
[x86_64] Compile        : SDL2 <= SDL_systimer.c
[x86_64] Compile        : SDL2 <= SDL_RLEaccel.c
[x86_64] Compile        : SDL2 <= SDL_blit.c
[x86_64] Compile        : SDL2 <= SDL_blit_0.c
[x86_64] Compile        : SDL2 <= SDL_blit_1.c
[x86_64] Compile        : SDL2 <= SDL_blit_A.c
[x86_64] Compile        : SDL2 <= SDL_blit_N.c
[x86_64] Compile        : SDL2 <= SDL_blit_auto.c
[x86_64] Compile        : SDL2 <= SDL_blit_copy.c
[x86_64] Compile        : SDL2 <= SDL_blit_slow.c
[x86_64] Compile        : SDL2 <= SDL_bmp.c
[x86_64] Compile        : SDL2 <= SDL_clipboard.c
[x86_64] Compile        : SDL2 <= SDL_egl.c
[x86_64] Compile        : SDL2 <= SDL_fillrect.c
[x86_64] Compile        : SDL2 <= SDL_pixels.c
[x86_64] Compile        : SDL2 <= SDL_rect.c
[x86_64] Compile        : SDL2 <= SDL_shape.c
[x86_64] Compile        : SDL2 <= SDL_stretch.c
[x86_64] Compile        : SDL2 <= SDL_surface.c
[x86_64] Compile        : SDL2 <= SDL_video.c
[x86_64] Compile        : SDL2 <= SDL_vulkan_utils.c
[x86_64] Compile        : SDL2 <= SDL_yuv.c
[x86_64] Compile        : SDL2 <= SDL_androidclipboard.c
[x86_64] Compile        : SDL2 <= SDL_androidevents.c
[x86_64] Compile        : SDL2 <= SDL_androidgl.c
[x86_64] Compile        : SDL2 <= SDL_androidkeyboard.c
[x86_64] Compile        : SDL2 <= SDL_androidmessagebox.c
[x86_64] Compile        : SDL2 <= SDL_androidmouse.c
[x86_64] Compile        : SDL2 <= SDL_androidtouch.c
[x86_64] Compile        : SDL2 <= SDL_androidvideo.c
[x86_64] Compile        : SDL2 <= SDL_androidvulkan.c
[x86_64] Compile        : SDL2 <= SDL_androidwindow.c
[x86_64] Compile        : SDL2 <= yuv_rgb.c
[x86_64] Compile        : SDL2 <= SDL_test_assert.c
[x86_64] Compile        : SDL2 <= SDL_test_common.c
[x86_64] Compile        : SDL2 <= SDL_test_compare.c
[x86_64] Compile        : SDL2 <= SDL_test_crc32.c
[x86_64] Compile        : SDL2 <= SDL_test_font.c
[x86_64] Compile        : SDL2 <= SDL_test_fuzzer.c
[x86_64] Compile        : SDL2 <= SDL_test_harness.c
[x86_64] Compile        : SDL2 <= SDL_test_imageBlit.c
[x86_64] Compile        : SDL2 <= SDL_test_imageBlitBlend.c
[x86_64] Compile        : SDL2 <= SDL_test_imageFace.c
[x86_64] Compile        : SDL2 <= SDL_test_imagePrimitives.c
[x86_64] Compile        : SDL2 <= SDL_test_imagePrimitivesBlend.c
[x86_64] Compile        : SDL2 <= SDL_test_log.c
[x86_64] Compile        : SDL2 <= SDL_test_md5.c
[x86_64] Compile        : SDL2 <= SDL_test_memory.c
[x86_64] Compile        : SDL2 <= SDL_test_random.c
[x86_64] Compile++      : hidapi <= hid.cpp
[x86_64] Prebuilt       : libc++_shared.so <= <NDK>/sources/cxx-stl/llvm-libc++/libs/x86_64/
[x86_64] SharedLibrary  : libhidapi.so
[x86_64] SharedLibrary  : libSDL2.so
/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/build/intermediates/ndkBuild/debug/obj/local/x86_64/objs-debug/SDL2/src/audio/SDL_audio.o:SDL_audio.c:bootstrap: error: undefined reference to 'openslES_bootstrap'
/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/video/android/SDL_androidevents.c:105: error: undefined reference to 'openslES_PauseDevices'
/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/video/android/SDL_androidevents.c:112: error: undefined reference to 'openslES_ResumeDevices'
/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/video/android/SDL_androidevents.c:156: error: undefined reference to 'openslES_PauseDevices'
/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/video/android/SDL_androidevents.c:167: error: undefined reference to 'openslES_ResumeDevices'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/build/intermediates/ndkBuild/debug/obj/local/x86_64/libSDL2.so] Error 1



感觉是调用opengl 的相关库时报错,未引用。请教有遇到过此类问题的或者有解决思路的,请不吝赐教。。

2个回答

你的函数只定义了,没有具体实现过程!
解决方法:
查看库文件是否齐全
检查动态、静态库连接是否有问题
如果都没有问题,联系你库的开发者(一般有网站),应该回有解决方法

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!