Yeah, a good best-practice.  I'm linking to 5 other third-party libraries 
statically, but somehow that one slipped by.

Here is, fyi to all, the program to check that your mod is loadable and exports 
the right symbol.  Sure would be nice if srcds would do this for you though 
*cough*.  It would've caught my issue if I'd compiled it as follows, instead of 
using g++:

// gcc -ldl modtest.c -o modtest
#include <dlfcn.h>
#include <stdio.h>

int main(int argc, char* argv[]) {
    void* handle = dlopen(argv[1], RTLD_LAZY);
    if (!handle) {
        fprintf(stderr, "error loading .so: %s\n", dlerror());
        return 1;
    }

    void* sym = dlsym(handle, "CreateInterface");
    if (!sym) {
        fprintf(stderr, "error loading symbol - %s\n", dlerror());
        return 1;
    }

    printf("success\n");

    return 0;
}

At 2006/06/06 11:51 PM, Alfred Reynolds wrote:
>Linking to libstdc++ will cause your mod to fail to run on numerous
>Linux distributions (the reason we statically link to it). You should
>statically link also, the sample Makefile ship with an example of how to
>do that.
>
>- Alfred
>
>[EMAIL PROTECTED] wrote:
>> Ah - I should've thought of this, but it's rather late, thanks for
>> leading me down the right path there!
>>
>> There were several gnu symbols undefined because srcds_i486 and
>> srcds_i686 don't link to libstdc++.so, unlike the test program I was
>> using to check the validity of my .so, which of course was compiled
>> with g++.  I linked to it in the .so, which is really the kosher
>> thing to do anyway, and now it works.
>>
>> At 2006/06/06 11:29 PM, Alfred Reynolds wrote:
>>> What does "ldd -d aoa/bin/server_i486.so" return one you have run
>>> "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:." ?
>>>
>>> [EMAIL PROTECTED] wrote:
>>>> Neither srcds_i486 nor srcds_i686 will load my mod on FC5.  They
>>>> will load hl2mp however.  It's hard to say what's to blame because,
>>>> as has been discussed ad nauseam on the Verc forums, the srcds has
>>>> a bug where it gives no indication as to why it fails to load your
>>>> .so, it simply skips it and tries the hl2mp one.
>>>>
>>>> The usual tricks I've helped others perform in the past when they
>>>> couldn't get their mods to load don't help here, because my .so
>>>> really is loadable and exports the CreateInterface symbol, so
>>>> something new is at work.
>>>>
>>>> Anyone seen something like this?  Or, alternatively, know of any way
>>>> to get helpful info out of srcds?
>>>>
>>>> strace only reveals that it loaded the .so, but then unloaded it
>>>> shortly thereafter.  What it might have disliked about the .so is
>>>> not clear from the trace.
>>>>
>>>> open("/home/bk/source/aoa/bin/server_i486.so", O_RDONLY) = 4
>>>> read(4,
>>>> "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\240\207"..., 512)
>>>> = 512 fstat64(4, {st_mode=S_IFREG|0664, st_size=15746804, ...}) = 0
>>>> mmap2(NULL, 11697696, PROT_READ|PROT_EXEC,
>>>> MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 0x4e84000 mmap2(0x58cb000,
>>>> 458752, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE,
>>>> 4, 0xa46) = 0x58cb000 mmap2(0x593b000, 462368,
>>>> PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) =
>>>> 0x593b000
>>>> close(4)                                = 0
>>>> mprotect(0x4e84000, 10776576, PROT_READ|PROT_WRITE) = 0
>>>> munmap(0x4e84000, 11697696)             = 0
>>>> open("/home/bk/source/hl2mp/bin/server_i486.so", O_RDONLY) = 4
>>>>
>>>> _______________________________________________
>>>> To unsubscribe, edit your list preferences, or view the list
>>>> archives, please visit:
>>>> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>>>
>>> _______________________________________________
>>> To unsubscribe, edit your list preferences, or view the list
>>> archives, please visit:
>>> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>>
>> _______________________________________________
>> To unsubscribe, edit your list preferences, or view the list
>> archives, please visit:
>> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
>_______________________________________________
>To unsubscribe, edit your list preferences, or view the list archives, please 
>visit:
>http://list.valvesoftware.com/mailman/listinfo/hlcoders

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to