Bug-report regarding torcs-1.3.4 installation and robotgen -- including fixes

Jasper van de Ven <[email protected]>
Newsgroups gmane.games.torcs.general
Message-ID <[email protected]>
Hello,
while preparing a system in order to develop a robot for torcs, I came
across two minor problems.
I am using a Ubuntu 12.10 64Bit system and the "For Linux and FreeBSD
from "all-in-one" Source Package".

The first is a small bug in the make-setup of torcs-1.3.4. When
executing the 'make' command I got a linker error stating:

g++ main.o linuxspec.o -L/home/<...>/torcs-1.3.4/export/lib  -lopenal
-lalut -lvorbisfile -L/usr/lib  -lracescreens -lrobottools -lclient
-lconfscreens -ltgf -ltgfclient -ltxml -lplibul -lraceengine
-lmusicplayer -llearning -lplibjs -lplibssgaux -lplibssg -lplibsm
-lplibsl -lplibsg -lplibul -lglut -lGLU -lGL -lpng -lz -ldl -lXrandr
-lXrender -lXxf86vm -lXmu -lXi -lXt -lSM -lICE -lXext -lX11 -lm  -o
torcs-bin
/home/<...>/torcs-1.3.4/export/lib/libraceengine.so: undefined reference
to `RmShowStandings(void*, RmInfo*)'
/home/<...>/torcs-1.3.4/export/lib/libraceengine.so: undefined reference
to `RmDriversSelect(void*)'
/home/<...>/torcs-1.3.4/export/lib/libraceengine.so: undefined reference
to `RmPitMenuStart(CarElt*, void*, void (*)(void*))'
/home/<...>/torcs-1.3.4/export/lib/libraceengine.so: undefined reference
to `RtTrackGetSeg(tTrkLocPos*)'
/home/<...>/torcs-1.3.4/export/lib/libraceengine.so: undefined reference
to `RmLoadingScreenSetText(char const*)'
/home/<...>/torcs-1.3.4/export/lib/libraceengine.so: undefined reference
to `RtTrackHeightL(tTrkLocPos*)'
/home/<...>/torcs-1.3.4/export/lib/libraceengine.so: undefined reference
to `RmFourStateScreen(char const*, char const*, char const*, void*, char
const*, char const*, void*, char const*, char const*, void*, char
const*, char const*, void*)'
/home/<...>/torcs-1.3.4/export/lib/libraceengine.so: undefined reference
to `RmRaceParamMenu(void*)'
/home/<...>/torcs-1.3.4/export/lib/libraceengine.so: undefined reference
to `RmShowResults(void*, RmInfo*)'
/home/<...>/torcs-1.3.4/export/lib/libraceengine.so: undefined reference
to `RmTriStateScreen(char const*, char const*, char const*, void*, char
const*, char const*, void*, char const*, char const*, void*)'
/home/<...>/torcs-1.3.4/export/lib/libraceengine.so: undefined reference
to `RtTrackLocal2Global(tTrkLocPos*, float*, float*, int)'
/home/<...>/torcs-1.3.4/export/lib/libraceengine.so: undefined reference
to `RmFileSelect(void*)'
/home/<...>/torcs-1.3.4/export/lib/libraceengine.so: undefined reference
to `RmTrackSelect(void*)'
/home/<...>/torcs-1.3.4/export/lib/libraceengine.so: undefined reference
to `RmLoadingScreenStart(char const*, char const*)'
/home/<...>/torcs-1.3.4/export/lib/libraceengine.so: undefined reference
to `RmDisplayStartRace(RmInfo*, void*, void*)'
/home/<...>/torcs-1.3.4/export/lib/libraceengine.so: undefined reference
to `RtTrackGetWidth(trackSeg*, float)'
/home/<...>/torcs-1.3.4/export/lib/libraceengine.so: undefined reference
to `RmShutdownLoadingScreen()'
collect2: error: ld returned 1 exit status
make[3]: *** [torcs-bin] Error 1

I was able to trace the error to a pair of missing linker option
(-lracescreens -lrobottools) while linking libraceengine.so. I fixed it
by adding the required options to the local Makfile and adding the
general call to the Make-default.mk template.

The second bug I encountered addresses the robotgen script. Simply using
the provided script, directly compiling and installing the freshly and
unchanged driver, starting torcs and clicking "Race -> Quick Race ->
Configure Race" leads to a segmentation fault. For that matter all race
types have this problem as it is related to loading the freshly
generated robot. I was able to find the error in the <Robotname>.cpp
file where the name and description are set. I fixed the problem by
adding a string-duplication command to the robotgen script.

All proposed fixes can be found in the attached patch. It can be easily
applied (supposed one is using a Linux system) by executing the command
'patch -p1 -i torcs-1.3.4-fixes.patch' in the base folder. The patch was
generated against a unchanged version of the "For Linux and FreeBSD from
"all-in-one" Source Package". Hope this helps anyone experiencing
similar difficulties.
Greetings
Jasper

------------------------------------------------------------------------------
Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery
and much more. Keep your Java skills current with LearnJavaNow -
200+ hours of step-by-step video tutorials by Java experts.
SALE $49.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122612

_______________________________________________
Torcs-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/torcs-users
torcs-1.3.4-fixes.patch (application/octet-stream, 3.3 KB)
diff -crB torcs-1.3.4/Make-default.mk torcs-1.3.4-patched/Make-default.mk
*** torcs-1.3.4/Make-default.mk	2003-09-07 10:13:56.000000000 +0200
--- torcs-1.3.4-patched/Make-default.mk	2013-01-08 11:48:32.319930790 +0100
***************
*** 162,168 ****
  
  
  win32end:
! 	@sed -e "s:${TORCS_BASE}:\.:g"  -e 's/$$/
/' ${INIT_WIN32} > ${INIT_WIN32}.eee
  	@mv ${INIT_WIN32}.eee ${INIT_WIN32}
  	@sed -e "s:/src/linux/:/src/windows/:g" ${INIT_WIN32} > ${INIT_WIN32}.eee
  	@mv ${INIT_WIN32}.eee ${INIT_WIN32}
--- 162,168 ----
  
  
  win32end:
! 	@sed -e "s:${TORCS_BASE}:\.:g"  -e 's/$$//' ${INIT_WIN32} > ${INIT_WIN32}.eee
  	@mv ${INIT_WIN32}.eee ${INIT_WIN32}
  	@sed -e "s:/src/linux/:/src/windows/:g" ${INIT_WIN32} > ${INIT_WIN32}.eee
  	@mv ${INIT_WIN32}.eee ${INIT_WIN32}
***************
*** 478,484 ****
  ifdef SOLIBRARY
  
  ${SOLIBRARY}: ${OBJECTS}
! 	${CXX} -shared -o ${SOLIBRARY} ${OBJECTS} ${LDFLAGS} ${LIBSPATH} ${LIBS} ${DEBUG_LIBS}
  	@D=`pwd` ; \
  	createdir="${EXPORTBASE}/lib" ; \
  	$(mkinstalldirs) $$createdir ; \
--- 478,484 ----
  ifdef SOLIBRARY
  
  ${SOLIBRARY}: ${OBJECTS}
! 	${CXX} -shared -o ${SOLIBRARY} ${OBJECTS} ${SOLIBS} ${LDFLAGS} ${LIBSPATH} ${LIBS} ${DEBUG_LIBS}
  	@D=`pwd` ; \
  	createdir="${EXPORTBASE}/lib" ; \
  	$(mkinstalldirs) $$createdir ; \
diff -crB torcs-1.3.4/robotgen torcs-1.3.4-patched/robotgen
*** torcs-1.3.4/robotgen	2004-08-02 10:51:04.000000000 +0200
--- torcs-1.3.4-patched/robotgen	2013-01-09 08:32:55.181202774 +0100
***************
*** 224,231 ****
  echo '{' >> $CPPFILE || exit 1
  echo '    memset(modInfo, 0, 10*sizeof(tModInfo));' >> $CPPFILE || exit 1
  echo '' >> $CPPFILE || exit 1
! echo '    modInfo->name    = "'$NAME'";		/* name of the module (short) */' >> $CPPFILE || exit 1
! echo '    modInfo->desc    = "'$DESCRIPTION'";	/* description of the module (can be long) */' >> $CPPFILE || exit 1
  echo '    modInfo->fctInit = InitFuncPt;		/* init function */' >> $CPPFILE || exit 1
  echo '    modInfo->gfId    = ROB_IDENT;		/* supported framework version */' >> $CPPFILE || exit 1
  echo '    modInfo->index   = 1;' >> $CPPFILE || exit 1
--- 224,231 ----
  echo '{' >> $CPPFILE || exit 1
  echo '    memset(modInfo, 0, 10*sizeof(tModInfo));' >> $CPPFILE || exit 1
  echo '' >> $CPPFILE || exit 1
! echo '    modInfo->name    = strdup("'$NAME'");		/* name of the module (short) */' >> $CPPFILE || exit 1
! echo '    modInfo->desc    = strdup("'$DESCRIPTION'");	/* description of the module (can be long) */' >> $CPPFILE || exit 1
  echo '    modInfo->fctInit = InitFuncPt;		/* init function */' >> $CPPFILE || exit 1
  echo '    modInfo->gfId    = ROB_IDENT;		/* supported framework version */' >> $CPPFILE || exit 1
  echo '    modInfo->index   = 1;' >> $CPPFILE || exit 1
diff -crB torcs-1.3.4/src/libs/raceengineclient/Makefile torcs-1.3.4-patched/src/libs/raceengineclient/Makefile
*** torcs-1.3.4/src/libs/raceengineclient/Makefile	2006-10-06 22:44:51.000000000 +0200
--- torcs-1.3.4-patched/src/libs/raceengineclient/Makefile	2013-01-08 11:45:57.695936454 +0100
***************
*** 23,28 ****
--- 23,30 ----
  SOURCES      = singleplayer.cpp raceinit.cpp racemain.cpp racemanmenu.cpp racestate.cpp racegl.cpp \
  	       raceengine.cpp raceresults.cpp
  
+ SOLIBS      = -lracescreens -lrobottools
+ 
  EXPDIR       = include
  
  EXPORTS      = singleplayer.h raceinit.h
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.