Problem updating game to cocos2d-x v2.0

Hello.

I’m working on linux + eclipse.

I have updated my code following the steps provided by the wiki.

1º I create a new eclipse project.
2º I run hello world and it works.
3º I put my old code on Classes, and resources.
4º I update appdelegate.cpp .h, and jni/Android.mk with new files.
5º It compile correctly.

6º Lauching from eclipse i get the following exception:

trying to load lib /data/data/org.pipero.game/lib/libgame.so
Fatal signal 11.

Something is wrong, but i don’t know what is happening.

The same code work on a xcode project.
I don’t get the CCLOG message con Appdelegate constructor, and on Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit on main.cpp neither.

Some idea???

Thanks in advance.

In the new version, cocos2dx is linked as a static library into your project, while the old approach is a dynamic library.
Maybe I need to merge makefiles manually, but not replace it directly.

But the hello world project work normally, the log end with:
StaticLibrary : libcocosdenshion.a
SharedLibrary : libgame.so
Install : libgame.so => libs/armeabi/libgame.so
I launch the app, and work.

1º When i change the classes with mine, and edit the Android.mk —> LOCAL_SRC_FILES := Mine.cpps, it don’t work.
2º I remove the Line: jni/helloworld/main.cpp:8:29: error: HelloWorldScene.h: No such file or director, because i don’t need that.

The Library that is trying to use is the same, libgame.so.

My log in my project end with:
SharedLibrary : libgame.so
Install : libgame.so => libs/armeabi/libgame.so

The makefile is virtual the same (Except LOCAL_SRC_FILES).

but launching the SAME project, i get in logcat:
06-11 19:04:39.498: D/dalvikvm(4175): Trying to load lib /data/data/pipero.corp.new/lib/libgame.so 0x40f8ce98
06-11 19:04:39.678: A/dalvikvm(4298) : Fatal signal 11 (SIGSEGV) at 0x000000030 (code=1)

What’s going on? I have been several days without solve this problem.

I have tried too using the last version on git, but it don’t compile.

I have try to compile in another tablet (An Android 3.2) And i getting the same problem. This time the log is:

06-12 15:16:16.610: I/DEBUG(85): ** ** ** ** ** ** ** **
06-12 15:16:16.610: I/DEBUG(85): Build fingerprint: ‘asus/WW_epad/TF101:3.2.1/HTK75/WW_epad-8.6.5.13-20110925:user/release-keys’
06-12 15:16:16.610: I/DEBUG(85): pid: 1183, tid: 1183 >>> pipero.corp.test <<<
06-12 15:16:16.610: I/DEBUG(85): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000030
06-12 15:16:16.610: I/DEBUG(85): r0 81304438 r1 0013c9e8 r2 ff7eae2b r3 00000030
06-12 15:16:16.610: I/DEBUG(85): r4 81301d5c r5 0013c3e8 r6 00000004 r7 0001f914
06-12 15:16:16.610: I/DEBUG(85): r8 b00133b8 r9 81304000 10 0031d000 fp 81000000
06-12 15:16:16.610: I/DEBUG(85): ip 00000000 sp be90cd98 lr 811281db pc 81124194 cpsr 00000030
06-12 15:16:16.610: I/DEBUG(85): d0 000000a043200000 d1 3ff0000043200000
06-12 15:16:16.610: I/DEBUG(85): d2 4e1983da42bea926 d3 42c8000000670ff0
06-12 15:16:16.610: I/DEBUG(85): d4 000001fd00623fe8 d5 3fe999999999999a
06-12 15:16:16.610: I/DEBUG(85): d6 3fe8000000000000 d7 3f8000003f4ccccd
06-12 15:16:16.610: I/DEBUG(85): d8 0000000000000000 d9 0000000000000000
06-12 15:16:16.610: I/DEBUG(85): d10 0000000000000000 d11 0000000000000000
06-12 15:16:16.610: I/DEBUG(85): d12 0000000000000000 d13 0000000000000000
06-12 15:16:16.610: I/DEBUG(85): d14 0000000000000000 d15 0000000000000000

So, signal 11 SEGV_MAPERR, i assume that is a problem with the compilation, the library is found, but the program cannot load it correctly. The JNI not execute jni_Onload.

Can I see your Android and Application mk-files?

Are the standard generated by create-android-project.sh

Application.mk:

APP_STL := gnustl_static
APP_CPPFLAGS := -frtti

(NOTE: I have tried to comment the flags, the first one is needed, the second one no, but don’t work)

Android.mk

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := game_shared

LOCAL_MODULE_FILENAME := libgame

LOCAL_SRC_FILES := helloworld/main.cpp …/…/Classes/Constants/StringSplit.cpp …/…/Classes/Singletons/SoundManager.cpp etc…

LOCAL_C_INCLUDES := $(LOCAL_PATH)/…/…/Classes

LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static

include $(BUILD_SHARED_LIBRARY)

$(call import-module,CocosDenshion/android) $(call import-module,cocos2dx)

In cocos2d-x 2.0, the libraries are static, could be a problem with some name thats is duplicated or something like that?

More info:

—- LOG TEST RUNNING HELLO WORLD ——
06-13 18:29:07.189: D/dalvikvm(11613): Trying to load lib /data/data/pipero.corporation.nyan/lib/libgame.so 0x40f87190
06-13 18:29:07.199: D/dalvikvm(11613): Added shared lib /data/data/pipero.corporation.nyan/lib/libgame.so 0x40f87190
06-13 18:29:07.269: W/apk path(11613): /data/app/pipero.corporation.nyan-2.apk
06-13 18:29:07.409: D/SurfaceView(11613): pckname = pipero.corporation.nyan
06-13 18:29:07.809: D/libEGL(11613): loaded /system/lib/egl/libGLES_android.so
06-13 18:29:07.859: D/libEGL(11613): loaded /system/lib/egl/libEGL_mali.so
06-13 18:29:07.919: D/libEGL(11613): loaded /system/lib/egl/libGLESv1_CM_mali.so
06-13 18:29:07.929: D/libEGL(11613): loaded /system/lib/egl/libGLESv2_mali.so
————————————- OK ——————————-

—- LOG TEST RUNNING TEST changing android files to mine ——
06-13 18:36:31.789: D/dalvikvm(12046): Trying to load lib /data/data/pipero.corporation.nyan/lib/libgame.so 0x40f8de18
06-13 18:36:31.799: A/libc(12046): Fatal signal 11 (SIGSEGV) at 0x00000030 (code=1)
————————————— FAIL —————————

It’s very strange.
I used cocos-2dx from git and some kind of versions under Windows and Mac OS, it was ok.
I haven’t got a Linux for test

I am new in cocos2dx and I am facing the same problem for last few days … If you found any solution then please help me out of this …

If I manually add the libgame.so file in that location what in error …. its error free but,

In the bulid time error occurred like this :

make: * No rule to make target `/cygdrive/d/android/cocos2d-x-master/T12/proj.android/…/…/cocos2dx/CCConfiguration.cpp’, needed by `obj/local/armeabi/objs/cocos2dx_static/CCConfiguration.o’. Stop.

what should I do fix this problem ?

Akarsh Middha wrote:

I am new in cocos2dx and I am facing the same problem for last few days … If you found any solution then please help me out of this …
>
If I manually add the libgame.so file in that location what in error …. its error free but,
>
In the bulid time error occurred like this :
>
make: * No rule to make target `/cygdrive/d/android/cocos2d-x-master/T12/proj.android/…/…/cocos2dx/CCConfiguration.cpp’, needed by `obj/local/armeabi/objs/cocos2dx_static/CCConfiguration.o’. Stop.
>
what should I do fix this problem ?

Answer is:

find the CCConfiguration.o. It is in the dir of Cocos2d-x root.
my project dir: D:2d-2.0-x-2.0.4\cocos2d-2.0-x-2.0.4\Cocos2dxSimpleGame;
root dir : D:2d-2.0-x-2.0.4\cocos2d-2.0-x-2.0.4delete all files in D:2d-2.0-x-2.0.4\cocos2d-2.0-x-2.0.4\Cocos2dxSimpleGame\proj.android\obj\local\armeabi\objs-debug

see also :编译Coco2d-x android 程序出现make: *** No rule to make target ...CCConfiguration.o'. Stop._make: *** no rule to make target 'clean'. stop.-CSDN博客

(Note the inline code highlights in the message - they explain the debugging/thought process)
Akarsh Middha wrote:

make: ***** No rule to make target `/cygdrive/@d/android/cocos2d-x-master@/T12/proj.android/…/…/@cocos2dx/CCConfiguration.cpp', needed by `obj@/local/armeabi/objs/cocos2dx_static/@CCConfiguration.o`'. Stop.

Is it possible that you copied this project from another drive/computer/cocos2d-x environment? Or to put it another way, do you have D:2d-x-master\\cocos2dx\\CCConfiguration.cpp@ on your computer? Your current project directory has a built obj, CCConfiguration.o, which is looking for the corresponding cpp source in the location it was *originally compiled* from/in. To “fix”, you must**clean** the project. This may either be done by deleting the objdirectory in your Project’sproj.androiddirectory or build running the build script with the clean option/parameter -build_native.sh clean. Following this, you must compile all the (native) sources again using build_native.sh`.

Hi Pipero…I have the same problem not getting what is the problem.I included myself created static library and cpp files.If u found solution please let me know….

Hello All,
I m working on xcode and eclipse with cocos2dx version 2.1.2
Code is working fine in xcode for ipad.
With same code I create a new eclipse project.
My project required juce and protobuffer library.So i made separate android.mk for both of them put respective cpp files and used Build static command to build that (as same as cocos2dx,cocosdension and extension android.mk files).
In my main android.mk(under jni folder) i gave my static libraries name and respective paths.

LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static cocos_extension_static cocos2dx_librarystatic juce_static OpenSource_static cocos2dx_RUIComponentsstatic

$(call import-module,CocosDenshion/android) $(call import-module,cocos2dx) $(call import-module,extensions)$(call import-module,myprojectname/Library)$(call import-module,myprojectname/RUIComponents)$(call import-module,myprojectname/proj.android/JuceMakeFile)$(call import-module,myprojectname/proj.android/OpenSourceMakeFile)
Project is building properly.I am getting all object files inside myprojectname/proj.android/obj/local/armeabi and libgame.so inside
myprojectname/proj.android/libs/armeabi/libgame.so

all things are proper but when i launch its giving black screen with logcat message
trying to load lib /data/data/org.apps.test/lib/libgame.so
Fatal signal 11.(sigsegv)

I m not getting what is the problem y its not able to load.If any1 knows about it Plz reply.
It is related with cocos2dx version?
Thanks

Hello All,
I m working on xcode and eclipse with cocos2dx version 2.1.2
Code is working fine in xcode for ipad.
With same code I create a new eclipse project.
My project required juce and protobuffer library.So i made separate android.mk for both of them put respective cpp files and used Build static command to build that (as same as cocos2dx,cocosdension and extension android.mk files).
In my main android.mk(under jni folder) i gave my static libraries name and respective paths.

LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static cocos_extension_static cocos2dx_librarystatic juce_static OpenSource_static cocos2dx_RUIComponentsstatic

$(call import-module,CocosDenshion/android) $(call import-module,cocos2dx) $(call import-module,extensions)$(call import-module,myprojectname/Library)$(call import-module,myprojectname/RUIComponents)$(call import-module,myprojectname/proj.android/JuceMakeFile)$(call import-module,myprojectname/proj.android/OpenSourceMakeFile)
Project is building properly.I am getting all object files inside myprojectname/proj.android/obj/local/armeabi and libgame.so inside
myprojectname/proj.android/libs/armeabi/libgame.so

all things are proper but when i launch its giving black screen with logcat message
trying to load lib /data/data/org.apps.test/lib/libgame.so
Fatal signal 11.(sigsegv)

I m not getting what is the problem y its not able to load.If any1 knows about it Plz reply.
It is related with cocos2dx version?
Thanks