IPB

Welcome Guest ( Log In | Register )

> 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

Posts in this topic


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: 27th January 2020 - 10:46 AM