Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: libcod on Arch Linux

  1. #1
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts

    libcod on Arch Linux

    Hi, i am trying to get libcod (with mysql) working on Arch Linux.
    I am using mariadb as mysql server.

    If you have got 64bit Arch. Then download the mysql client files from there. (delete libmysqlclient.so and libmysqlclient.so.18 and copy libmysqlclient.so.18.0.0 2 times and rename them as the 2 files you removed)
    https://www.archlinux.org/packages/e...mariadbclient/

    My startup line (no new lines otherwise the preloads are ignored)
    Code:
    LD_LIBRARY_PATH=/path/to/libs/:/path/to/libs/mysql LD_PRELOAD=/path/to/libs/libcod2_1_3.so ./cod2_lnxded +set dedicated "2" +exec server.cfg +map_rotate
    But now after starting cod2 it crashes. I am using my own build from source. (also kung's build from 30 August crashes)

    Error message from dmesg
    Code:
    [80191.481300] cod2_lnxded[6964]: segfault at 4 ip 00000000f770a37b sp 00000000ffae0820 error 4 in libcod2_1_3.so[f7702000+12000]
    Last edited by Mitch; 25th September 2013 at 18:17.

  2. #2
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,010
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    since the instruction pointer (ip) is only valid in your .so, you need to upload it
    timescale 0.01

  3. #3
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    Quote Originally Posted by kung foo man View Post
    since the instruction pointer (ip) is only valid in your .so, you need to upload it
    I had to rebuild it, because i deleted it again when i was testing your build.
    Attached Files Attached Files

  4. #4
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,010
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    By the IP, it might be gsc_utils_ClientCommand() which is crashing, can you test it without this callback?

    Can you specify where it is crashing? Is libcod able to print some messages before crash or can't it start at all?
    timescale 0.01

  5. #5
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    Quote Originally Posted by kung foo man View Post
    By the IP, it might be gsc_utils_ClientCommand() which is crashing, can you test it without this callback?

    Can you specify where it is crashing? Is libcod able to print some messages before crash or can't it start at all?
    When i comment my persistence gsc out of my callbacksetup then it doesn't give me a segmentation fault. But when i add:

    Code:
    std\io::print("TEST");
    Then it crashes again.

  6. #6
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,010
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    Can you try to add many normal printf's to this function in https://github.com/kungfooman/libcod...master/gsc.cpp ?


    PHP Code:
    int cdecl_injected_closer()
    {
        
    int function;
        
    int playerid
    printf by printf you will get nearer to the buggy function.
    timescale 0.01

  7. #7
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    Quote Originally Posted by kung foo man View Post
    Can you try to add many normal printf's to this function in https://github.com/kungfooman/libcod...master/gsc.cpp ?


    PHP Code:
    int cdecl_injected_closer()
    {
        
    int function;
        
    int playerid
    printf by printf you will get nearer to the buggy function.
    It crashes here:
    PHP Code:
    printf("scriptengine> test b3\n");
        
        
        if (!
    stackGetParamInt(0, &function))
        {
            
    printf("scriptengine> ERROR: closer(): param \"function\"[0] has to be an integer!\n");
            return 
    0;
        }

        
    printf("scriptengine> test b4\n"); 
    It only shows 'scriptengine> test b3' and not the other 2 messages. (commenting the printf ...ERROR: closer().. out doesn't show the 'test b4' message.)
    Last edited by Mitch; 26th September 2013 at 22:09.

  8. #8
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,010
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    The function is in https://github.com/kungfooman/libcod...master/gsc.cpp

    PHP Code:
    // todo: check if the parameter really exists (number_of_params)
    int stackGetParamInt(int paramint *value)
    {
        
    //printf("stackGetParamInt() start...");
        
    aStackElement *scriptStack = *(aStackElement**)getStack();
        
    aStackElement *arg scriptStack param;
        if (
    arg->type != STACK_INT)
            return 
    0;
        *
    value = (int)arg->offsetData;
        
    //printf("... end\n");
        
    return 1;

    Now check in detail where it is crashing
    timescale 0.01

  9. #9
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    Quote Originally Posted by kung foo man View Post
    The function is in https://github.com/kungfooman/libcod...master/gsc.cpp

    PHP Code:
    // todo: check if the parameter really exists (number_of_params)
    int stackGetParamInt(int paramint *value)
    {
        
    //printf("stackGetParamInt() start...");
        
    aStackElement *scriptStack = *(aStackElement**)getStack();
        
    aStackElement *arg scriptStack param;
        if (
    arg->type != STACK_INT)
            return 
    0;
        *
    value = (int)arg->offsetData;
        
    //printf("... end\n");
        
    return 1;

    Now check in detail where it is crashing
    PHP Code:
    int stackGetParamInt(int paramint *value)
    {
        
    //printf("stackGetParamInt() start...");
        
    printf("scriptengine> test c1\n");
        
    aStackElement *scriptStack = *(aStackElement**)getStack();
        
    printf("scriptengine> test c2\n");
        
    aStackElement *arg scriptStack param;
        
    printf("scriptengine> test c3\n");
        if (
    arg->type != STACK_INT)
            return 
    0;
        
    printf("scriptengine> test c4\n");
        *
    value = (int)arg->offsetData;
        
    printf("scriptengine> test c5\n");
        
    //printf("... end\n");
        
    return 1;

    It prints c1, c2 and c3.

  10. #10
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,010
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    It can be either the dereferencing of value for writing (would be very strange) or the dereferencing of arg for reading.

    Try:


    PHP Code:
    printf("scriptengine> test c4 value=%.8x scriptStack=%.8x arg=%.8x\n"valuescriptStackarg); 
    timescale 0.01

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •