Advertisement

2.16.0 Crash on 64bit Linux

Started by April 15, 2009 03:49 PM
19 comments, last by Wavesonics 15 years, 7 months ago
So I FINALLY got around to porting my project to Linux, noticing that the new version 2.16.0 (i was on 2.15.0) had fixes for 64bit Linux, I upgraded. And that went smoothly. So with my project running on Win32 using the new AS version, I went back to getting it to compile on 64bit Linux, I have the whole thing compiling now, but:

ScriptEngine::ScriptEngine() {
    // Create the script engine
    m_engine = asCreateScriptEngine( ANGELSCRIPT_VERSION );

    int r = 0;
    // Set the message callback to receive information on errors in human readable form.
    // It's recommended to do this right after the creation of the engine, because if
    // some registration fails the engine may send valuable information to the message
    // stream.
    r = m_engine->SetMessageCallback(asFUNCTION(msgCallback), 0, asCALL_CDECL); assert( r >= 0 );


The last line there crashes. Now it's important to note, that this happens during static initialization because there is a global instance of *ScriptEngine*. And I get a segfault. 2 questions I guess: 1) Are there any changes to the new version that would effect this that I should know about? 2) What defines should I be compiling the lib with for 64bit Linux? I'm currently compiling with:
Quote: ANGELSCRIPT_EXPORT NDEBUG
==============================
A Developers Blog | Dark Rock Studios - My Site
I can only think of one cause for this crash. The asCreateScriptEngine() call returned NULL because ANGELSCRIPT_VERSION in your application doesn't match the one in the library.

Are you sure you recompiled the library correctly?

Try printing the strings returned by asGetLibraryVersion() and asGetLibraryOptions().

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement
Ok, i did some recompiling and I think you were right, there are several different libraries, and I think 1 of them had been compiled against the old version of AS.

But I'm getting another crash now:

ScriptEngine::ScriptEngine() {    // Create the script engine    m_engine = asCreateScriptEngine( ANGELSCRIPT_VERSION );    int r = 0;    // Set the message callback to receive information on errors in human readable form.    // It's recommended to do this right after the creation of the engine, because if    // some registration fails the engine may send valuable information to the message    // stream.    r = m_engine->SetMessageCallback(asFUNCTION(msgCallback), 0, asCALL_CDECL); assert( r >= 0 );    m_engine->BeginConfigGroup( "Common" );    // AngelScript doesn't have a built-in string type, as there is no definite standard    // string type for C++ applications. Every developer is free to register it's own string type.    // The SDK do however provide a standard add-on for registering a string type, so it's not    // necessary to register your own string type if you don't want to.    RegisterScriptString( m_engine );    r = m_engine->RegisterObjectType("char", sizeof(char), asOBJ_VALUE | asOBJ_POD | asOBJ_APP_PRIMITIVE); assert( r >= 0 );    // Register the World    r = m_engine->RegisterObjectType("World", sizeof(World), asOBJ_REF ); assert( r >= 0 );    r = m_engine->RegisterObjectBehaviour("World", asBEHAVE_ADDREF, "void f()", asFUNCTION(DumbyAddRef), asCALL_CDECL_OBJFIRST); assert( r >= 0 );    r = m_engine->RegisterObjectBehaviour("World", asBEHAVE_RELEASE, "void f()", asFUNCTION(DumbyReleaseRef), asCALL_CDECL_OBJFIRST); assert( r >= 0 );


The 2nd to last line there fails the assert, but only on 64bit Linux, it's fine on windows.

*edit*
I just printed our r and it's -7
Idk what that means...
==============================
A Developers Blog | Dark Rock Studios - My Site
-7 is asNOT_SUPPORTED.
Hehe crap, i was posting that just as u posted it, thx though.

But wth does it mean?!
Quote:
The array type is not supported, or already in use preventing it from being overloaded.


And why would this only crop up on Linux?
==============================
A Developers Blog | Dark Rock Studios - My Site
Did you print the string that asGetLibraryOptions() return? I have a feeling that it will contain the identifier AS_MAX_PORTABILITY, which is why the asCALL_CDECL_OBJFIRST calling convention would be unsupported.

If this is true, then for some reason the as_config.h file doesn't recognize your target platform as 64bit/Linux. Probably the following line (line 458 in as_config.h) is evaluated as true on your setup:

	#if defined(i386) && !defined(__LP64__)


Could you show me the preprocessor macros that are defined in your setup. I'm not sure but I think you can obtain these by running 'gcc -d' or something similar.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement
Thanks again for all the help,

I recompiled everything again just to make damn sure, but in my project compiler defines I have:
Quote:
ANGELSCRIPT_EXPORT
NDEBUG


And asGetLibraryOptions() reports as you expected:
Quote:
AS_MAX_PORTABILITY AS_64BIT_PTR AS_LINUX


Now it looks like it's picking up the importaint parts there, 64bit + linux...

Also it should be said, I'm compiling on a virtualized Ubuntu install using Sun VirtualBox.

** edit **
I put "i386" in as a define and it compiles and runs!
==============================
A Developers Blog | Dark Rock Studios - My Site
I need to know the default preprocessor macros, i.e. the ones that are defined automatically by the compiler and not the ones defined manually in your makefile. There is a way to tell the compiler to output all the defines (verbose), I just don't remember how it's done at the moment.

What CPU do you have on your machine? So far native calling conventions are only supported for x86/64. Should work on either AMD or Intel, but not for Itanium64.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

For gcc's c pre-processor (cpp) you can use:
touch foo.h; cpp -dM foo.h

to get all of the predefined macros.
I'm using g++ on 64bit Ubuntu 8.10
The processor is an Intel Q9550
I'm not 100% sure if thats what Ubuntu is seeing it as how ever since I am running it through VirtualBox.

Quote:
g++ -dumpmachine test.cpp
x86_64-linux-gnu


I took a look through:
Quote:
g++ --help


And didn't find anything switches that would be helpful for what you want, I'll take a look again and ask around when I get a free moment.
==============================
A Developers Blog | Dark Rock Studios - My Site

This topic is closed to new replies.

Advertisement