Coder Social home page Coder Social logo

Comments (4)

protoman avatar protoman commented on July 29, 2024

In case someone else is facing this issue,, I got the build moving ahead by adding the following lines to each command that failed (I do not know how to fix the build scripts themselves):
./obj/local/x86/libfreetype.a
./obj/local/x86/libharfbuzz.a
./obj/local/x86/libfreetype.a \

Now I am facing another issue:
/media/iuri/SamsungEXT4/development/SDK/Android/Sdk/android-ndk-r20/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -Wl,-soname,libsdl_main.so -shared ./obj/local/x86/objs/sdl_main/sdl_main.o ./obj/local/x86/libfreetype.a ./obj/local/x86/libharfbuzz.a ./obj/local/x86/libfreetype.a -lgcc -Wl,--exclude-libs,libgcc.a -latomic -Wl,--exclude-libs,libatomic.a ./obj/local/x86/libsdl-1.2.so ./obj/local/x86/libapplication.so -target i686-none-linux-android21 -no-canonical-prefixes -Wl,--exclude-libs,libgcc.a -Wl,--build-id -nostdlib++ -Wl,--no-undefined -Wl,-z,noexecstack -Wl,--warn-shared-textrel -Wl,--fatal-warnings -llog -lc -lm -o ./obj/local/x86/libsdl_main.so
jni/../jni/sdl_main/sdl_main.c:135: error: undefined reference to 'SDL_main'
jni/../jni/sdl_main/sdl_main.c:59: error: undefined reference to 'SDL_main'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

from commandergenius.

pelya avatar pelya commented on July 29, 2024

from commandergenius.

protoman avatar protoman commented on July 29, 2024

Yeah, I know, but this error seems to happen well before it reaches my own code,, ut is on the SDL_main lib itself. But no worries, I'll keep trying until I get it working, or cherry pick an older commit.

from commandergenius.

protoman avatar protoman commented on July 29, 2024

All right, I took a bit of time and got my build working, but I did need some changes I will describe here so anyone in the future can find it.
I had to use -lc++ for the linker in my project, otherwise it would faild due to not finding ndk C++ classes like string and vector. In build.sh, I added the following to copy the lib from NDK to the app, after line ./copyAssets.sh:

pushd project &&
echo "### COPY LIBSTDC++ ###" &&
cp ${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/libc++_shared.so ./libs/armeabi-v7a/ &&
cp ${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so ./libs/arm64-v8a/ &&
cp ${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/x86_64-linux-android/libc++_shared.so ./libs/x86_64/ &&
cp ${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/i686-linux-android/libc++_shared.so ./project/libs/x86/ && \

Also, the linker was breaking due to the harfbuzz, as previous stated, so I went into sdl_ttf/Android.mk and added it like this, LOCAL_STATIC_LIBRARIES := freetype harfbuzz, and also added it to my AndroidAppSettings.cfg both in CompiledLibraries and AppLdflags.

By looking at the logcat, when running the app, I found an error of it missing libmikmod.so, as the project was building it as static. While it did not crash due to that error, I found better to change it to shared, so in mikmod/Android.mk I used:

LOCAL_LDLIBS :=
include $(BUILD_STATIC_LIBRARY)

And in mikmod/mdreg.c I had to comment out line //_mm_registerdriver(&drv_raw);
And then, I moved the mikmod to shared in libsdl_mixer/Android.mk:

LOCAL_SHARED_LIBRARIES := sdl-1.2 mikmod
LOCAL_STATIC_LIBRARIES := flac

Sadly that still did not fix the audio issues playing mod files give in some devices.

With those changes, I was able to finally build my game again with latest version.
Once I have a bit of free time, I'll make separate MRs for harbuzz and mikmod fixes.

from commandergenius.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.