.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > General Bot Coding
General Bot Coding See what a pain it is to get those little mechs shooting around

Reply
 
Thread Tools
LoadLibrary failure for Linux
Old
  (#1)
Ghoul
Moderator
 
Status: Offline
Posts: 56
Join Date: Jul 2004
Location: Michigan
Default LoadLibrary failure for Linux - 08-01-2005

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.

Last edited by Ghoul; 09-01-2005 at 01:58..
  
Reply With Quote
Re: LoadLibrary failure for Linux
Old
  (#2)
botmeister
Ex-Council Member
 
botmeister's Avatar
 
Status: Offline
Posts: 1,090
Join Date: Nov 2003
Location: Canada
Default Re: LoadLibrary failure for Linux - 09-01-2005

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.


Maker of the (mEAn) Bot.Admin Manager

"In theory, there is no difference between theory and practice. But, in practice, there is." - Jan L.A. van de Snepscheut
  
Reply With Quote
Re: LoadLibrary failure for Linux
Old
  (#3)
botman
Super Moderator
 
Status: Offline
Posts: 280
Join Date: Jan 2004
Location: Plano, TX
Default Re: LoadLibrary failure for Linux - 09-01-2005

"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
  
Reply With Quote
Re: LoadLibrary failure for Linux
Old
  (#4)
Ghoul
Moderator
 
Status: Offline
Posts: 56
Join Date: Jul 2004
Location: Michigan
Default Re: LoadLibrary failure for Linux - 10-01-2005

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

Last edited by Ghoul; 10-01-2005 at 03:05..
  
Reply With Quote
Re: LoadLibrary failure for Linux
Old
  (#5)
Whistler
Summoner
 
Whistler's Avatar
 
Status: Offline
Posts: 1,498
Join Date: Feb 2004
Location: Mist Village
Default Re: LoadLibrary failure for Linux - 19-01-2005

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.
  
Reply With Quote
Re: LoadLibrary failure for Linux
Old
  (#6)
Ghoul
Moderator
 
Status: Offline
Posts: 56
Join Date: Jul 2004
Location: Michigan
Default Re: LoadLibrary failure for Linux - 21-01-2005

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?

Last edited by Ghoul; 21-01-2005 at 00:57..
  
Reply With Quote
Re: LoadLibrary failure for Linux
Old
  (#7)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 4643'60N 043'0W 0.187A
Default Re: LoadLibrary failure for Linux - 21-01-2005

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.



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."

Last edited by Pierre-Marie Baty; 21-01-2005 at 02:23..
  
Reply With Quote
Re: LoadLibrary failure for Linux
Old
  (#8)
Whistler
Summoner
 
Whistler's Avatar
 
Status: Offline
Posts: 1,498
Join Date: Feb 2004
Location: Mist Village
Default Re: LoadLibrary failure for Linux - 21-01-2005

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 
  
Reply With Quote
Re: LoadLibrary failure for Linux
Old
  (#9)
Ghoul
Moderator
 
Status: Offline
Posts: 56
Join Date: Jul 2004
Location: Michigan
Default Re: LoadLibrary failure for Linux - 21-01-2005

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...
  
Reply With Quote
Re: LoadLibrary failure for Linux
Old
  (#10)
Whistler
Summoner
 
Whistler's Avatar
 
Status: Offline
Posts: 1,498
Join Date: Feb 2004
Location: Mist Village
Default Re: LoadLibrary failure for Linux - 21-01-2005

I'm sure the MM problem is because of your source code. Probably something is missing or wrong.

Does it work on Windows ?
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com