[ CRITICAL ] [ IMPORTANT ] Getting FATAL Error in libc

I am using v3.2 alpha release.
I am getting this error for Android :
A/libc(818): Fatal signal 11 (SIGSEGV) at 0x0000000c (code=1), thread 833 (Thread-56)

I followed the NDK Crash Dump. it gives me this :

My iOS Port is working fine with no errors.

Any Idea whats going wrong here ?
[ I think its a segmentation error ]

How to resolve it ?

I think this library got updated for this alpha release ( v3.2 ).
I think something messed up in the update.

Edit : it was libcurl for which 3.2 alpha was released and not libc. My bad. Sorry.

@walzer @zhangxm @Wuhao @slackmoehrle guys hav you seen this post ?

How to reproduce it?

initialise 12-15 sprites from SpriteFrameCache !!!
Thats what i did i got the errorā€¦

[ i subclassd my GameSprite from Sprite Class. Used that GameSprite and nothing else ]
[ i have 2 scheduler methods ]
[ i have 3 Touch methods (TouchBegan,TouchMoved,TouchEnded) ]
[ i have used Vector<> extensively with std::vector ]

Thats all there is in my game. And its working fine for iOS.

are you using new anyplace in your code? If so where? Can we see some code?

Also, please PM me directly, please donā€™t directly ping the developers. They have work to do! Let me coordinate these things with you and I can seek help as we need it.

:frowning: No more movement in this postā€¦ and in my android PORTā€¦ i think i will need to launch my game as iOS only ā€¦ sad but true ā€¦
From now on i hate NDK ā€¦ thats a worst thing Google Ever developedā€¦NDK is drunk everytimeā€¦
Thanks to Apple for giving full support for c++ 11 in xcode + making c++ code work with iOS flawflessly !

eclipse or command-line?

i used xcode for coding and eclipse for Android deployment

well donā€™t get frustrated.

There are thousands of games made with cocos2d-x are are extremely successful.
There could have been some issue,

I am sure it will be solved, only patience is required.
Devs and other experts are there to help everyone, it may take a bit long to figure out
but surely something is fishy.

and may i remind you cocos2d-x is cross platform not platform independent
anyways.

I hope it gets figured out soon.
Till then

Happy Coding :smile:

im having the same problem.my images i get from a spritesheet. itā€™s all working fine in iOS. but when i port it to eclipse for android build damn, it crashes and says "FATAL SIGNAL 11 " libc , , whatā€™s happening? hopefully someday cocos2dx comes up with its own tools for android build and dont have to rely on Eclipse

im using cocos2dx 3.2

Please show how you create a sprite and how does your resource folder look like in Xcode project? Is it blue?
Another option may be undefined behaviour somewhere in your code that doesnā€™t show itself on ios, but causes a crash on android. Try checking indexes, instantiation order etc

ok wait, iā€™ll post thE code when i get home, thnx

I managed to make it work! I dont blame ECLIPSE on this one, itā€™s just that iOS tolerates my method of displaying sprite like:
(My ā€œKeypadTileā€ is derived from Sprite )
KeypadTile* keypadbutton = (KeypadTile*)KeypadTile::create(ā€œkeypadpic.pngā€);// I am using Sprite classā€™ ā€œcreateā€ method, not my user-defined method.
addChiled(keypadbutton);

iOS still displays my picture. But when you port that to Android, it doesnt accept such way of coding. so I fixed it. HOW?

I made my own class of displaying a sprite image inside my KeypadClass class.

KeypadTile.cpp

KeypadTile* KeypadTile::createKeypadTileWithFileName(const char *fileName){
//create an object
KeypadTile sprite = new KeypadTile();
//if object createdā€¦
// SpriteFrameCache
cachetwo = SpriteFrameCache::getInstance();
// cachetwo->addSpriteFramesWithFile(ā€œsunkenbuttons.plistā€); // if PNG file and plist file have the same filename
if (sprite->initWithSpriteFrameName(fileName) ) {

    //memory management o perations :)
    sprite->autorelease();
    //show object in the screen
    return sprite;
}
//if up condition has mistakes, safely return NULL
CC_SAFE_DELETE(sprite);
return NULL;

}

then, I used it .

KeypadTile* keypadbutton = KeypadTile::createKeypadTileWithFileName(ā€œkeypadpic.pngā€);
addChiled(keypadbutton);

and voila, no bugs! :D, good for Android and iOS :smile: !

I LOVE COCOS2DX!

This is your problem. If you subclass Sprite, you must override the create method. This is becauseā€¦

Sprite* Sprite::create(const std::string& filename, const Rect& rect)
{
    Sprite *sprite = new (std::nothrow) Sprite();

Sprite ā€˜createā€™ uses ā€˜new Sprite()ā€™. You can recast it as (KeypadTile*) but it is not a KeypadTile object, it is a Sprite() object. So you must rewrite the ā€˜createā€™ methodā€¦

KeypadTile* KeypadTile::create(const std::string& filename, const Rect& rect)
{
    KeypadTile *sprite = new (std::nothrow) KeypadTile();

If you want to be sure, use dynamic_cast<KeypadTile*> then check the result, to make sure you are actually getting a KeypadTile* object.

Iā€™ve found that iOS tolerates this error but Android doesnā€™t. It is still wrong though so you should always override the create method.

2 Likes

whoa! thnx for this concepts, Iā€™ll google what ā€˜overrideā€™ means in C++ OOP. :smile: hv a great day!
[SOLVED]