1

When I try to build my project, I get errors now. I didn't change a thing and I was under the impression, that it did build a few years ago. Can you please assist?

The error message is:

C/C++: ld: error: C:\Users\gf\Downloads\android-project\app\build\intermediates\cxx\Debug\14s2b4rb/obj/local/arm64-v8a/objs-debug/main/glbasic/glb-full.o: unable to find library from dependent library specifier: SDL.lib
C/C++: ld: error: C:\Users\gf\Downloads\android-project\app\build\intermediates\cxx\Debug\14s2b4rb/obj/local/arm64-v8a/objs-debug/main/glbasic/glb-full.o: unable to find library from dependent library specifier: SDL_mixer.lib
C/C++: ld: error: C:\Users\gf\Downloads\android-project\app\build\intermediates\cxx\Debug\14s2b4rb/obj/local/arm64-v8a/objs-debug/main/glbasic/glb-full.o: unable to find library from dependent library specifier: SDLmain.lib
C/C++: ld: error: C:\Users\gf\Downloads\android-project\app\build\intermediates\cxx\Debug\14s2b4rb/obj/local/arm64-v8a/objs-debug/main/glbasic/glb-full.o: unable to find library from dependent library specifier: SDL_mixer.lib
C/C++: clang++: error: linker command failed with exit code 1 (use -v to see invocation)
C/C++: make: *** [C:/Users/gf/AppData/Local/Android/Sdk/ndk/23.1.7779620/build//../build/core/build-binary.mk:715: C:\Users\gf\Downloads\android-project\app\build\intermediates\cxx\Debug\14s2b4rb/obj/local/arm64-v8a/libmain.so] Error 1
C/C++: ld: error: C:\Users\gf\Downloads\android-project\app\build\intermediates\cxx\Debug\14s2b4rb/obj/local/arm64-v8a/objs-debug/main/glbasic/glb-full.o: unable to find library from dependent library specifier: SDL_mixer.lib


> Task :app:buildNdkBuildDebug[arm64-v8a] FAILED

You can find the project at: https://www.glbasic.com/beta/twintris_as.zip

** UPDATE ** I changed the project and it is building, now. However, once I upgrade from gardle 7.2.2 to 7.3.0 or higher, I get the linker errors.

KungPhoo
  • 516
  • 4
  • 18

2 Answers2

1

I was able to compile your project by adding this line. Inside the 'build.gradle' file related to the 'app'

Inside the 'externalNativeBuild' scope Add this line like this:

externalNativeBuild {
    ndkBuild {
        cppFlags += "-DGLB_CONSOLE"
        ...
    }
}
  • Thank you for your help. Well, that removes all the graphics commands etc. and removes any dependency from libSDL. But that's exactly my problem. I can't link the SDL libraries. It seems, they get built, but not linked. – KungPhoo Feb 28 '23 at 12:43
  • Hi, thanks. One of the ways ahead of you is to cross-compile the library using the NDK. But I will introduce you to a link that explains very well and clearly how to use SDL. https://wiki.libsdl.org/SDL2/Android – Meghdad Jokar Mar 01 '23 at 13:19
0

It appears as if you need to tell the compiler where to find the SDL libraries. You could follow the advice here: Linking errors with SDL_mixer library

You want to make sure those lib libraries are in a place the compiler can find as well.

Shaun Ramsey
  • 562
  • 4
  • 14
  • Yes. But the project builds with "gradle" and I have little to no knowledge where to put what. – KungPhoo Feb 27 '23 at 06:19
  • try adding the sdl lib locations to your environment variable's PATH. In windows you can just search for env variable to find that location. Make sure it is PATH you're updating. – Shaun Ramsey Feb 27 '23 at 17:58