Couldn't find the gcc channel

I set up for android
–I have D:\archivosprogramad\cocos3xfiles\adt-bundle-windows-x86_64-20140624\sdk
–I have apache-ant-1.9.3
–cocos2d-x-3.2
–android-ndk-r10

I create the project without problems.
cocos new MyGamendkten -p com.your_company.mygame -l cpp -d

The problem is when I want to build MyGamendkten using “build_native.py”

I get this error
couldn’t find the gcc toolchain.

I assume you have set the NDK_ROOT environment variable?

If so, you need to adapt build_native.py as android-ndk-r10 is using gcc 4.9 but the python script does not account for that:

    ndk_root = check_environment_variables()
    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 !"
    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."
        exit(1) 

Add the code for 4.9(just copy&paste and change to 4.9) or just change 4.8 to 4.9 as an easy fix/hack.

I think that gcc comes with the Eclipse ADT Bundle. You could always use MinGW or Cygwin too.

ndk-r10 requires gcc 4.9.1 which is pretty bleeding edge, just released a week or 2 ago, IIRC.

No. gcc is not part of the ADT bundle, as it is targeted for java.
Only the ndk comes with it, as it is targeted for C++ and a requirement.

Yes, gcc 4.9.1 was released on July 16, 2014 and ndk-r10 does not require gcc 4.9.1, but gcc 4.9.x. It comes bundled with gcc 4.9.0.

But better use clang anyway :smile:

I create a project “MyGamendk10”

variable name NDK_ROOT
variable value D:\archivosprogramad\cocos3xfiles\android-ndk-r10

I copy and paste the code, and I get this error

D:\archivosprogramad\cocos3xfiles\practicadecocos\MyGamendk10\proj.android>build
_native.py
The Selected NDK toolchain version was 4.9 !
Android NDK: WARNING: Rebuilding libc++ libraries from sources!
Android NDK: You might want to use $NDK/build/tools/build-cxx-stl.sh --stl=libc+
+
Android NDK: in order to build prebuilt versions to speed up your builds!
Android NDK: ERROR:D:/archivosprogramad/cocos3xfiles/android-ndk-r10/sources/and
roid/compiler-rt/Android.mk:compiler_rt_shared: LOCAL_SRC_FILES points to a miss
ing file
Android NDK: Check that D:/archivosprogramad/cocos3xfiles/android-ndk-r10/source
s/android/compiler-rt/libs/armeabi/libcompiler_rt_shared.so exists or that its
path is correct
make.exe: Entering directory D:/archivosprogramad/cocos3xfiles/practicadecocos/ MyGamendk10/proj.android' D:/archivosprogramad/cocos3xfiles/android-ndk-r10/build/core/prebuilt-library.mk :45: *** Android NDK: Aborting . Stop. make.exe: Leaving directoryD:/archivosprogramad/cocos3xfiles/practicadecocos/M
yGamendk10/proj.android’
Traceback (most recent call last):
File “D:\archivosprogramad\cocos3xfiles\practicadecocos\MyGamendk10\proj.andro
id\build_native.py”, line 162, in
build(opts.ndk_build_param,opts.android_platform,opts.build_mode)
File “D:\archivosprogramad\cocos3xfiles\practicadecocos\MyGamendk10\proj.andro
id\build_native.py”, line 149, in build
do_build(cocos_root, ndk_root, app_android_root,ndk_build_param,sdk_root,and
roid_platform,build_mode)
File “D:\archivosprogramad\cocos3xfiles\practicadecocos\MyGamendk10\proj.andro
id\build_native.py”, line 85, in do_build
raise Exception(“Build dynamic library for project [ " + app_android_root +
" ] fails!”)
Exception: Build dynamic library for project [ D:\archivosprogramad\cocos3xfiles
\practicadecocos\MyGamendk10\proj.android ] fails!

D:\archivosprogramad\cocos3xfiles\practicadecocos\MyGamendk10\proj.android>

Android NDK: ERROR:D:/archivosprogramad/cocos3xfiles/android-ndk-r10/sources/and
roid/compiler-rt/Android.mk:compilerrt_shared: LOCAL_SRC_FILES points to a miss
ing file

One of your source files cannot be found.
Please check/post the content of LOCAL_SRC_FILES in your project’s Android.mk file and make sure the files referenced do exist.

this is the Android.mk of " MyGamendk10"

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

$(call import-add-path,$(LOCAL_PATH)/…/…/cocos2d)
$(call import-add-path,$(LOCAL_PATH)/…/…/cocos2d/external)
$(call import-add-path,$(LOCAL_PATH)/…/…/cocos2d/cocos)

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 += cocosbuilder_static

LOCAL_WHOLE_STATIC_LIBRARIES += spine_static

LOCAL_WHOLE_STATIC_LIBRARIES += cocostudio_static

LOCAL_WHOLE_STATIC_LIBRARIES += cocos_network_static

LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static

include $(BUILD_SHARED_LIBRARY)

$(call import-module,.)
$(call import-module,audio/android)

$(call import-module,Box2D)

$(call import-module,editor-support/cocosbuilder)

$(call import-module,editor-support/spine)

$(call import-module,editor-support/cocostudio)

$(call import-module,network)

$(call import-module,extensions)