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

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.

@zhangxm wrote:

You can run the command

ls -a ~

Then you will find it if exists.

Hix, can you help me solve this problem???

“Couldn’t find GCC toolchan”.

Do you use Teamview??. I’ll show you my problem

I don’t use Teamview.
Could you describe what you did step by step?
And describe what’s your problem.

Because
ndk-r8e -> use gcc4.7
ndk-r9 -> use gcc4.8

Check:

ndk_root/toolchains/arm-linux-androideabi-4.8 or
ndk_root/toolchains/arm-linux-androideabi-4.7

existing

ndk_root better no space. hope help you guys.

same problem , it’s really strange that ,all ok while run in Terminal with command line
$ ./build_native.sh
but, there err-msg from Eclipse is different, and I find out that there ENV-VALUES are different with shell imp from .bash_profile
and ,so I fix it by add NDK_ROOT in Eclipse
FILE->Properties->C/C++ Build->Environment
fix_ndk_root

def select_toolchain_version():
‘’‘Because ndk-r8e uses gcc4.6 as default. gcc4.6 doesn’t support c++11. So we should select gcc4.7 when
using ndk-r8e. But gcc4.7 is removed in ndk-r9, so we should determine whether gcc4.7 exist.
Conclution:
ndk-r8e -> use gcc4.7
ndk-r9 -> use gcc4.8
‘’’

ndk_root = check_environment_variables()
if os.path.isdir(os.path.join(ndk_root,"toolchains/arm-linux-androideabi-4.8")):
    os.environ['NDK_TOOLCHAIN_VERSION'] = '4.8'
    print "The Selected NDK toolchain version was 4.8 !"
elif os.path.isdir(os.path.join(ndk_root,"toolchains/arm-linux-androideabi-4.7")):
    os.environ['NDK_TOOLCHAIN_VERSION'] = '4.7'
    print "The Selected NDK toolchain version was 4.7 !"
else:
    print "Couldn't find the gcc toolchain."

so …check your toolchain version in NDK_HOME