Compiling with Code::Blocks, part deux

Trying to build your own version of Vega Strike and having problems? Unix users, paste your config.log here (stderr output alone is not helpful).
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Compiling with Code::Blocks, part deux

Post by shenle »

It's a long post but please bear with me.

I've decided to revive the build process for Vegastrike using Code: Blocks and the Visual C++ Toolkit 2003, partly because the Visual Studio Express gives me a lot of grief, and partly because my only successful attempts to compile VS apart from C:B were with the Visual C++ .Net 2003 IDE, which contains the same tools as the (once freely made available) Toolkit 2003.

Please see the first part of the Code::Blocks saga in http://vegastrike.sourceforge.net/forum ... =5&t=13290

A lot of what I will put here is just a reiteration of what's in the older thread.

I have decided to take a "clean room" approach, to eliminate any possible rogue code/headers/tools left over on the machine from previous attempts. Therefore, I set up a virtual Windows 2000 machine in VMWare, and built everything from the ground up. It is perfectly reproducible.

Sources:



A. Tools

1. Code::Blocks, version 8.02. Download from the website the version without bundled mingw. Direct link: http://downloads.sourceforge.net/codebl ... -setup.exe

2. Visual C++ Toolkit 2003. Once freely available from Microsoft, now difficult to find. Do a Google search for "VCToolkitSetup.exe" Here is one of the available links: http://npsg.dl.ac.uk/MIDAS/MIDAS_Releas ... tSetup.exe Also ftp://ftp.qut.edu.au/pub/microsoft/vcto ... tSetup.exe and ftp://ftp.ur.ru/Updates/Microsoft/Visua ... tSetup.exe

3. Microsoft Platform SDK for Windows XP SP2. Here is a stripped down version that contains all you need to compile Vegastrike: http://www.megaupload.com/?d=KXZDDYGK

4. DirectX9 SDK, similarly stripped down (yes, you need parts of the SDK despite Vegastrike using OpenGL). http://www.megaupload.com/?d=AB9TR3LV

5. Resource compiler, not included in the toolkit. Here are the files from VC++ .NET 2003: http://www.megaupload.com/?d=4GY9JDV9

6. A few libraries from the .NET SDK 1.1: http://www.megaupload.com/?d=TKSLJIFU



B. Code. All you really need are vegastrike, vega-vc7 and win32 from the SVN, as well as a patch I made originally to get VS to compile in VC++2003. The patch is against revision 12720 of the SVN source code. You can find it here: http://www.megaupload.com/?d=JY8UUUPY


C. Procedure.

On a clean machine, no tools or code installed, the following should lead to a viable build environment.

1. Install the VC++ toolkit 2003 to its default location (C:\Program Files\Microsoft Visual C++ Toolkit 2003)

2. Install the PSDK - I generally put it in c:\PSDK

3. Install the DirectX SDK. I put it in c:\DXSDK

4. Install Code::Blocks to its default location. It should detect that you have the Toolkit 2003 installed. Set the toolkit as default build environment.

5. Download from SVN the vegastrike, vega-vc7 and win32 targets. I put them in c:\VS\vegastrike (vega-vc7, win32).

6. Download my patch from the link above (http://www.megaupload.com/?d=JY8UUUPY). Unzip it in the main directory where you put the SVN code (C:\VS). Allow it to overwrite files. NOTE as of revision 12725 the patch has been integrated in the main trunk so you can skip this step.

7. Configure C::B. Open it, then go to Settings > Compiler and debugger > Search directories. Under the compiler tab, add the include directories from the PSDK (c:\PSDK\Include) and Directx SDK (C:\DXSDK\Include). Under the Linker tab, similarly add the Lib directories from the PSDK and DXSDK. Under the Resource compiler tab add the include directory of the toolkit itself (C:\Program Files\Microsoft Visual C++ Toolkit 2003\include) as well as the include directories from the PSDK and the DXSDK. Close Code::Blocks. Open it again and check the search directories again to make sure it remembers what you entered (sometimes it doesn't).

8. Unzip the extra libraries from A6 above to C:\Program Files\Microsoft Visual C++ Toolkit 2003\libs

9. In Code::Blocks go to File > Import project > MS Visual studio solution, and choose vega-vc7/vegastrike.sln Answer yes to all.

10. Make adjustments to the project so it compiles cleanly. Right-click on "vegastrike" in the left panel, select "build options" and in "compiler settings>other options" change the /W to /W2. In the same extra options panel add /EHsc to the option list. Open vegastrike/Resources.rc and change #include "afxres.h" to #include <WinResrc.h> ; save all.

(edited for r12742) Also in build options>compiler settings, click on tab "#defines" and add at the end of the list NV_CUBE_MAP so the resulting binary compiles with the new cubemap backgrounds support. Also create a new file in vegastrike/src, naned "config.h" and add the following in it:

Code: Select all

#pragma warning(disable: 4786)
(this pending cmake fix)

That's it. Now right-click on vegastrike again, and select "build". After a while you should have a "vegastrikeRVC7.exe" in win32/bin



Comments welcome.
Last edited by shenle on Fri Mar 19, 2010 6:16 pm, edited 8 times in total.
make me a sandwich
make: *** No rule to make target 'me'. Stop.
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Re: Compiling with Code::Blocks, part deux

Post by chuck_starchaser »

shenle wrote:6. Download my patch from the link above (http://www.megaupload.com/?d=JY8UUUPY). Unzip it in the main directory where you put the SVN code (C:\VS). Allow it to overwrite files.
Skip. Not needed; the patch is already merged to trunk as per r12725.
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Re: Compiling with Code::Blocks, part deux

Post by shenle »

Update 1: because of changes introduced in r12731, for the project to finish linking you must remove the following files (in the left panel):
src/cmd/unit_bsp.cpp
src/gfx/bsp.cpp
src/gfx/bounding_box.cpp

Otherwise the linker will complain about them missing.

Attached find the project vegastrike.cbp that compiles revision 12735 (put it in folder vega-vc7).
You do not have the required permissions to view the files attached to this post.
make me a sandwich
make: *** No rule to make target 'me'. Stop.
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Re: Compiling with Code::Blocks, part deux

Post by shenle »

OK so the binary gets compiled. Now if it actually worked, that would be nice too. (see my post in "bug triage").
make me a sandwich
make: *** No rule to make target 'me'. Stop.
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Re: Compiling with Code::Blocks, part deux

Post by shenle »

Updated the instructions in the first post for cubemap compilation.

Attached working binary from revision 12742 (compressed with 7zip because of attachment size limitation - rename to .7z if you have trouble decompressing it).
You do not have the required permissions to view the files attached to this post.
make me a sandwich
make: *** No rule to make target 'me'. Stop.
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Re: Compiling with Code::Blocks, part deux

Post by chuck_starchaser »

Many thanks!
I'm going to create a PU svn branch for playtesting right away, and if it works I'll merge it back.
I'd been waiting for this moment...
pheonixstorm
Elite
Elite
Posts: 1567
Joined: Tue Jan 26, 2010 2:03 am

Re: Compiling with Code::Blocks, part deux

Post by pheonixstorm »

I see a problem here.. did you update any of the dlls when you compiled the program? If you did we will need those as well.
Because of YOU Arbiter, MY kids? can't get enough gas. OR NIPPLE! How does that mkae you feeeel? ~ Halo
pheonixstorm
Elite
Elite
Posts: 1567
Joined: Tue Jan 26, 2010 2:03 am

Re: Compiling with Code::Blocks, part deux

Post by pheonixstorm »

Oh and while I am thinking about does the starter ship look fine in your build? Thats an issue I had on my last build.. never could find the problem though.
Because of YOU Arbiter, MY kids? can't get enough gas. OR NIPPLE! How does that mkae you feeeel? ~ Halo
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Re: Compiling with Code::Blocks, part deux

Post by shenle »

libpng was updated - the version I used is already in the SVN repository (patch applied in r12737 I think), so if you make an update to the current revision you'll get all the correct libraries and headers for compiling.

Yes my ship looks fine, thank you.
make me a sandwich
make: *** No rule to make target 'me'. Stop.
pheonixstorm
Elite
Elite
Posts: 1567
Joined: Tue Jan 26, 2010 2:03 am

Re: Compiling with Code::Blocks, part deux

Post by pheonixstorm »

So did you build libpng as dynamic or static?
Because of YOU Arbiter, MY kids? can't get enough gas. OR NIPPLE! How does that mkae you feeeel? ~ Halo
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Re: Compiling with Code::Blocks, part deux

Post by shenle »

Static. That way you avoid dll hell.
make me a sandwich
make: *** No rule to make target 'me'. Stop.
pheonixstorm
Elite
Elite
Posts: 1567
Joined: Tue Jan 26, 2010 2:03 am

Re: Compiling with Code::Blocks, part deux

Post by pheonixstorm »

Actually, the dll hell is'nt with the binary but from the lack of housekeeping in the win32 section... The two of us are really the only ones working on a win32 binary.
Because of YOU Arbiter, MY kids? can't get enough gas. OR NIPPLE! How does that mkae you feeeel? ~ Halo
pheonixstorm
Elite
Elite
Posts: 1567
Joined: Tue Jan 26, 2010 2:03 am

Re: Compiling with Code::Blocks, part deux

Post by pheonixstorm »

Oh and what files from .NET are needed?? I never ran across that in my builds nor did I find I needed anything from DX (or so the compile log tells me) unless I wanted to recompile SDL but thats unrelated anyway.
Because of YOU Arbiter, MY kids? can't get enough gas. OR NIPPLE! How does that mkae you feeeel? ~ Halo
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Re: Compiling with Code::Blocks, part deux

Post by shenle »

msvc(p)rt(d).lib. All 4 of them.
make me a sandwich
make: *** No rule to make target 'me'. Stop.
pheonixstorm
Elite
Elite
Posts: 1567
Joined: Tue Jan 26, 2010 2:03 am

Re: Compiling with Code::Blocks, part deux

Post by pheonixstorm »

Found an issue (same as mine when I tried).

Code: Select all

GOT SUBDIR ARG = 
Found data in E:\source directory\vegastrike\head\win32\bin/../../data
Using E:\source directory\vegastrike\head\data as data directory
USING HOMEDIR : E:\source directory\vegastrike\head\data/.vegastrike As the home directory 
CONFIGFILE - No config found in home : E:\source directory\vegastrike\head\data/.vegastrike/vegastrike.config
CONFIGFILE - No home config file found, using datadir config file : E:\source directory\vegastrike\head\data/vegastrike.config
MISSION_NAME is empty using : main_menu.mission
Attempt to call ReadFull on a bad file units.csv
Only read 0 out of -1 bytes of units.csv
!!! ERROR/WARNING VSFile : on ReadFull : Unspecified error (maybe to document in VSFile ?)
'import site' failed; use -v for traceback
running import sys
print sys.path
sys.path = [r"E:\source directory\vegastrike\head\data\modules\builtin",r"E:\source directory\vegastrike\head\data\modules\quests",r"E:\source directory\vegastrike\head\data\modules\missions",r"E:\source directory\vegastrike\head\data\modules\ai",r"E:\source directory\vegastrike\head\data\modules",r"E:\source directory\vegastrike\head\data\bases"]
testing VS randomrunning import sys
print sys.path
Min (0.000000, 0.000000, 0.000000) Max(0.000000, 0.000000, 0.000000) MinLumin 1.000000, MaxLumin 1.000000Read In Star Count 0 used: 2000
Min (0.000000, 0.000000, 0.000000) Max(0.000000, 0.000000, 0.000000) MinLumin 1.000000, MaxLumin 1.000000Read In Star Count 0 used: 38
Loading a starsystem
Loading Star System Special/Empty
FOUND MODIFICATION = player FOR PLAYER #0
warning: Not importing directory 'E:\source directory\vegastrike\head\data\bases\fixers': missing __init__.py
Min (0.000000, 0.000000, 0.000000) Max(0.000000, 0.000000, 0.000000) MinLumin 1.000000, MaxLumin 1.000000Read In Star Count 0 used: 2000
Min (0.000000, 0.000000, 0.000000) Max(0.000000, 0.000000, 0.000000) MinLumin 1.000000, MaxLumin 1.000000Read In Star Count 0 used: 38
Loading a starsystem
Loading Star System Crucible/Cephid_17
 Next To: Crucible/17-ar
 Next To: Crucible/Cardell
 Next To: Crucible/Cephid_17
 Next To: Crucible/Enyo
 Next To: Crucible/Cephid_17
 Next To: Crucible/Oldziey
dot 0.203897dot 0.998277
The main item is that it doesn't want to load units.csv What does your stderr.txt file show?
Because of YOU Arbiter, MY kids? can't get enough gas. OR NIPPLE! How does that mkae you feeeel? ~ Halo
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Re: Compiling with Code::Blocks, part deux

Post by shenle »

pheonixstorm wrote:Found an issue (same as mine when I tried).

Code: Select all

Attempt to call ReadFull on a bad file units.csv
Only read 0 out of -1 bytes of units.csv
!!! ERROR/WARNING VSFile : on ReadFull : Unspecified error (maybe to document in VSFile ?)

Code: Select all

warning: Not importing directory 'E:\source directory\vegastrike\head\data\bases\fixers': missing __init__.py
Yes I have seen both of these. I'm not sure what the missing units.csv does since I see ships flying around. But I haven't seen any fixers anywhere.

Do you want to make a bug report?
make me a sandwich
make: *** No rule to make target 'me'. Stop.
pheonixstorm
Elite
Elite
Posts: 1567
Joined: Tue Jan 26, 2010 2:03 am

Re: Compiling with Code::Blocks, part deux

Post by pheonixstorm »

Make a bug report to ourselves?? No one gets this issue under linux.. just windows. Not much time to post so I'll think it over and get back to you
Because of YOU Arbiter, MY kids? can't get enough gas. OR NIPPLE! How does that mkae you feeeel? ~ Halo
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Re: Compiling with Code::Blocks, part deux

Post by shenle »

I get the same error in Linux. It's not Windows-only.
make me a sandwich
make: *** No rule to make target 'me'. Stop.
pheonixstorm
Elite
Elite
Posts: 1567
Joined: Tue Jan 26, 2010 2:03 am

Re: Compiling with Code::Blocks, part deux

Post by pheonixstorm »

Well thats interesting... I asked about this before and no one (meaning linux ppl) had anything to say including getting an error in running vs under linux. How odd... Bug it is then!
Because of YOU Arbiter, MY kids? can't get enough gas. OR NIPPLE! How does that mkae you feeeel? ~ Halo
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Re: Compiling with Code::Blocks, part deux

Post by shenle »

Here's my stderr from running a newly compiled binary of VS/Ubuntu 9.10:

Code: Select all

GOT SUBDIR ARG = 
Found data in /home/shenle/vegastrike/svn/vegastrike/../data
Using /home/shenle/vegastrike/svn/data as data directory
USING HOMEDIR : /home/shenle/.vegastrike As the home directory 
CONFIGFILE - Found a config file in home directory, using : /home/shenle/.vegastrike/vegastrike.config
MISSION_NAME is empty using : main_menu.mission
Attempt to call ReadFull on a bad file units.csv
Only read 0 out of -1 bytes of units.csv
!!! ERROR/WARNING VSFile : on ReadFull : Unspecified error (maybe to document in VSFile ?)
running import sys
print sys.path
sys.path = [r"/home/shenle/vegastrike/svn/data/modules/builtin",r"/home/shenle/vegastrike/svn/data/modules/quests",r"/home/shenle/vegastrike/svn/data/modules/missions",r"/home/shenle/vegastrike/svn/data/modules/ai",r"/home/shenle/vegastrike/svn/data/modules",r"/home/shenle/vegastrike/svn/data/bases"]
testing VS randomrunning import sys
print sys.path
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
Min (0.000000, 0.000000, 0.000000) Max(0.000000, 0.000000, 0.000000) MinLumin 1.000000, MaxLumin 1.000000Read In Star Count 0 used: 2000
Min (0.000000, 0.000000, 0.000000) Max(0.000000, 0.000000, 0.000000) MinLumin 1.000000, MaxLumin 1.000000Read In Star Count 0 used: 38
Loading a starsystem
Loading Star System Special/Empty
FOUND MODIFICATION = player FOR PLAYER #0
AL lib: ALc.c:1368: exit(): closing 1 Device
AL lib: ALc.c:1345: alcCloseDevice(): destroying 1 Context
AL lib: alSource.c:2362: alcDestroyContext(): deleting 32 Source(s)
AL lib: alBuffer.c:1079: exit(): deleting 16 Buffer(s)
(snipped further for brevity)
make me a sandwich
make: *** No rule to make target 'me'. Stop.
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Re: Compiling with Code::Blocks, part deux

Post by chuck_starchaser »

That looks okay to me. Just bogus error messages, AFAIK; I get them too. Are you experiencing any problems in-game?
By the way, your vs binary seems to be working for PU. Unfortunately, there seems to be some engine bugs I'm going
to try and reproduce in Ubuntu, that until addressed I won't be able to merge the testing branch back to trunk. Like
a report of the game freezing after killing a campaign enemy. Might be some python version incompatibility; I suspect.
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Re: Compiling with Code::Blocks, part deux

Post by shenle »

I'll be happy to provide further binaries as needed, since I have a working setup.
make me a sandwich
make: *** No rule to make target 'me'. Stop.
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Re: Compiling with Code::Blocks, part deux

Post by chuck_starchaser »

Excellent! Thanks!
So, I'm playing Privateer, trying to see what problems there may be in Ubuntu.
I didn't experience a crash, like Gorbalad had in Windows; but I did get the problem of the
screen staying red-tinted after getting some damage. Also got those blue damage particles
looking like white billboards.. No alpha blending. And at a bar, the picture of a fixer is gone;
he appears as a white rectangle.
So, I'll play some more, then try to find the causes of these problems and fix them, and then
I'll let you know when the code is ready for a new compile.
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Re: Compiling with Code::Blocks, part deux

Post by shenle »

chuck_starchaser wrote:but I did get the problem of the
screen staying red-tinted after getting some damage.
So that's a bug, not a feature? I wasn't sure. :)
make me a sandwich
make: *** No rule to make target 'me'. Stop.
Post Reply