IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Compiling under Linux, Bag of fun!
iprice
post Jul 20 2005, 02:52 PM
Post #1


Newbie
*

Group: Members
Posts: 4
Joined: 9-June 05
Member No.: 572



Hi,

Noticed a bit of discussion about the Linux compilation was in the other thread but thought it might be better to break this out.... I'm fairly dedicated to geting this thing (re)built under linux, and heres my story so far...

A couple of months ago I setup a 'training comm etc' server on my home Linux box, 12 bots and a few player slots for commander / etc.

Compiling RCBot was rather difficult, I was using "gcc version 3.3 20030226 (prerelease) (SuSE Linux)" as the compiler and had to make various modifications to the sources to get it to compile.

Please note while I am a programmer I am *not* a C++ programmer (never liked the language, but something I always felt I needed overcome perhaps one day). One of the things I hate about the C strain is the error messages from most compilers are horrendous.

Anyway lets not get into the old programming language holy wars, just wanted to point out I have very little idea specifically what i'm doing, but a sound backgound in programming and Unix and so forth.

I found the 'linux binaries' supplied would just crash randomly, particularly on bot add's as detailed in various forums, which is what got me working on the source.

I made the following changes to the rcbot source distribution to get it to compile under linux and run successfully - the only issue apart from the AI being a bit poor in places (like skulks at your bot's feet dont get seen usually ohmy.gif, rines obsessed with rushing and knifing OCs etc) was the max_paths_revs falling to 0 after a while, which isn't too bad and something i'd schedule a cronjob/rcon to fix quite easily.
*) The addition of "-I ." to the makefile parameters to include the current directory in the include search
*) The addition of the "-fpermissive" flag to the makefile to ignore errors regarding ISO C++ standards violation, variables declared with no type (?) etc
*) Then things got wierd, I get errors like
CODE
bot.cpp: In member function `BOOL CBot::FacingIdeal()':
bot.cpp:281: error: call of overloaded `abs(float)' is ambiguous
/usr/include/stdlib.h:778: note: candidates are: int abs(int)
/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/cstdlib:153: note:                 long long int __gnu_cxx::abs(long long int)
/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/cstdlib:123: note:                 long int std::abs(long int)
... Which I *bodged* around by changing "abs" into "fabs"
*) There was some error compiling the HAL module, where it tries to select something from a list... I forget the exact error, I just made the code do nothing since I didn't want HAL functionality anyway.

And shockingly for someone who doesn't know what they're doing, this worked and the bots did run around and die lots (their ranking on psychostats is horrible biggrin.gif).

Anyway, it lagged lots because it was running on a busy server, and the internet pipe to that server sucks for upstream anyway, so I recently got a new box and was working on moving it over to there... The compiler is now: gcc version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)


Reason I am now writing is I am again stuck on various syntactic C issues, and I don't have the knowledge to resolve these. With the above fixes (except the HAL one which the makefile hasn't tried to compile yet) in place, I now get the following error:

CODE
# make -f makefile_linux_mm 2>&1|less
g++ -Dstricmp=strcasecmp -Dstrcmpi=strcasecmp -DRCBOT_META_BUILD -fpermissive  -m486 -O2 -w -I../engine -I../common -I../pm_shared -I.  -c bot.cpp -o bot.o
`-m486' is deprecated. Use `-march=i486' or `-mtune=i486' instead.
In file included from bot.h:57,
                from bot.cpp:59:
generic_class.h: In member function `void dataUnconstArray<T>::Remove(T)':
generic_class.h:959: error: expected `;' before "it"
generic_class.h:961: error: `it' undeclared (first use this function)
generic_class.h:961: error: (Each undeclared identifier is reported only once for each function it appears in.)
make: *** [bot.o] Error 1


Now somehow I worked out this is related to the 'vector' type, and line 49 of generic_class.h reads "#include <vector>" which if i change it to "#include <vector.h>" changes the error to a similar one in a different place tongue.gif

CODE
g++ -Dstricmp=strcasecmp -Dstrcmpi=strcasecmp -DRCBOT_META_BUILD -fpermissive  -m486 -O2 -w -I../engine -I../common -I../pm_shared -I.  -c bot.cpp -o bot.o
`-m486' is deprecated. Use `-march=i486' or `-mtune=i486' instead.
In file included from bot.h:57,
                from bot.cpp:59:
generic_class.h:1018: error: expected `;' before '<' token
generic_class.h: In member function `int dataUnconstArray<T>::Size()':
generic_class.h:951: error: `array' undeclared (first use this function)
generic_class.h:951: error: (Each undeclared identifier is reported only once for each function it appears in.)
generic_class.h: In member function `void dataUnconstArray<T>::Remove(T)':
generic_class.h:956: error: `array' undeclared (first use this function)
generic_class.h:959: error: `vector' undeclared (first use this function)
generic_class.h:959: error: expected primary-expression before '>' token
generic_class.h:959: error: `::iterator' has not been declared
generic_class.h:959: error: expected `;' before "it"
generic_class.h:961: error: `it' undeclared (first use this function)
generic_class.h: In member function `void dataUnconstArray<T>::Destroy()':

followed by tons more 'undeclared' errors for variable 'it' and 'array', followed by similar barfage from other source files.

The source i'm using is listed as "RCBot Source, Latest source for latest beta" on the downloads page.

What i'm looking for is a bit of help with the C++ language and some interpretation of the errore messages, and I would like to try and work on getting this source compiled on linux, ideally the same source should compile on win and linux, but even if it comes down to a separate 'inferior/out of date' package for linux it would be a start!

My only other option I can think of trying is to downgrade the new C++ compiler back to the previous version and try compiling on the new machine again... Needless to say this is a horrible option I'd really rather not go down.

Thanks for your time, and any help you can offer.

Iain
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Cheeseh
post Jul 20 2005, 03:56 PM
Post #2


Admin
*****

Group: Admin
Posts: 3,066
Joined: 11-September 03
From: uk
Member No.: 1



change abs to fabs

get the std library for vector for linux if possible, I am not sure where to get these. I have not compiled under linux since adding this functionality.

try asking/emailing member "mmaster" he compiled in linux

mmaster http://rcbot.bots-united.com/forums/index.php?showuser=567
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
iprice
post Jul 20 2005, 06:04 PM
Post #3


Newbie
*

Group: Members
Posts: 4
Joined: 9-June 05
Member No.: 572



Found something called stl_vector.h, even ships with the operating system / c compiler...however I seem to get just as useless error messages from the stl compile, the error messages are all syntactic (should have a ; here, a , there etc) and hence totally baffling to me because thats clearly not the /real/ problem here smile.gif

I dropped mmaster a message, see what happens smile.gif

At least I remember why I stopped compiling sources, errors in dependancies of sub dependancies, many hours of fighting something I dont understand ohmy.gif

Longer term, do you have an interest in this package working on both Linux and Windows or is the focus mainly just on Windows with Linux being a 'if it works, it works' side-line? Just wondering if, assuming it all gets working eventually, I should leave it there or if theres a future in trying to get the sources united for linux/windows.

I presumed the 'abs' thing is an overloaded function or something, and fabs specifies the float version... Is there any reason why switching the abs calls to fabs would break the windows compile?

Anyway, many thanks for the input and quick response smile.gif

Iain
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
iprice
post Aug 5 2005, 12:38 PM
Post #4


Newbie
*

Group: Members
Posts: 4
Joined: 9-June 05
Member No.: 572



oK, well, I thought i'd touch back in here, just incase anyone was wondering about my progress biggrin.gif

I got the 'linuxified' source code, but still had issues compiling the code (the "expected ; before 'it'" error, which means so little to me)

I downloaded GCC 3.3.6 and compiled this (and omg it wouldn't compile... i actually had to modify the sources for the C compiler to get it to compile under GCC 3.4)... Anyway this actually fixes the error, so stick with GCC 3.3.6 rather than 3.4.4 unless you actually know something about GC(C++) error messages ohmy.gif

Just gone back to my server however after running the bots for a couple of days to find the machine pretty much dead on its feet... The HLDS server has grown to consume over 1.5GB of ram ohmy.gif IIRC, was there a memory leak in older versions of RCBot?

Which leads me to wonder what else has changed in the source code since the version i'm compiling... Are there any ways of tracking versions of the code, generating 'diff's of the changes which I could try apply to the source... or getting the unmodified version of the RCBot sources for the version the linux code is based on (so i can see /those/ diffs and reapply to the latest greatest rcbot code)?

I did notice the other thread about CVS, so perhaps none of this is in place yet?

Anyway, got it working again, where to go from here to keep it 'up to date' with the latest developments?

Thanks,
Iain
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Cheeseh
post Aug 5 2005, 04:14 PM
Post #5


Admin
*****

Group: Admin
Posts: 3,066
Joined: 11-September 03
From: uk
Member No.: 1



I haven't got CVS working .. I need MSVC 6 to have some sort of CVS capability and a CVS server, and that wont really help with knowing what changes were made in previous versions, only in future versions from when CVS is put in place.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
iprice
post Aug 5 2005, 05:21 PM
Post #6


Newbie
*

Group: Members
Posts: 4
Joined: 9-June 05
Member No.: 572



Generally CVS is 'editor' and 'development environemnt' independant (or can be)... If you can deal with the source files for the project, then you can just CVS those up normally. I would guess MSVC is only necessary if you want flashy "Upload Sources!!!" buttons in your Microsoft IDE.

Hardly a microsoft fan here, sure the MS approach is to create a huge monolithic almost-does-what-you-want application, but CVS and Unix favour more component based approaches. A development environment for development, and a stand alone CVS package for versionning.. And so on.

E.g. WinCVS if you insist on using *that* platform biggrin.gif

I doubt MSVC (wether this means MS Visual C or MS Version Control is ambiguous, and both are guesses) is actually necessary.

Iain
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
billcat
post Feb 24 2006, 12:44 AM
Post #7


Member
**

Group: Members
Posts: 24
Joined: 6-October 03
Member No.: 65



Any chance you could upload a working linux binary?

Seems like loads of work are going into getting this built, then no binary gets published.

After reading the above note about gcc versions, I upgraded to gcc 3.3.6.

I now get the following build errors:

make -fmakefile_linux_mm
g++ -Dstricmp=strcasecmp -Dstrcmpi=strcasecmp -DRCBOT_META_BUILD -mcpu=i486 -O2 -w -I. -I../engine -I../common -I../pm_shared -fpermissive -c bits.cpp -o bits.o
In file included from bot.h:60,
from bits.cpp:55:
generic_class.h: In member function `T* dataStack<T>::ChoosePointerFromStack()
[with T = weapon_preset_t]':
bot_weapons.h:378: instantiated from here
generic_class.h:717: error: `BugMessage' undeclared (first use this function)
generic_class.h:717: error: (Each undeclared identifier is reported only once
for each function it appears in.)
In file included from bits.cpp:55:
bot.h: At global scope:
bot.h:116: error: `void BugMessage(edict_t*, char*, ...)' used prior to
declaration
make: *** [bits.o] Error 1
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
billcat
post Feb 24 2006, 02:00 AM
Post #8


Member
**

Group: Members
Posts: 24
Joined: 6-October 03
Member No.: 65



made a little headway.

commented out everything related to bugmessage.

(shouldn't this be DEbugmessage as it is all over in the rest of the code?)

now I get the following:

root@suitcase:/raid/transfer/rcbot/dlls# make -fmakefile_linux_sa
g++ -Dstricmp=strcasecmp -Dstrcmpi=strcasecmp -mcpu=i486 -O2 -w -I. -I../engine -I../common -I../pm_shared -fpermissive -c bot.cpp -o bot.o
g++ -Dstricmp=strcasecmp -Dstrcmpi=strcasecmp -mcpu=i486 -O2 -w -I. -I../engine -I../common -I../pm_shared -fpermissive -c bot_client.cpp -o bot_client.o
generic_class.h: In member function `void
dataUnconstArray<T>::RemoveByPointer(T*) [with T = TSObjective]':
bot_client.cpp:409: instantiated from here
generic_class.h:976: error: no matching function for call to `
std::vector<TSObjective, std::allocator<TSObjective> >::erase(TSObjective*&)
'
/usr/local/include/c++/3.3.6/bits/vector.tcc:105: error: candidates are:
__gnu_cxx::__normal_iterator<_Tp*, std::vector<_Tp, _Alloc> >
std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<_Tp*,
std::vector<_Tp, _Alloc> >) [with _Tp = TSObjective, _Alloc =
std::allocator<TSObjective>]
/usr/local/include/c++/3.3.6/bits/vector.tcc:117: error:
__gnu_cxx::__normal_iterator<_Tp*, std::vector<_Tp, _Alloc> >
std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<_Tp*,
std::vector<_Tp, _Alloc> >, __gnu_cxx::__normal_iterator<_Tp*,
std::vector<_Tp, _Alloc> >) [with _Tp = TSObjective, _Alloc =
std::allocator<TSObjective>]
make: *** [bot_client.o] Error 1
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 31st October 2024 - 12:25 AM