Search code examples
androidclangcocos2d-xgame-engine

Cocos2d-x v3.12 compile fails


Recently updated Cocos2d-x to v 3.12 and created the "Hello World!" project but the CLI command fails, log as shown bellow:

make: Entering directory `/home/..../proj.android'
[armeabi] StaticLibrary  : libcocos2d.a
[armeabi] Compile++ thumb: cocostudio_static <= WidgetReader.cpp
/home/<user>/AndroidTools/crystax-ndk-10.3.1/toolchains/llvm-3.7/prebuilt/linux-x86_64/bin/clang++: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
make: *** [obj/local/armeabi/objs/cocostudio_static/WidgetReader/WidgetReader.o] Error 127
make: *** Waiting for unfinished jobs....
make: Leaving directory `/home/...../proj.android'
Error running command, return code: 2.

The path does contain the mentioned Clang++ file/toolchain, should I be installing any other dependencies? Running Fedora 24.

Edit:

Trying to compile with the Cocos recommended android NDK v11 I get a different error

make: Entering directory '/home/.....<projectDir>...../proj.android'
Android NDK: WARNING: APP_PLATFORM android-23 is larger than android:minSdkVersion 9 in ./AndroidManifest.xml    
[armeabi] Compile++ thumb: MyGame_shared <= main.cpp
[armeabi] Compile++ thumb: MyGame_shared <= AppDelegate.cpp
[armeabi] Compile++ thumb: MyGame_shared <= HelloWorldScene.cpp
/home/<user>/AndroidTools/android-sdk-linux/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
/home/<user>/AndroidTools/android-sdk-linux/ndk-bundle/build/core/build-binary.mk:462: recipe for target 'obj/local/armeabi/objs-debug/MyGame_shared/__/__/Classes/AppDelegate.o' failed
make: *** [obj/local/armeabi/objs-debug/MyGame_shared/__/__/Classes/AppDelegate.o] Error 127
make: *** Waiting for unfinished jobs....
/home/<user>/AndroidTools/android-sdk-linux/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
/home/<user>/AndroidTools/android-sdk-linux/ndk-bundle/build/core/build-binary.mk:462: recipe for target 'obj/local/armeabi/objs-debug/MyGame_shared/hellocpp/main.o' failed
make: *** [obj/local/armeabi/objs-debug/MyGame_shared/hellocpp/main.o] Error 127
/home/<user>/AndroidTools/android-sdk-linux/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
/home/<user>/AndroidTools/android-sdk-linux/ndk-bundle/build/core/build-binary.mk:462: recipe for target 'obj/local/armeabi/objs-debug/MyGame_shared/__/__/Classes/HelloWorldScene.o' failed
make: *** [obj/local/armeabi/objs-debug/MyGame_shared/__/__/Classes/HelloWorldScene.o] Error 127
make: Leaving directory '/home/.....<projectDir>...../proj.android'
Error running command, return code: 2.

And I think the following may be the reason for the problem

error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory

But I have installed all the necessary libs and files, I think, should I cross check for any particular lib or is the fixable in any other way?


Solution

  • Fixed it by installing the missing ncurse libs. By default the command

    dnf install ncurses
    

    returns nothing to install as the dnf package contains the necessary libs installed, but it turns out that it does not install all the ncurses libs, you will have to also install the following libs to continue building.

    1. ncurses-compat-libs
    2. ncurses-static
    3. ncurses-term

    The build continued successfully after this.