.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   General Bot Coding (http://forums.bots-united.com/forumdisplay.php?f=24)
-   -   LoadLibrary failure for Linux (http://forums.bots-united.com/showthread.php?t=3363)

Ghoul 08-01-2005 22:16

LoadLibrary failure for Linux
 
I recently was able to get my bot compiling under Linux. However, when I try to use the bot, HLDS reports this:

Quote:

LoadLibrary failed on ./valve/dlls/grave_i386.so: ./valve/dlls/grave_i386.so: undefined symbol: __cxa_guard_acquire
Host_Error: Couldn't get DLL API from ./valve/dlls/grave_i386.so!
FATAL ERROR (shutting down): Host_Error: Couldn't get DLL API from ./valve/dlls/grave_i386.so!
Anybody know what this "__cxa_guard_acquire" is? Also, even though my liblist.gam points to grave_bot_i386.so, the dedicated server insists on loading grave_i386.so. I had to rename the file. Very strange behavior...

[EDIT] Some additional information. I'm compiling under Fedora Core 3 using GCC 3.4 with it's C++ libraries. Googling "__cxa_guard_acquire" gave me some pages talking about how GCC uses it in linking to make things "thread-safe". I'm not experienced enough with GCC to understand what all of this means exactly. I'm guessing there is perhaps a parmeter I can set in the makefile to disable using __cxa_guard_acquire, but I'm not sure what it'd be...

If someone with a Linux box would volunteer to compile what I have and see if it is a problem with my Fedora Core 3 box (Googling hints at this) or my source, that'd be nice. Any takers? E-mail me, ghoul at nocensmundus dot net.

botmeister 09-01-2005 00:35

Re: LoadLibrary failure for Linux
 
Quote:

Also, even though my liblist.gam points to grave_bot_i386.so, the dedicated server insists on loading grave_i386.so. I had to rename the file. Very strange behavior...
I noticed the same thing, it's very odd behavior.

botman 09-01-2005 01:35

Re: LoadLibrary failure for Linux
 
"I'm guessing there is perhaps a parmeter I can set in the makefile to disable using __cxa_guard_acquire, but I'm not sure what it'd be..."

If you have "-thread" in the Makefile, try removing it. If you don't have "-thread" try adding it on the gcc line. :)

botman

Ghoul 10-01-2005 01:52

Re: LoadLibrary failure for Linux
 
GCC complains that it is an unrecognized option. I'm not sure exactly where I'd add it, I tried the various flag lines of the makefile. My makefile currently looks like this (based on HPB Bot 4):
http://www.nocensmundus.net/gb_linux_makefile.txt

Whistler 19-01-2005 06:55

Re: LoadLibrary failure for Linux
 
Change the "gcc" to "g++" will probably solve your problem. gcc is the C compiler while the "g++" is the C++ compiler.

You may also want to add a "-static" parameter in the link command to make the .so file runs under any GNU/Linux systems.

Ghoul 20-01-2005 23:47

Re: LoadLibrary failure for Linux
 
Hey thanks, I got it working. (though I'm not sure where to add that -static flag).

Using the normal hooking method, the bot runs great.

Now comes getting it to run in metamod. I can get the metamod version to compile, but metamod reports the file is bad when I do "metamod list". I compared the Grave Bot metamod .so to the HPB Bot 4 metamod .so, and HPB Bot is nearly twice as big. That seems strange, because I know HPB Bot doesn't have that much more code. It has the extra model and chatting code, but I don't see how that'd double the size compared to my .so.

[EDIT] Actually, I just compiled HPB bot 4 and it's the same size, which is about half the size of the .so downloaded off the website. What is going on?

[EDIT TWO] It still works though. Does this have something to do with -static?


I think something isn't getting properly compiled into the metamod .so, but I'm not sure what. I'm not too experienced with metamod.

Any ideas?

Pierre-Marie Baty 21-01-2005 01:21

Re: LoadLibrary failure for Linux
 
debug builds in Linux have VERY much extra info embedded in the binaries. And given several parameters (compiler version, libC version, external libs etc.) the exact same source code compiled on 2 Linux machines will not necessarily give the same size (and size can differ greatly). There's a command-line tool to strip the debug symbols from your binaries, called "strip" if I remember well.

*edit* also check if your machine is set up for Unicode or not.

Whistler 21-01-2005 01:42

Re: LoadLibrary failure for Linux
 
change this one:
PHP Code:

${TARGET}_i386.so: ${OBJ}
    ${
CPP} -fPIC -shared -$@ ${OBJ} -Xlinker -Map -Xlinker ${TARGET}.map -ldl 

to:
PHP Code:

${TARGET}_i386.so: ${OBJ}
    ${
CPP} -fPIC -shared -static -$@ ${OBJ} -Xlinker -Map -Xlinker ${TARGET}.map -ldl
    strip 
-${TARGET}_i386.so 


Ghoul 21-01-2005 02:05

Re: LoadLibrary failure for Linux
 
Well, that did make the file size less. The MM .so is 30 KB smaller, and the normal .so is around 80 KB smaller.

However, metamod still refuses to load the file. I'm completely baffled. Perhaps a linux specific section for metamod was missed when porting the code?

Hmmm...

Whistler 21-01-2005 02:09

Re: LoadLibrary failure for Linux
 
I'm sure the MM problem is because of your source code. Probably something is missing or wrong.

Does it work on Windows ?


All times are GMT +2. The time now is 06:11.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.