The Ur-Quan Masters Discussion Forum

The Ur-Quan Masters Re-Release => Technical Issues => Topic started by: Eric Pierce on December 02, 2002, 06:36:53 am



Title: Compilation warnings
Post by: Eric Pierce on December 02, 2002, 06:36:53 am
I get a couple of warnings during compilation. Don't know if these are related to the segfaults I'm getting when I run uqm, but they may need looking into.

The first, which is repeated often during compilation, is a warning about right-shifting by a negative value. Looking into the code, these seem to occur in any function which calls:

SET_GAME_STATE ( XXX, 1 );

Where XXX is various things like STARBASE_BULLETS0, STARBASE_VISITED, LIGHT_MINERAL_LOAD, etc. Presumably it is something amiss in the SET_GAME_STATE macro, in $SRCDIR/src/sc2code/globdata.h, or functions calling the macro with inappropriate values.

The other error only occurs when finishing up compilation and linking of all the .o files into the main executable, and is as follows:

obj/release/src/sc2code/libs/file/temp.o: In function `initTempDir':
obj/release/src/sc2code/libs/file/temp.o(.text+0x17): the use of `tmpnam' is dangerous, better use `mkstemp'

Just for kicks, I tried changing the line in question as the compiler recommends, and instead of getting a segfault when I run uqm, I get some errors about "Cannot create tempfile - file does not exist."

Hope this helps!


Title: Re: Compilation warnings
Post by: meep-eep on December 02, 2002, 05:26:17 pm
SET_GAME_STATE and GET_GAME_STATE are the cause of all the shifting warnings. But despite the warnings, it is original code that works. We'll be changing this at some time to get rid of the warning, but for the moment, we're more busy on things that *do* go wrong.
As for tmpnam, you can ignore it. The reason for the warning is that incorrect use can be a security risk. mkstemp isn't an alternative as it creates a temporary file, while we want a directory. There are unfortunately no portable functions we can use, except for tmpnam. Maybe we'll write our own function at some point.


Title: Re: Compilation warnings
Post by: Eric Pierce on December 02, 2002, 10:01:06 pm
I kind of figured that... guess I'll have to look elsewhere for the cause of the segfaults.

I'll try using gdb to see if that helps locate the cause. I might even be able to fix it myself :)



Title: Re: Compilation warnings
Post by: Eric Pierce on December 03, 2002, 12:37:26 am
Ah!

Apparently the segfaults are related to not having permissions in the installation directory (I'm on Linux). Tried running the executable from the source directory (where I *do* have write permission) and it worked great!

Most of the sound works fine, except it does not play any of the .ogg files. Maybe I forgot some of the required libs...

Anyhow, kudos to everyone that is working on this! This was definitely one of my favorite games from the DOS days, and it's awesome to play it again.


Title: Re: Compilation warnings
Post by: meep-eep on December 03, 2002, 01:57:17 am
Quote
Most of the sound works fine, except it does not play any of the .ogg files. Maybe I forgot some of the required libs...

You need the cvs version of SDL_mixer. Their 'stable' release doesn't support ogg yet. (We're planning to switch to OpenAL though).