Announcement: Be excellent to each other.


Caravel Forum : Caravel Boards : Development : DRODUtil 3.0 On Linux (A diary/potential bug problem)
New Topic New Poll Post Reply
Poster Message
coppro
Level: Smitemaster
Rank Points: 1306
Registered: 11-24-2005
IP: Logged
icon DRODUtil 3.0 On Linux (0)  
I decided to make DRODUtil on Linux. It was a fairly eventful piece of work, so here's what happened:

1. I run "scons target=util" in the Master/Linux directory. After a bunch of compiling, GCC gives me a bunch of undefined reference errors. A little investigation shows that they're in DROD.
2. Now, I manually try and meet the dependencies by playing around in the SConstruct. Eventually, I run into more undefined references than I can count, some are even in FrontEndLib. This doesn't seem to work that well.
3. I poke around, and realise that the DRODUtil project includes a number of source files from DROD. I modify the SConstruct by adding the following code just in front of the line that says "srcs.sort()" in makelib:
	if opt['util']:
		pat = re.compile(r'RelativePath="\.?\\?\.\.\\[Dd][Rr][Oo][Dd]\\([^.]*).cpp"')
		for line in open(srcpath + '/' + mod + '.vcproj'):
			match = pat.search(line)
			if match:
				srcs.append('../DROD/' + match.group(1))


4. Still more undefined references. This time, to "typeinfo for CGameScreen". I locate them, and realise it needs in info to dynamic_cast CScreen into CGameScreen. I figure that since DRODUtil doesn't need a screen, I can just remove them via conditional inclusion. I created a new macro name (UTIL) and removed the offending casts. In theory, I could also have modified DRODUtil's GameScreenDummy.h to include the function(s) that would cause GCC to emit the typeinfo, but that's not quite as portable (and the "first non-virtual non-inline" trick wasn't working for me). I didn't feel like looking it up though. I added the lines to the SConstruct, near the end:
if opt['util']:
	env.Append(CCFLAGS = ' -DUTIL')


BAM! Completed DRODUtil!

This fix would do well in the official SConstruct, although something different might be employed to deal with the typeinfo references (possibly finding the function that GCC needs to emit that info)

FAKE EDIT (edit-before-post): I just did some more testing and discovered that the function that emits the typeinfo for CGameScreen is the destructor, which, if defined, gives undefined references to almost every other function, as well as the vtable. It's not worth it to define dummy functions for all of those, too.
09-16-2007 at 12:22 AM
View Profile Show all user's posts Quote Reply
New Topic New Poll Post Reply
Caravel Forum : Caravel Boards : Development : DRODUtil 3.0 On Linux (A diary/potential bug problem)
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.8
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.