gl4es icon indicating copy to clipboard operation
gl4es copied to clipboard

Fails to build with Android NDK r21: "asm volatile" needs -std=gnu99

Open zhuowei opened this issue 5 years ago • 1 comments

I tried building gl4es for Android (armeabi-v7a) using Android NDK r21.

It seems that Clang, used in newer Android NDKs, is more strict than GCC:

[armeabi-v7a] Compile thumb  : gl4es <= array.c
jni/src/gl/array.c:189:9: warning: add explicit braces to avoid dangling else [-Wdangling-else]
        else /*if(*(GLfloat*)filler==0.0f)*/ //that should be unneeded
        ^
jni/src/gl/array.c:479:9: error: use of undeclared identifier 'asm'
        asm volatile (
        ^

Switching to -std=gnu99 in Android.mk fixes the issue.

Should I send a pull request for this, or would you prefer changing the asm to __asm__ instead?

zhuowei avatar Feb 01 '20 22:02 zhuowei

You can do a pull request yes. I prefer to keep the asm key word. And the dangling-else Warning, I think I'll disable it. Putting braces everywhere just make the code heavier for nothing.

ptitSeb avatar Feb 02 '20 09:02 ptitSeb