cocos2d-x 3.0 complie android -- tell "Couldn't find the gcc toolchain.".. what's happen? please help

10:59:49 * Incremental Build of configuration Default for project FindSome*
bash /Users/ricky/Documents/cocos2d-x-3-2.0/projects/FindSome/proj.android/build_native.sh
Couldn’t find the gcc toolchain.

——————it’s my Android.mk—————————
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := cocos2dcpp_shared

LOCAL_MODULE_FILENAME := libcocos2dcpp

LOCAL_SRC_FILES := hellocpp/main.cpp …/…/Classes/AppDelegate.cpp …/…/Classes/HelloWorldScene.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)/…/…/Classes
LOCAL_WHOLE_STATIC_LIBRARIES = cocos2dx_static
LOCAL_WHOLE_STATIC_LIBRARIES
= cocosdenshion_static
LOCAL_WHOLE_STATIC_LIBRARIES = box2d_static
LOCAL_WHOLE_STATIC_LIBRARIES
= chipmunk_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static

include $(BUILD_SHARED_LIBRARY)
$(call import-module,cocos2dx)
$(call import-module,cocos2dx/platform/third_party/android/prebuilt/libcurl)
$(call import-module,CocosDenshion/android)
$(call import-module,extensions)
$(call import-module,external/Box2D)
$(call import-module,external/chipmunk)

11:01:11 * Build of configuration Default for project FindSome*
bash /Users/ricky/Documents/cocos2d-x-3.0alpha0/projects/FindSome/proj.android/build_native.sh
Couldn’t find the gcc toolchain.

11:01:11 Build Finished (took 92ms)

Have you succeed building with this environment before?
I think it is nothing about cocos2d-x.
What’s the version of NDK you used?

Hi , I try android-ndk-r8e and android-ndk-r9, all failed.
I clean and build. still the result.

i use before version is ok, cocos2d-x 3.0, the first version is ok, but use the next version (3.0), failed

It is strange, i haven’t met it before.
I have not idea.
Sorry.

I had the same problem installed version 9
and change ANDROID_NDK_ROOT the problem was still there.
I change NDK_ROOT and path and it is compiling.
I use cygwin on window.
Hope it helps
Andre

PS: I have testlua running on my android tablet.
I had to restart the tablet but otherwise it all look great.

you may overwrite the NDK_ROOT some place else or you can replace the NDK_ROOT with the absolute path.

I have the same problem here
I’m using cocos2d-x-3.0aplha0 and create a new project from create-multi-platform-projects.py, I’m using windows so I’ve installed cygwin and the NDK version I used is android-ndk-r9b
I’ve already set the environment variables of NDK_ROOT to the right folder but when I tried to build it on eclipse, I got “Couldn’t find the gcc toolchain.” error … but when I tried to build it manually from cygwin terminal, it works perfectly
I don’t know what’s wrong here, I guess I’ll just build it manually from cygwin terminal for the time being then run it on eclipse to try it on the emulator

I have the same problem here

Yep, build_native.sh will find ndk-build in NDK_ROOT. So should set NDK_ROOT to correct path. And in v3.0, r8e or above is needed.

it looks like you have to set the NDK_ROOT on eclipse C++ build environment under “Window > preferences > C/C++ > Build > Environment” and add new environment variables “NDK_ROOT” with the exact path on your drive. you can’t just used the environment variables from Windows Environment Variables, it didn’t work.

Minggo Zhang wrote:

Yep, build_native.sh will find ndk-build in NDK_ROOT. So should set NDK_ROOT to correct path. And in v3.0, r8e or above is needed.

who can help me to fix follow problem ,thank you:
proj.android/build_native.sh -> ‘to_string’ is not a member of ‘std’

I met the same problem in cocos2d-x 3.0 alpha1 on my Mac system(OS X 10.8.5). In my system, the ‘NDK_ROOT’ is set to ‘/AndroidDev/ndk’. After investigaion, i find that the problem is caused by a Python statement ‘os.path.join(ndk_root,“toolchains/arm-linux-androideabi-4.8”)’. I use ‘print’ to get the result of this statement, the result is ‘/toolchains/arm-linux-androideabi-4.8’ instead of ‘/AndroidDev/ndk /toolchains/arm-linux-androideabi-4.8’ . Then, I test the following statement: print os.path.join(ndk_root,“ttt”), the result is ‘/tttroidDev/ndk’. Obviously, something is wrong with the function ‘os.path.join’, it replaces the characters in the first parameter by the characters in the second parameter instead of joining the two strings.
Who can give a solution to this case?

PS: Above test is on my physical Mac computer. When I run this case on a VM (virtual machine) with the same version of OS X, everything is fine.
Help!

I have the same problem here.
I try to use the NDK - the R8 solved the problem.
Download for this address: http://pan.baidu.com/share/link?shareid=196521685&uk=1845687387

I traced th ‘build_native.py’. And found that the returned value of ‘ndk_root’ is ‘AndroidDev/ndkr’ instead of ‘AndroidDev/ndk’. The ‘return’ character is added automatically to the end of the string. This is the reason why the os.path.join doesn’t assemble correctly the 2 strings. But, the strange thing is that, on my Mac Virtual machine, the returned value of ‘ndk_root’ is ‘AndroidDev/ndk’. I’m wondering how to get rid of the ‘r’ on my real Mac computer. I know that Python code can do this. But i don’t think it’s a good idea to change ‘build_native.py’ by my self. Does anyone know how to get rid of the ‘r’ automatically?

It works as expected on my MBP.

Hi, Minggo, can you help to investigae the reason? or, can you suggest the development team to add some code in the ‘build_native.py’ (maybe also in other python files) to remove the additional characters like ‘’, ‘’, etc. ?

The problem is solved. It’s a ‘copy-paste’ problem. I delete the .bash_profile and create a new one. Then I type manually all the content in it. And then save. It works.

where’s .bash_profile?

I have the same problem. Haizzzz,

You can run the command

ls -a ~

Then you will find it if exists.