Author Topic: Freespace 2 port to GCC  (Read 19844 times)

0 Members and 1 Guest are viewing this topic.

Offline el84

  • 23
Freespace 2 port to GCC
Thanks Vrodic. Compiles without errors now. Played a couple of the main campaign missions – runs great. Very impressive work!

Edrick, you using WinCVS? Much easier than running cvs from Cygwin’s bash. Here’s a helpful guide that answered some of my cvs newbie questions:
http://www.computas.com/pub/wincvs-howto/

 

Offline EdrickV

  • Valued
  • 29
    • http://members.aol.com/HunterComputers
Freespace 2 port to GCC
Nope, haven't been using WinCVS. (Because by the time knew I where to get it, which is right now, I'd already gotten FS2 compiling again. :) ) I will check it out though.
Ground - "Let me help you out, you're clear to taxi any way you can, to any runway you see."

Mesh Gallery/Downloads:
http://members.aol.com/ArisKalzar/Gallery.html
Turreting 101:
http://members.aol.com/EdrickV/FS2/Turreting.html

http://members.aol.com/HunterComputers

 

Offline Scuddie

  • gb2/b/
  • 28
  • I will never leave.
Freespace 2 port to GCC
OK, I just downloaded the CVS tree, and I am confused as to why I cannot compile it.  This is the command line I use... "gcc C:\fs2source\projects\freespace2_public\code\code.mak".  It tells me it's not a makefile.  Am I doing something wrong (obviously :p)?  IOW, what is the commandline I need to use?
Bunny stole my signature :(.

Sorry boobies.

 

Offline EdrickV

  • Valued
  • 29
    • http://members.aol.com/HunterComputers
Freespace 2 port to GCC
First thing: Did you grab the headers from earlier in this thread? You will probably need them.
As far as how to compile it, you do: ./build.sh
Which does the following for you:
cd code
make -f code.mak
cd ..
make -f Freespace2.mak

GCC doesn't handle makefiles. That's what make is for, but build.sh will do both makes for you. :)
Ground - "Let me help you out, you're clear to taxi any way you can, to any runway you see."

Mesh Gallery/Downloads:
http://members.aol.com/ArisKalzar/Gallery.html
Turreting 101:
http://members.aol.com/EdrickV/FS2/Turreting.html

http://members.aol.com/HunterComputers

 

Offline Scuddie

  • gb2/b/
  • 28
  • I will never leave.
Freespace 2 port to GCC
Well, that worked, now I'm at a dead end, dealing with a vecmat problem

In file included from Math/VecMat.h:177,
                 from Math/VecMat.cpp:232:
GlobalIncs/PsTypes.h:231: warning: ignoring pragma:
Math/VecMat.cpp:241: warning: aggregate has a partly bracketed initializer
Math/VecMat.cpp:241: warning: aggregate has a partly bracketed initializer
Math/VecMat.cpp:242: warning: aggregate has a partly bracketed initializer
Math/VecMat.cpp:242: warning: aggregate has a partly bracketed initializer
Math/VecMat.cpp:243: warning: aggregate has a partly bracketed initializer
Math/VecMat.cpp:243: warning: aggregate has a partly bracketed initializer
Math/VecMat.cpp:244: warning: aggregate has a partly bracketed initializer
Math/VecMat.cpp:244: warning: aggregate has a partly bracketed initializer
Math/VecMat.cpp:245: warning: aggregate has a partly bracketed initializer
Math/VecMat.cpp:245: warning: aggregate has a partly bracketed initializer
Math/VecMat.cpp:245: warning: aggregate has a partly bracketed initializer
Math/VecMat.cpp:245: warning: aggregate has a partly bracketed initializer
Math/VecMat.cpp:245: warning: aggregate has a partly bracketed initializer
Math/VecMat.cpp: In function `float vm_vec_copy_normalize(vector *, vector *)':
Math/VecMat.cpp:613: warning: left-hand operand of comma expression has no effect
Math/VecMat.cpp:613: warning: left-hand operand of comma expression has no effect
Math/VecMat.cpp:613: warning: statement with no effect
Math/VecMat.cpp: In function `void vm_orthogonalize_matrix(matrix *)':
Math/VecMat.cpp:1416: warning: value computed is not used
Math/VecMat.cpp:1418: warning: value computed is not used
Math/VecMat.cpp: In function `void vm_fix_matrix(matrix *)':
Math/VecMat.cpp:1458: warning: value computed is not used
Math/VecMat.cpp:1460: warning: value computed is not used
Math/VecMat.cpp:1471: warning: value computed is not used
Math/VecMat.cpp:1473: warning: value computed is not used
Math/VecMat.cpp: In function `int is_valid_vec(vector *)':
Math/VecMat.cpp:2741: implicit declaration of function `int isnan(...)'
make: *** [Math/VecMat.o] Error 1


Also, what's with the shell file?  Am I not allowed to do this in an MS-DOS box?
Bunny stole my signature :(.

Sorry boobies.

 

Offline EdrickV

  • Valued
  • 29
    • http://members.aol.com/HunterComputers
Freespace 2 port to GCC
You ought to be compiling it from a BASH shell, which looks like a DOS box but isn't really command.com, you can run command.com in it though. As far as your latest error:

Compiling it under Cygwin envirovment:

To compile it under Cygwin envirovment, you'll need to download
mingw-runtime-2.0-20020430.tar.gz and put the files in /cygwin/bin,
/cygwin/usr/include/mingw and /cygwin/lib/mingw.

Otherwise you'll probably get errors regarding isnan function.

There's a README.win32 I tend to forget about. :)
Ground - "Let me help you out, you're clear to taxi any way you can, to any runway you see."

Mesh Gallery/Downloads:
http://members.aol.com/ArisKalzar/Gallery.html
Turreting 101:
http://members.aol.com/EdrickV/FS2/Turreting.html

http://members.aol.com/HunterComputers

 

Offline Scuddie

  • gb2/b/
  • 28
  • I will never leave.
Freespace 2 port to GCC
Well, stupid me...  I forgot to overwrite the runtime files with the current ones :rolleyes:.  Anyway, is there supposed to be a situation with the freespace2.mak not being able to find libcode.a?  I figured I would re-name the already existing libacode.a to libcode.a, but then it yelled at me again because the libacode.a file was not there.  Once again, am I doing something wrong?  Also, after I decided to just dupe the file, it complained about a missing freespace2.res.  I am growing very tired of C++, and the fact that I am sleep deprived has nothing to do with it ;).
Bunny stole my signature :(.

Sorry boobies.

 

Offline vrodic

  • 23
Freespace 2 port to GCC
Quote
Originally posted by Scuddie
Well, stupid me...  I forgot to overwrite the runtime files with the current ones :rolleyes:.  Anyway, is there supposed to be a situation with the freespace2.mak not being able to find libcode.a?  I figured I would re-name the already existing libacode.a to libcode.a, but then it yelled at me again because the libacode.a file was not there.  Once again, am I doing something wrong?  Also, after I decided to just dupe the file, it complained about a missing freespace2.res.  I am growing very tired of C++, and the fact that I am sleep deprived has nothing to do with it ;).


I'm to blame again :) I'm not sure about freespace2.res. It builds here just fine with the rules defined in Freespace2.mak.

libacode.a is a typo in the Freespace2.mak. Fixed. (cvs update -Pd). It didn't complain about it here though. If it did, I would have fixed it already.

Anyway, there is a  top level makefile now (cvs update), so we can dump the build.sh.

Just running make in the dir where you've extracted your code should take care of everything.

 

Offline Scuddie

  • gb2/b/
  • 28
  • I will never leave.
Freespace 2 port to GCC
What version of make/g++/etc are you using?  I am using the ones from bloodshed with the updated mingw runtime files.  The only problem I can see is that nothing is referencing freespace2 in the code.mak file, thus not creating the res files.  I tried commenting out some stuff, but to no avail.  Also, if I am using the wrong make program, would you be so kind as to point me into the right direction?  thx.
Bunny stole my signature :(.

Sorry boobies.

 

Offline EdrickV

  • Valued
  • 29
    • http://members.aol.com/HunterComputers
Freespace 2 port to GCC
Code.mak doesn't build Freespace 2. It builds a library used by Freespace 2, FRED2, and PofView. Freespace2.mak should be used after Code.mak is done. As far as versions, don't know what anyone else is using but I use:

Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/specs
gcc version 2.95.3-5 (cygwin special)

GNU Make version 3.79.1, by Richard Stallman and Roland McGrath.
Built for i686-pc-cygwin

Edit: And I'm not using Dev-C++.
Ground - "Let me help you out, you're clear to taxi any way you can, to any runway you see."

Mesh Gallery/Downloads:
http://members.aol.com/ArisKalzar/Gallery.html
Turreting 101:
http://members.aol.com/EdrickV/FS2/Turreting.html

http://members.aol.com/HunterComputers

 

Offline EdrickV

  • Valued
  • 29
    • http://members.aol.com/HunterComputers
Freespace 2 port to GCC
Hey Vrodic, how big are the FS2 exes you've made with the GCC port? Just noticed mine is at 11 MB and I know I didn't add a lot to it. Maybe GCC's makefiles could use some optimization tweaks? (Or is it because it's not using runtime libraries or something?)
Ground - "Let me help you out, you're clear to taxi any way you can, to any runway you see."

Mesh Gallery/Downloads:
http://members.aol.com/ArisKalzar/Gallery.html
Turreting 101:
http://members.aol.com/EdrickV/FS2/Turreting.html

http://members.aol.com/HunterComputers

 
Freespace 2 port to GCC
Quote
Originally posted by EdrickV
Hey Vrodic, how big are the FS2 exes you've made with the GCC port? Just noticed mine is at 11 MB and I know I didn't add a lot to it. Maybe GCC's makefiles could use some optimization tweaks? (Or is it because it's not using runtime libraries or something?)


Actually, it's probably that the binaries GCC is producing have debug symbols. Take out the '-g' option to GCC to make it not do this, or use the 'strip' program to remove them after compilation.

 

Offline EdrickV

  • Valued
  • 29
    • http://members.aol.com/HunterComputers
Freespace 2 port to GCC
Ahhhhh, strip worked wonders. Will have to add that to my fs2inst shell script. :D
Ground - "Let me help you out, you're clear to taxi any way you can, to any runway you see."

Mesh Gallery/Downloads:
http://members.aol.com/ArisKalzar/Gallery.html
Turreting 101:
http://members.aol.com/EdrickV/FS2/Turreting.html

http://members.aol.com/HunterComputers

 

Offline Kazan

  • PCS2 Wizard
  • 212
  • Soul lives in the Mountains
    • http://alliance.sourceforge.net
Freespace 2 port to GCC
hey vrodic .. you rock.. i planned on helping do this.. just right now im having finals, prepping for districts in soccer and graduation... oui
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir

 

Offline penguin

  • Eudyptes codus
  • 28
  • Still alive.
Freespace 2 port to GCC
I got fs2 to compile and link under Linux!!  It segfaults almost immediately, but this is a big step... no more unresolved symbols...

Summary of what I've done:
  • I #ifdef'd out the networking, sound, and joystick code, to be added later by some intrepid soul ;)
  • Wrote wrappers for Win32 calls that are different under unix (mostly low-level OS stuff)
  • General portability stuff: filenames use slash or backslash as appropriate for the OS; also, some hooks are in place for big-endian architectures in the file readers, but this is not yet complete
  • All of the X & OpenGL lowlevel graphics routines are just stubs
  • Various small tweaks to fix :mad: MSVC non-standard C++
It's still not playable by a long shot.  More details to follow...
your source code slave

 

Offline Kazan

  • PCS2 Wizard
  • 212
  • Soul lives in the Mountains
    • http://alliance.sourceforge.net
Freespace 2 port to GCC
port it to SDL OpenGL .. much easier than XEXT
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir

 

Offline penguin

  • Eudyptes codus
  • 28
  • Still alive.
Freespace 2 port to GCC
Quote
Originally posted by Kazan
port it to SDL OpenGL .. much easier than XEXT
Looking into it, but I've never used it.  I'm much more familiar w/ "raw" OpenGL and GLX, so I may have to learn something new :eek:

SDL looks nice as it also appears to have sound, keyboard, joystick, etc.
your source code slave

 

Offline EdrickV

  • Valued
  • 29
    • http://members.aol.com/HunterComputers
Freespace 2 port to GCC
SDL is DirectX+ for platform independent programmers in my opinion. ;) Now, if you or someone else can get rid of or provide C++ alternatives for the assembly in FS2 once you can get it running under Linux with SDL, if there is any left, , then I'll be able to try and get it ported to PS2Linux. When I get my kit. If I can port FS2 from Linux to PS2Linux, it should teach me a lot about porting apps to PS2Linux in general and looking at the code could help me learn SDL. Not to mention that it would just be cool to play FS2 on my TV. :) Yeah, this'll probably won't be happening for a while if at all, but I can still dream. :)
Ground - "Let me help you out, you're clear to taxi any way you can, to any runway you see."

Mesh Gallery/Downloads:
http://members.aol.com/ArisKalzar/Gallery.html
Turreting 101:
http://members.aol.com/EdrickV/FS2/Turreting.html

http://members.aol.com/HunterComputers

 

Offline Kazan

  • PCS2 Wizard
  • 212
  • Soul lives in the Mountains
    • http://alliance.sourceforge.net
Freespace 2 port to GCC
SDL is only used in intialization.. the rest of the function calls are all raw opengl.. it's the initialiation stuff that is all platform dependant that get's replaced my the platform-indepentant SDL
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir

 

Offline Scuddie

  • gb2/b/
  • 28
  • I will never leave.
Freespace 2 port to GCC
Well, whatever...  Linux is evil, therefor SDL is evil. ;)

Am I the only one who thinks this thread deserves a sticky?
Bunny stole my signature :(.

Sorry boobies.