Can not build project with cocos 3.13.1

i updated cocod2dx repo into version 0960ffe64f88592e869e6a56c4dfff010924616b and my project failed to build with no changes at project

Updated local.properties
Updated file /Volumes/hdd/netshooter/client/proj.android/proguard-project.txt
Android platform not specified, searching a default one...
running: '/Volumes/hdd/opt/android-sdk-r23/tools/android update lib-project -p /Volumes/hdd/netshooter/client/cocos2d/cocos/platform/android/java -t android-16'

Updated project.properties
Updated local.properties
Updated file /Volumes/hdd/netshooter/client/cocos2d/cocos/platform/android/java/proguard-project.txt
Android platform not specified, searching a default one...
running: '/Volumes/hdd/opt/android-sdk-r23/tools/android update lib-project -p /Volumes/hdd/netshooter/client/cocos2d/cocos/platform/android/java/libs/gps -t android-16'

Updated project.properties
Updated local.properties
Updated file /Volumes/hdd/netshooter/client/cocos2d/cocos/platform/android/java/libs/gps/proguard-project.txt
Building native...
NDK build mode: release
running: '/Volumes/hdd/opt/android-ndk-r10e/ndk-build -C /Volumes/hdd/netshooter/client/proj.android -j4 NDK_MODULE_PATH=/Volumes/hdd/netshooter/client/proj.android/../cocos2d:/Volumes/hdd/netshooter/client/proj.android/../cocos2d/cocos/prebuilt-mk:/Volumes/hdd/netshooter/client/proj.android/../cocos2d/cocos:/Volumes/hdd/netshooter/client/proj.android/../cocos2d/external NDK_TOOLCHAIN_VERSION=4.9'

Android NDK: /Volumes/hdd/netshooter/client/proj.android/../cocos2d/cocos/prebuilt-mk/./Android.mk: Cannot find module with tag 'android/cpufeatures/prebuilt-mk' in import path    
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?    
Android NDK: The following directories were searched:    
Android NDK:         
make: Entering directory `/Volumes/hdd/netshooter/client/proj.android'
/Volumes/hdd/netshooter/client/proj.android/../cocos2d/cocos/prebuilt-mk/./Android.mk:84: *** Android NDK: Aborting.    .  Stop.
make: Leaving directory `/Volumes/hdd/netshooter/client/proj.android'
Error running command, return code: 2.

OSX 10.10.5
SDK r23
NDK 10e

You are using the pre-built libraries?

yes i use pre-build

@slackmoehrle did you have any solution fo that?

have you tried 12b?

@slackmoehrle
yes, it does not help, error is the same

Let us see if @zhangxm has any thoughts on this.

ndroid NDK: /Volumes/hdd/netshooter/client/proj.android/…/cocos2d/cocos/prebuilt-mk/./Android.mk: Cannot find module with tag ‘android/cpufeatures/prebuilt-mk’ in import path
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?

@camkadev the error says it can not find android/cpufeatures/prebuilt-mk. It seems it is a module of Android NDK, but i am not familiar with it. Could you please show your contents of cocos2d/cocos/prebuilt-mk/./Android.mk?

@zhangxm
sure, here is it:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := cocos2dx_internal_static

LOCAL_MODULE_FILENAME := libcocos2dxinternal

LOCAL_ARM_MODE := arm

ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
MATHNEONFILE := math/MathUtil.cpp.neon
else
MATHNEONFILE := math/MathUtil.cpp
endif

LOCAL_SRC_FILES := ../../prebuilt/android/$(TARGET_ARCH_ABI)/libcocos2dxinternal.a


LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/.. \
$(LOCAL_PATH)/../. \
$(LOCAL_PATH)/../.. \
$(LOCAL_PATH)/../../external \
$(LOCAL_PATH)/../../external/tinyxml2 \
$(LOCAL_PATH)/../../external/unzip \
$(LOCAL_PATH)/../../external/chipmunk/include/chipmunk \
$(LOCAL_PATH)/../../external/xxhash \
$(LOCAL_PATH)/../../external/nslog \
$(LOCAL_PATH)/../../external/poly2tri \
$(LOCAL_PATH)/../../external/poly2tri/common \
$(LOCAL_PATH)/../../external/poly2tri/sweep \
$(LOCAL_PATH)/../../external/clipper


LOCAL_EXPORT_LDLIBS := -lGLESv2 \
                       -llog \
                       -landroid

LOCAL_WHOLE_STATIC_LIBRARIES := cocos_freetype2_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_png_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_jpeg_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_tiff_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_webp_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_chipmunk_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_zlib_static
LOCAL_WHOLE_STATIC_LIBRARIES += recast_static
LOCAL_WHOLE_STATIC_LIBRARIES += bullet_static

LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dxandroid_static
LOCAL_WHOLE_STATIC_LIBRARIES += cpufeatures

# define the macro to compile through support/zip_support/ioapi.c
LOCAL_CFLAGS   :=  -DUSE_FILE32API
LOCAL_CFLAGS   +=  -fexceptions

# Issues #9968
#ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
#    LOCAL_CFLAGS += -DHAVE_NEON=1
#endif

LOCAL_CPPFLAGS := -Wno-deprecated-declarations
LOCAL_EXPORT_CFLAGS   := -DUSE_FILE32API
LOCAL_EXPORT_CPPFLAGS := -Wno-deprecated-declarations

include $(PREBUILT_STATIC_LIBRARY)

#==============================================================

include $(CLEAR_VARS)

LOCAL_MODULE := cocos2dx_static
LOCAL_MODULE_FILENAME := libcocos2d
LOCAL_SRC_FILES := ../../prebuilt/android/$(TARGET_ARCH_ABI)/libcocos2d.a

LOCAL_WHOLE_STATIC_LIBRARIES := cocostudio_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocosbuilder_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos3d_static
LOCAL_WHOLE_STATIC_LIBRARIES += spine_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_network_static
LOCAL_WHOLE_STATIC_LIBRARIES += audioengine_static

include $(PREBUILT_STATIC_LIBRARY)
#==============================================================
$(call import-module, android/cpufeatures/prebuilt-mk)
$(call import-module,freetype2/prebuilt/android)
$(call import-module, platform/android/prebuilt-mk)
$(call import-module,png/prebuilt/android)
$(call import-module,zlib/prebuilt/android)
$(call import-module,jpeg/prebuilt/android)
$(call import-module,tiff/prebuilt/android)
$(call import-module,webp/prebuilt/android)
$(call import-module,chipmunk/prebuilt/android)
$(call import-module, 3d/prebuilt-mk)
$(call import-module, audio/android/prebuilt-mk)
$(call import-module, editor-support/cocosbuilder/prebuilt-mk)
$(call import-module, editor-support/cocostudio/prebuilt-mk)
$(call import-module, editor-support/spine/prebuilt-mk)
$(call import-module, network/prebuilt-mk)
$(call import-module, ui/prebuilt-mk)
$(call import-module, extensions/prebuilt-mk)
$(call import-module, Box2D/prebuilt-mk)
$(call import-module, bullet/prebuilt-mk)
$(call import-module, recast/prebuilt-mk)
# $(call import-module,curl/prebuilt/android)
$(call import-module,websockets/prebuilt/android)
$(call import-module, flatbuffers/prebuilt-mk)

I think you should change $(call import-module, android/cpufeatures/prebuilt-mk) to $(call import-module, android/cpufeatures).

1 Like

@zhangxm
looks like this help, but why this wrong path is contains in official repo?
now i have another one problem:

/Volumes/hdd/dev/brr_game/client/proj.android/../cocos2d/cocos/prebuilt-mk/./../../prebuilt/android/armeabi/libcocos2dxinternal.a(CCConsole.o):function cocos2d::Console::listenOnTCP(int): error: undefined reference to 'bzero'
collect2: error: ld returned 1 exit status

@camkadev it is because android/cpufeatures is added these days, and cocos gen-libs just add prebuilt-mk for every import-module sentence. android/cpufeatures is Android system lib, then the error happened.

About the error of bzero, i don’t know why it happened, but i think you can add the header directly like

#include <sys/ioctl.h>
# include <string.h>  <-- add this line before #endif 
#endif
1 Like

@zhangxm
yes it helps, thank you!

I also face issue for compile fresh project with cocos2-x 3.13.1
ndk- 11c

D:\COCOS2DX13\my314\proj.android>cocos run -p android -j 1 --ap android-24
Building mode: debug
Using Eclipse project : D:\COCOS2DX13\my314\proj.android
running: ‘“D:\cocos2d-x3.2\adt-bundle-windows-x86-20130219\sdk\tools\android” up
date project -t android-24 -p D:\COCOS2DX13\my314\proj.android’

Updated project.properties
Updated local.properties
Updated file D:\COCOS2DX13\my314\proj.android\proguard-project.txt
running: ‘“D:\cocos2d-x3.2\adt-bundle-windows-x86-20130219\sdk\tools\android” up
date lib-project -p D:\COCOS2DX13\my314\cocos2d\cocos\platform\android\java -t a
ndroid-24’

Updated project.properties
Updated local.properties
Updated file D:\COCOS2DX13\my314\cocos2d\cocos\platform\android\java\proguard-pr
oject.txt
Building native…
NDK build mode: debug
running: ‘“D:\COCOS2DX13\android-ndk-r11c\ndk-build” -C D:\COCOS2DX13\my314\proj
.android -j1 NDK_MODULE_PATH=D:\COCOS2DX13\my314\proj.android…/cocos2d;D:\COCO
S2DX13\my314\proj.android…/cocos2d/cocos;D:\COCOS2DX13\my314\proj.android…/c
ocos2d/external NDK_TOOLCHAIN_VERSION=4.9 NDK_DEBUG=1’

Android NDK: WARNING: APP_PLATFORM android-24 is larger than android:minSdkVersi
on 9 in ./AndroidManifest.xml
make: Entering directory D:/COCOS2DX13/my314/proj.android' [armeabi] "Gdbserver ": "[arm-linux-androideabi-4.9] libs/armeabi/gdbserver " [armeabi] "Gdbsetup ": "libs/armeabi/gdb.setup" [armeabi] "Compile++ thumb": "MyGame_shared <= main.cpp" process_begin: CreateProcess(NULL, D:/COCOS2DX13/android-ndk-r11c/build//../tool chains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androidea bi-g++ -MMD -MP -MF ./obj/local/armeabi/objs-debug/MyGame_shared/hellocpp/main.o .d -fpic -ffunction-sections -funwind-tables -fstack-protector-strong -no-canoni cal-prefixes -march=armv5te -mtune=xscale -msoft-float -fno-exceptions -fno-rtti -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limi t=64 -O0 -UNDEBUG -marm -fno-omit-frame-pointer -Ijni/../../Classes -ID:/COCOS2D X13/android-ndk-r11c/build//../sources/cxx-stl/gnu-libstdc++/4.9/include -ID:/CO COS2DX13/android-ndk-r11c/build//../sources/cxx-stl/gnu-libstdc++/4.9/libs/armea bi/include -ID:/COCOS2DX13/android-ndk-r11c/build//../sources/cxx-stl/gnu-libstd c++/4.9/include/backward -ID:/COCOS2DX13/my314/proj.android/../cocos2d/cocos/edi tor-support/cocostudio/.. -ID:/COCOS2DX13/my314/proj.android/../cocos2d/cocos/ed itor-support/cocosbuilder/.. -ID:/COCOS2DX13/my314/proj.android/../cocos2d/cocos /3d/.. -ID:/COCOS2DX13/my314/proj.android/../cocos2d/cocos/editor-support/spine/ .. -ID:/COCOS2DX13/my314/proj.android/../cocos2d/cocos/network -ID:/COCOS2DX13/m y314/proj.android/../cocos2d/cocos/audio/android/../include -ID:/COCOS2DX13/my31 4/proj.android/../cocos2d/cocos/ui/../editor-support -ID:/COCOS2DX13/my314/proj. android/../cocos2d/cocos/audio/android/../include -ID:/COCOS2DX13/my314/proj.and roid/../cocos2d/external/flatbuffers/.. -ID:/COCOS2DX13/my314/proj.android/../co cos2d/extensions/. -ID:/COCOS2DX13/my314/proj.android/../cocos2d/extensions/.. - ID:/COCOS2DX13/my314/proj.android/../cocos2d/extensions/GUI/CCControlExtension - ID:/COCOS2DX13/my314/proj.android/../cocos2d/extensions/GUI/CCScrollView -ID:/CO COS2DX13/my314/proj.android/../cocos2d/cocos/. -ID:/COCOS2DX13/my314/proj.androi d/../cocos2d/cocos/./. -ID:/COCOS2DX13/my314/proj.android/../cocos2d/cocos/./.. -ID:/COCOS2DX13/my314/proj.android/../cocos2d/cocos/./../external -ID:/COCOS2DX1 3/my314/proj.android/../cocos2d/cocos/./../external/tinyxml2 -ID:/COCOS2DX13/my3 14/proj.android/../cocos2d/cocos/./../external/unzip -ID:/COCOS2DX13/my314/proj. android/../cocos2d/cocos/./../external/chipmunk/include/chipmunk -ID:/COCOS2DX13 /my314/proj.android/../cocos2d/cocos/./../external/xxhash -ID:/COCOS2DX13/my314/ proj.android/../cocos2d/cocos/./../external/nslog -ID:/COCOS2DX13/my314/proj.and roid/../cocos2d/cocos/./../external/poly2tri -ID:/COCOS2DX13/my314/proj.android/ ../cocos2d/cocos/./../external/poly2tri/common -ID:/COCOS2DX13/my314/proj.androi d/../cocos2d/cocos/./../external/poly2tri/sweep -ID:/COCOS2DX13/my314/proj.andro id/../cocos2d/cocos/./../external/clipper -ID:/COCOS2DX13/my314/proj.android/../ cocos2d/external/websockets/prebuilt/android/../../include/android -ID:/COCOS2DX 13/my314/proj.android/../cocos2d/external/Box2D/.. -ID:/COCOS2DX13/my314/proj.an droid/../cocos2d/external/bullet/.. -ID:/COCOS2DX13/my314/proj.android/../cocos2 d/external/freetype2/prebuilt/android/../../include/android -ID:/COCOS2DX13/my31 4/proj.android/../cocos2d/external/freetype2/prebuilt/android/../../include/andr oid/freetype2 -ID:/COCOS2DX13/my314/proj.android/../cocos2d/external/png/prebuil t/android/../../include/android -ID:/COCOS2DX13/my314/proj.android/../cocos2d/ex ternal/jpeg/prebuilt/android/../../include/android -ID:/COCOS2DX13/my314/proj.an droid/../cocos2d/external/tiff/prebuilt/android/../../include/android -ID:/COCOS 2DX13/my314/proj.android/../cocos2d/external/webp/prebuilt/android/../../include /android -ID:/COCOS2DX13/my314/proj.android/../cocos2d/external/chipmunk/prebuil t/android/../../include -ID:/COCOS2DX13/my314/proj.android/../cocos2d/external/z lib/prebuilt/android/../../include -ID:/COCOS2DX13/my314/proj.android/../cocos2d /external/recast/.. -ID:/COCOS2DX13/my314/proj.android/../cocos2d/cocos/platform /android -ID:/COCOS2DX13/android-ndk-r11c/build//../sources/android/cpufeatures -Ijni -DANDROID -DUSE_FILE32API -Wa,--noexecstack -Wformat -Werror=format-securi ty -Wno-deprecated-declarations -D__STDC_LIMIT_MACROS=1 -fexceptions -frtti -DCC _ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char -DCOCOS2D_DEBUG=1 -isyst em D:/COCOS2DX13/android-ndk-r11c/build//../platforms/android-24/arch-arm/usr/in clude -c jni/hellocpp/main.cpp -o ./obj/local/armeabi/objs-debug/MyGame_shared/h ellocpp/main.o, ...) failed. make (e=2): The system cannot find the file specified. make: *** [obj/local/armeabi/objs-debug/MyGame_shared/hellocpp/main.o] Error 2 make: Leaving directoryD:/COCOS2DX13/my314/proj.android’
Error running command, return code: 2.

You should run cocos command in D:\COCOS2DX13\my314.

Thank you @zhangxm