Problem of compiling build_native.sh

I put this in my Application.mk to solve the same problem.
APP_CFLAGS += -Wno-error=format-security

this work for ubuntu 12
ndk 9
cocos2dx cocos2d-x-2.1.4

Another answer to the question why defines are bad. Instead of pointing to the function that actually causes the error, compiler just points to the place where the “function” created with define is used. To fix the issue find all occurrences of

__android_log_print(ANDROID_LOG_DEBUG, "cocos2d-x debug info", buf);

and change it to

__android_log_print(ANDROID_LOG_DEBUG, "cocos2d-x debug info", "%s", buf);

as Xiao Yu already mentioned. There are 3 or 4 places if I’m not mistaken.

Victor Komarov and others are absolutely right. Don’t ignore the warnings, do the changes. If not, you’re going to miss out on some sweet logcat messages.

Right, Victor and Joar, for the Cocos 2.1.1:

CCCommon.cpp (as explained above) SimpleAudioEngine.cpp - LOGD(deviceModel); -> LOGD("%s",deviceModel); OpenSLEngine.cpp - LOGD(errorInfo); -> LOGD("%s",errorInfo); SimpleAudioEngineOpenSL.cpp - LOGD(errorInfo); -> LOGD("%s",errorInfo);

xiao yu wrote:

CCCommon.cpp line 44
>
change android_log_print; // error in ndk9
to
android_log_print(ANDROID_LOG_DEBUG, “cocos2d-x debug info”, “%s”, buf);

Only this way works for me,but there are too many code to modify.

Malin@Malin ~
$ cd “/cygdrive/c/Android/cocos2d/MyNewGame/proj.android”
Malin@Malin /cygdrive/c/Android/cocos2d/MyNewGame/proj.android
$ ./build_native.sh
Using prebuilt externals
make: Entering directory ‘/cygdrive/c/Android/cocos2d/MyNewGame/proj.android’
Gdbserver : [arm-linux-androideabi-4.6] libs/armeabi/gdbserver
Gdbsetup : libs/armeabi/gdb.setup
Cygwin : Generating dependency file converter script
Compile++ thumb : game_shared <= main.cpp
cc1plus.exe: fatal error: jni/helloworld/main.cpp: Permission denied
compilation terminated.
/cygdrive/c/Android/ndk-r8b/build/core/build-binary.mk:255: recipe for target ‘obj/local/armeabi/objs-debug/game_shared/helloworld/main.o’ failed
make: *** [obj/local/armeabi/objs-debug/game_shared/helloworld/main.o] Error 1
make: Leaving directory '/cygdrive/c/Android/cocos2d/MyNewGame/proj.android’

I’m using NDK = ndk-r8b.

Can you help me??