Extension building errors in android

Hello,

I’ve been trying to understand how to build a native extension for Android. So far, I’ve only been able to build an application with the VideoPlayer extension added. However, any change I make to the .cpp file creates an error with the description:

"arm-linux-androideabi-ar rcs /var/extender/builds/build7226284688527467840/lib218f749f-96af-4dbd-acf1-4dd982e2ac25.a "

Even adding an empty line to a function in the .cpp generates this error. I also get this error with the example extension in the manuals.

Could you right click on that error and paste it here? There should be a more detailed error log returned, but the editor does not currently display it fully in the error-panel.

1 Like

The copied description is:

Description Resource Path Location Type
arm-linux-androideabi-ar rcs /var/extender/builds/build420198880997474392/libe6d20738-7dc4-40cb-954c-5004309b02b6.a

arm-linux-androideabi-g++ -c -g -gdwarf-2 -fpic -ffunction-sections -fstack-protector -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -fno-exceptions -funwind-tables --sysroot=/opt/android/android-ndk-r10e/platforms/android-14/arch-arm -DANDROID -Wa,–noexecstack -DDM_PLATFORM_ANDROID -DLUA_BYTECODE_ENABLE -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -I/var/extender/sdk/0d7f8b51658bee90cb38f3d651b3ba072394afed/defoldsdk/include -I/var/extender/sdk/0d7f8b51658bee90cb38f3d651b3ba072394afed/defoldsdk/sdk/include -I/opt/android/android-ndk-r10e/sources/android/native_app_glue -I/opt/android/android-ndk-r10e/sources/android/cpufeatures -I/opt/android/tmp/android-ndk-r10e/platforms/android-14/arch-arm/usr/include -I/opt/android/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.8/include -I/opt/android/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include /var/extender/builds/build420198880997474392/main.cpp -o/var/extender/builds/build420198880997474392/main_tmp0574f0ca-5afb-46a2-8432-6c3af8e12681.o

arm-linux-androideabi-g++ --sysroot=/opt/android/android-ndk-r10e/platforms/android-14/arch-arm -lEGL -lGLESv1_CM -lGLESv2 /var/extender/builds/build420198880997474392/main_tmp0574f0ca-5afb-46a2-8432-6c3af8e12681.o -o /var/extender/builds/build420198880997474392/libdmengine.so -Wl,-soname=libdmengine.so -DDM_PLATFORM_ANDROID -DLUA_BYTECODE_ENABLE -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -Wl,–fix-cortex-a8 -Wl,–no-undefined -Wl,-z,noexecstack -landroid -fpic -z text -L/var/extender/builds/build420198880997474392 -Wl,-Bstatic -le6d20738-7dc4-40cb-954c-5004309b02b6 -L/var/extender/sdk/0d7f8b51658bee90cb38f3d651b3ba072394afed/defoldsdk/lib/armv7-android -L/var/extender/sdk/0d7f8b51658bee90cb38f3d651b3ba072394afed/defoldsdk/ext/lib/armv7-android -L/opt/android/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a -Wl,-Bstatic -lengine -lwebviewext -ladtruthext -lfacebookext -liapext -lpushext -liacext -lrecord_null -lgameobject -lddf -lresource -lgamesys -lgraphics -lphysics -lBulletDynamics -lBulletCollision -lLinearMath -lBox2D -lrender -lscript -lluajit-5.1 -lextension -lhid -linput -lparticle -lrig -ldlib -ldmglfw -lgui -ltracking -lcrashext -lsound -lopenal_soft -ltremolo -lliveupdate -Wl,-Bdynamic -lOpenSLES -lgnustl_static -lm -llog -lc -Wl,–no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -shared
/var/extender/builds/build420198880997474392/main.cpp:27: error: undefined reference to 'MyExtension’
collect2: error: ld returned 1 exit status

ext.manifest	/cleanTests/content/myextension	line 1	Problem

The log actually tells you the error, even if it might be a bit lost in all the output:
/var/extender/builds/build420198880997474392/main.cpp:27: error: undefined reference to 'MyExtension'

:slight_smile:

What is the name of the extension as written in your ext.manifest file?

The manifest only contains

name: “MyExtension”

The code should be fine since I just copied it as is from the manual.

Ahhh I see, super strange! Could you try adding me to the project so I could give it a try? Add my work email: sven.andersson at king.com

Done! The project is called “cleanTests”

I was able to build it right after I checked out the project, for both OSX and Android. What platform are you running the editor on?

Thats pretty weird, I’m running the editor on Windows 10 and bundling the project for Android.

I’ll give it a try on a Windows machine as well.

Interesting, I get the same error as you when I run it on Windows. I suspect this might have something to do with the issue @Mathias_Westerdahl is currently working on, will talk to him. Thanks for reporting the issue, we will look into it!

4 Likes

I see, didn’t know whether I was doing something wrong. Hopefully it will be figured out soon, thanks for the help!

4 Likes