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

@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

I have the same “Couldn’t find the gcc toolchain.” problem with ndk-r10 when NDK_ROOT is set to absolute path of android-ndk-r10 folder. I use cocos2d-x 3.1 and also adt-bundle-mac-x86_64-20140702.

I got the problem same as yours. Finally, I find out the solution for it. I modified build_native.py a bit.
I add some lines in this file:

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 !”
elif os.path.isdir(os.path.join(ndk_root,“toolchains/arm-linux-androideabi-4.9”)):
os.environ[‘NDK_TOOLCHAIN_VERSION’] = ‘4.9’
print "The Selected NDK toolchain version was 4.9 !"

else:

    print "Couldn't find the gcc toolchain."
    exit(1)

I hope it can help. I guess r10 should be updated in this file. But you should use ndk r9c for safety

Same here, I’m using MacOS, what I did is I downloaded the NDK r9d and all problem gone :smile:

I can not run the “ls -a ~” command line hix

http://giaysi.vn

I don’t know the system you used.
I think ls command is common on linux/unix world.
May be you can find similar command in your system.

Did anybody ever solved this issue because i am having the same problem and can’t find a clue about it. I am working on physical Mac OX Yosemite + cocos2d-x v3.3 + NDK r9c

@ibnetariq
did you try adding the NDK_ROOT to the eclipse environment variables? Also, I suggest using the NDK r10d since im using that with cocos2dx 3.3 and it works fine.

@TheDevil thnx a lot for quick reply.
Yes i did added NDK_ROOT, but in terminal , where I am trying to build it using ./build_native.py.
And another thing that on cocos2d-x website it recomended to use ndk r9 rather than r10

After reading the comments I printed the path of toolchain , which turns out to be correct. but os.path.isdir(path) returns false regardless of the fact that dir exists at that path

so your building from the terminal…just checking to make sure your environment variables are set( i dont mean eclipse, but for your terminal to use). also did u try building using the cocos command?

No, I haven’t but i’ll give it a try and let you people know the result.

I had a similar problem on my Mac. NDK was one issue and I was running out of swap space on my hard drive. Also try removing .metadata in your Eclipse workspace.

Good luck.

Chris

I am getting the same error in 3.3 also. Will remove metadata file and try again

I have the same problem in cocos2d-x-3.4 and the NDK version is android-ndk-r9d ,i’m using windows and installed cygwin.
i find the the problem caused by python statement
if os.path.isdir(os.path.join(ndk_root,“toolchains/arm-linux-androideabi-4.9”)):
os.environ[‘NDK_TOOLCHAIN_VERSION’] = ‘4.9’
print “The Selected NDK toolchain version was 4.9 !”
elif 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 !”
os.path.isdir(os.path.join(ndk_root,“XXX”)): always return false, and ndk_root/toolchains/arm-linux-androideabi-4.8 exists .
Help!