Hi, Guys,
I compiled a shared object using mali GPU. But when linking it to produce an application I got an error:.../libGLES_mali.so:unknown CPU architecture.The CFLAGES is -mcpu=cortex-a15 -O2.
What's wrong? I need some help.
Best Regards!
I use a cross-compiled version gcc(arm-linux-androideabi-gcc) on both of the building and link stage. Some code of makefile as follows:
building phase:
= -mcpu=cortex-a15 -O2
....
LIBS += -lGLES_mali
MKDIRPATH = c:/cygwin/bin/
link phase:
NDK_PREFIX := $(NDK_BASE)/toolchains/arm-linux-androideabi-4.9/prebuilt/windows/bin/arm-linux-androideabi-
CC := $(NDK_PREFIX)gcc
test:$(OBJECTS)
Thanks,
Phenix
Hi Phenix,
Just to be clear, you're using the Android toolchains, but not the NDK build system itself? I.e. you don't have an Android.mk that you build with ndk-build? Is this intended to be run on Android or linux?
If you could share a reproducer then we could be of more help. Off the top of my head I would check the libGLES_mali.so with "file" and "readelf" to check it makes sense, then take a look at any objects output from the compile stage to see if there are any obvious problems. Maybe one is built for ARM and the other for THUMB. Maybe you need to pass -march=arm.
Hth,
Chris
Hi Chris,
Thanks.I use ndk-build to build an executable program,then run it on android using adb.I have also tried to pass -march=arm. It got the same error.
Thx,
Aha, Pete's message made me do a bit more digging. The SoC you pulled that lib from is 64 bit, i.e. AArch64, so that explains why the arm-linux-androideabi compiler does not recognise the architecture. I'm not sure why the AArch64 compiler skips it however. That said, if you're using ndk-build then there's generally no reason to be pointing the build system to any particular compiler in your Android.mk file. Is there any particular reason you don't just set APP-ABI := arm64-v8a in your Application.mk file, and let the build system pick the right compiler for you? The examples that come with the NDK should serve as examples of this.
arm64-v8a in your Application.mk file, and let the build system pick the right compiler for you? The examples that come with the NDK should serve as examples of this.