From a88ad877314a7b27cd16b33368862f1a3bdc95bd Mon Sep 17 00:00:00 2001 From: Vadim Malckin <31727220+vadimled@users.noreply.github.com> Date: Tue, 21 Nov 2017 10:16:25 +0200 Subject: [PATCH] Bug in mp3reader.cpp (#18476) * Bug in mp3reader.cpp This directive #include is used for memset(b, c, l). Without it the attemt to install .apk (ex. cocos run . -p android --android-studio) is creshed. Found in the downloaded from http://cocos2d-x.org/download version cocos2d-x-3.16 * #include added to avoid crash The directive #include is used for memset(b, c, l). Without it the attempt to install .apk (ex. cocos run . -p android --android-studio) is crashed. Found in the downloaded from http://cocos2d-x.org/download version cocos2d-x-3.16: Here part of log: In file included from C:/Users/Vadim/Documents/Cocos2d/TestAndroidGame2/frameworks/cocos2d-x/cocos/./base/allocator/CCAllocatorGlobalNewDelete.cpp:27:0: C:/Users/Vadim/Documents/Cocos2d/TestAndroidGame2/frameworks/cocos2d-x/cocos/./base/allocator/CCAllocatorStrategyGlobalSmallBlock.h: In constructor 'cocos2d::allocator::AllocatorStrategyGlobalSmallBlock::AllocatorStrategyGlobalSmallBlock()': C:/Users/Vadim/Documents/Cocos2d/TestAndroidGame2/frameworks/cocos2d-x/cocos/./base/allocator/CCAllocatorStrategyGlobalSmallBlock.h:96:75: error: 'memset' was not declared in this scope memset(_smallBlockAllocators, 0, sizeof(_smallBlockAllocators)); ^ make: *** [C:/Users/Vadim/Documents/Cocos2d/TestAndroidGame2/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/debug/obj/local/x86/objs-debug/cocos2dx_internal_static/base/allocator/CCAllocatorGlobalNewDelete.o] Error 1 make: *** Waiting for unfinished jobs.... :TestAndroidGame2:externalNativeBuildDebug (Thread[Task worker for ':',5,main]) completed. Took 16.425 secs. FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':TestAndroidGame2:externalNativeBuildDebug'. > Build command failed. Error while executing process F:\android-ndk-r16\ndk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:\Users\Vadim\Documents\Cocos2d\TestAndroidGame2\frameworks\runtime-src\proj.android-studio\app\jni\Android.mk NDK_APPLICATION_MK=C:\Users\Vadim\Documents\Cocos2d\TestAndroidGame2\frameworks\runtime-src\proj.android-studio\app\jni\Application.mk APP_ABI=x86 NDK_ALL_ABIS=x86 NDK_DEBUG=1 APP_PLATFORM=android-21 NDK_OUT=C:/Users/Vadim/Documents/Cocos2d/TestAndroidGame2/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=C:\Users\Vadim\Documents\Cocos2d\TestAndroidGame2\frameworks\runtime-src\proj.android-studio\app\build\intermediates\ndkBuild\debug\lib NDK_TOOLCHAIN_VERSION=4.9 APP_PLATFORM=android-26 NDK_MODULE_PATH=C:/Users/Vadim/Documents/Cocos2d/TestAndroidGame2/frameworks/cocos2d-x;C:/Users/Vadim/Documents/Cocos2d/TestAndroidGame2/frameworks/cocos2d-x/cocos;C:/Users/Vadim/Documents/Cocos2d/TestAndroidGame2/frameworks/cocos2d-x/external -j4 NDK_DEBUG=1 C:/Users/Vadim/Documents/Cocos2d/TestAndroidGame2/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/debug/obj/local/x86/libcocos2djs.so} [x86] Compile++ : audioengine_static <= mp3reader.cpp [x86] Compile++ : cocos2dx_internal_static <= CCAllocatorGlobalNewDelete.cpp In file included from C:/Users/Vadim/Documents/Cocos2d/TestAndroidGame2/frameworks/cocos2d-x/cocos/./base/allocator/CCAllocatorGlobalNewDelete.cpp:27:0: C:/Users/Vadim/Documents/Cocos2d/TestAndroidGame2/frameworks/cocos2d-x/cocos/./base/allocator/CCAllocatorStrategyGlobalSmallBlock.h: In constructor 'cocos2d::allocator::AllocatorStrategyGlobalSmallBlock::AllocatorStrategyGlobalSmallBlock()': C:/Users/Vadim/Documents/Cocos2d/TestAndroidGame2/frameworks/cocos2d-x/cocos/./base/allocator/CCAllocatorStrategyGlobalSmallBlock.h:96:75: error: 'memset' was not declared in this scope memset(_smallBlockAllocators, 0, sizeof(_smallBlockAllocators)); ^ make: *** [C:/Users/Vadim/Documents/Cocos2d/TestAndroidGame2/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/debug/obj/local/x86/objs-debug/cocos2dx_internal_static/base/allocator/CCAllocatorGlobalNewDelete.o] Error 1 make: *** Waiting for unfinished jobs.... --- cocos/audio/android/mp3reader.cpp | 2 +- cocos/base/allocator/CCAllocatorStrategyGlobalSmallBlock.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos/audio/android/mp3reader.cpp b/cocos/audio/android/mp3reader.cpp index 9388d843d8..15a5ef9165 100644 --- a/cocos/audio/android/mp3reader.cpp +++ b/cocos/audio/android/mp3reader.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include "audio/android/cutils/log.h" diff --git a/cocos/base/allocator/CCAllocatorStrategyGlobalSmallBlock.h b/cocos/base/allocator/CCAllocatorStrategyGlobalSmallBlock.h index 53614b52d1..66938389f1 100644 --- a/cocos/base/allocator/CCAllocatorStrategyGlobalSmallBlock.h +++ b/cocos/base/allocator/CCAllocatorStrategyGlobalSmallBlock.h @@ -32,7 +32,7 @@ Do not use Console::log or any other methods that use NEW inside of this allocator. Failure to do so will result in recursive memory allocation. ****************************************************************************/ - +#include #include "base/allocator/CCAllocatorMacros.h" #include "base/allocator/CCAllocatorBase.h" #include "base/allocator/CCAllocatorGlobal.h"