View topic - Compiling spring (mingw and visual studio 7/8)



All times are UTC + 1 hour


Post new topic Reply to topic  [ 582 posts ]  Go to page 1, 2, 3, 4, 5 ... 30  Next
Author Message
PostPosted: 05 Jan 2006, 18:45 
User avatar

Joined: 05 Jun 2005, 18:13
Location: NL
UP TO DATE INSTRUCTIONS CAN BE FOUND ON THE WIKI.

Just for reference, in case the wiki appears wrong or you think I didn't put it in the wiki correctly, the original post follows.

--Tobi





























###

Getting the most recent spring source
You can also download the 0.75b2 source at http://spring.clan-sy.com/dl/spring_0.75b2_src.zip

Building spring in Visual Studio 7 (2003)
Note: building spring in Visual Studio 7 is currently unsupport, these instructions are just here because the Visual Studio 8 instructions refer to them.

To build and run spring in visual studio (2003):
  • install the library package http://spring.clan-sy.com/dl/spring-vclibs.exe
    You need to install this in the "taspring_0.75b2" directory from the zipped source, or if you're using SVN, install it in "trunk"
    If done right, it will look like:

    taspring_0.75b2/
    taspring_0.75b2/rts
    taspring_0.75b2/omni
    taspring_0.75b2/... other dirs
    taspring_0.75b2/vclibs
  • install the DirectX SDK
  • open the project file. /rts/build/vstudio7/rts.vcproj
  • start building (usually you want to select the release build, debug is really too slow and is used only when you really know what you want to test)
  • select the working directory in the project properties, otherwise spring will crash on start

Building spring in Visual Studio 8 (2005)
(possibly the free Express Edition)

Building spring in visual studio 8 is very similar to visual studio 7. The differences are:
- use http://spring.clan-sy.com/dl/spring-vc8libs.exe , instead of spring-vclibs.exe
- use the visual studio 8 project file: /trunk/rts/build/vstudio8/rts.vcproj
- you will need to install the Platform SDK and DirectX SDK, and set up the directories of those correctly within visual studio.

Building spring using MinGW
Get the library package for MinGW:
http://www.unknown-files.net/spring/3801/mingwlibsv9/ . Make sure you install it it the trunk directory, so the path is: trunk/mingwlibs (similar to vclibs above)

Except for TortoiseSVN, which can be replaced by the commandline svn client or SmartSVN and Dev-Cpp, which can be replaced by a bare MinGW system, the listed programs are a must-have if you want to compile spring with MinGW/Dev-Cpp.
Oh, and quick instructions:
  • Grab and install the above programs.
  • Make sure C:\Python24 and C:\Dev-Cpp\bin are in your PATH environment variable. Make sure a MINGDIR environment variable with value C:\Dev-Cpp exists. (change paths where appropriate.) Set environment variables by: Start -> Settings -> Control Panel -> System -> Advanced -> Environment variables (for Windows XP).
  • Checkout the TA Spring SVN repository.
  • Open a console (Start -> Run -> cmd.exe -> Run), cd \path\to\taspring<enter> (where you checked it out in the previous step) and type scons configure<enter>, followed by scons<enter>. Refer to scons --help for options which can be passed to scons configure.
  • Wait.
  • Copy over datafiles and stuff from official spring to the game dir (where spring.exe is created).
  • Copy missing DLLs from mingwlibs/dll.
  • Start developing.

Crosscompiling spring using i586-mingw32msvc-gcc
First, grab the source, and make sure you have MinGW installed on your Linux box (on Ubuntu/Debian just install the mingw32 package).

Then follow this quick 'n dirty instructions:
Code:
cd /path/to/checkout/trunk
wget http://www.osrts.info/~tvo/spring-mingwlibs-v4.exe
7z x spring-mingwlibs-v4.exe
MINGDIR=/usr/i586-mingw32msvc \
  CC=i586-mingw32msvc-gcc \
  CXX=i586-mingw32msvc-g++ \
  scons configure platform=windows && scons


Last edited by knorke on 31 Dec 2011, 00:04, edited 11 times in total.
abma wanted it unstickied because its outdated


Top
 Offline Profile  
 
 Post subject:
PostPosted: 05 Jan 2006, 19:56 

Joined: 07 Nov 2005, 19:38
Does anyone know if Spring will compile with Code::Blocks IDE. Code::Blocks works with the following compilers

* GCC (MingW / Linux GCC)
* MSVC++
* Digital Mars
* Borland C++ 5.5
* Open Watcom

I don't have access to Visual Studio and this IDE is free.

Patmos


Top
 Offline Profile  
 
 Post subject:
PostPosted: 05 Jan 2006, 20:04 
AI Coder
User avatar

Joined: 14 Sep 2004, 10:32
Location: Cookieland
Do not try compiling spring with codeblocks+the free MS compiler. Get VS .Net 2005 enterprise edditiona dn try that out though, it's free as far as I know but only for so long so dont leave it for ages.

Also you'll ahve to recompile all the dll's (primarily groupAI and GlobalAI) udner the new compiler to get them working.


Top
 Offline Profile  
 
 Post subject:
PostPosted: 06 Jan 2006, 22:37 
Spring Developer

Joined: 13 Dec 2005, 20:16
some interesting compile output vs 2005
Quote:
1> Message: 'This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
taspring\rts\rendering\unitmodels\unit3dloader.cpp(285) : warning C4996: 'sprintf' was declared deprecated

rts\sim\units\commandai\factorycai.cpp(192) : warning C4996: '_snprintf' was declared deprecated
1> d:\program files\microsoft visual studio 8\vc\include\stdio.h(339) : see declaration of '_snprintf'

warning C4996: 'fopen' was declared deprecated

rts\system\platform\win\avigenerator.cpp(294) : error C2668: '_tcsstr' : ambiguous call to overloaded function

rts\rendering\map\bfgroundtextures.h(8) : fatal error C1083: Cannot open include file: 'jpeglib.h': No such file or directory

rts\game\ui\sharebox.cpp(74) : warning C4101: 'x' : unreferenced local variable

i fixed all of the errors except the ambiguous call to overload error.

I guess you can use #pragma warning(disable : 4996) but do you want to?


Top
 Offline Profile  
 
 Post subject:
PostPosted: 06 Jan 2006, 22:51 
Spring Developer

Joined: 13 Dec 2005, 20:16
Ewww 2 more
Quote:
rts\system\mmgr.cpp(232) : error C2440: 'initializing' : cannot convert from 'const char *' to 'char *'
Conversion loses qualifiers

rts\system\mmgr.cpp(234) : error C2440: '=' : cannot convert from 'const char *' to 'char *'
Conversion loses qualifiers



Top
 Offline Profile  
 
 Post subject:
PostPosted: 07 Jan 2006, 14:52 
User avatar

Joined: 05 Jun 2005, 18:13
Location: NL
Quote:
warning C4996: 'fopen' was declared deprecated

omg. MS really likes to break stuff :S
I'd like to declare microsoft deprecated :)

I added libjpeg to http://spring.clan-sy.com/dl/spring-vclibs.exe
Also tried to fix _tcsstr, but obviously I can't test if it works.

Also mmgr.cpp is removed from the vcproj file.

Hopefully it works out now...


Top
 Offline Profile  
 
 Post subject:
PostPosted: 07 Jan 2006, 18:06 
Spring Developer

Joined: 13 Dec 2005, 20:16
well i found out last night that boost hadn't completly built after commenting out that pesky ambigious type cast in the avi code (i've never used the avi stuff), and I battled with bjam for a couple hours which seems to create temp files to exec shell commands like mkdir and copy (ewwwwww). Bjam seems like a retarded make to me but what do i know. It produced 1GB of files to build, so i see your point about blote. It then just started to only run one command at a time, it got worse and worse. I was using the VS2005 command prompt, which i assumed was the same as the normal command prompt. I though it was just the env that was different. After screwing with %TEMP% and %TMP% and a ton of other stuff i got boost to build by running it in the standard cmd window. I though now it fill finally link, but of course M$ fucked me again, and it just so turns out that libc.lib is no longer supported. FUCK. That's where i'm stuck today, I though java was a pain in the ass with the way it dealt with libs, but this is crazy. Unfortunatly i don't have a copy of the libs from VS2003 and i don't know how it will complete linking unless i can figure out what was using libc in the first place. Any ideas?

P.S. I don't remember the java build env being this hard to get running.


Top
 Offline Profile  
 
 Post subject:
PostPosted: 07 Jan 2006, 18:24 
User avatar

Joined: 05 Jun 2005, 18:13
Location: NL
It's sometime ago that I build boost, but I remember something about either going in the seperate module directories themself and building threads/filesystem/regex directly, or using something like this:

Quote:
..\bjam "-sTOOLS=vc-7_1" "-sBUILD=release <runtime-link>dynamic" "--with-boost_thread --with-boost_filesystem" install

Which I kept in a BAT file, but I have no idea if it works now.
Essential is that you abort as soon as it starts building WAVE, because that produces 60 mb of library per configuration :S



That aside since you managed to build boost already (It could be useful to others).... chances are that LIBC is just renamed (Maybe libcrt,...libc* or something) The warning shows fopen is deprecated, but deprecated stuff is usually still avaiable, so a libc implementation has to be somewhere in the 2005 directories I guess. Good luck anyway, I never expected VS 2005 to give such problems :S


Top
 Offline Profile  
 
 Post subject:
PostPosted: 07 Jan 2006, 19:12 
Spring Developer

Joined: 13 Dec 2005, 20:16
I think m$ wants you to use libci.lib which is the newer one for /MT but from what i've read they also want to prevent multiple crts being used so they do not include the older libc.lib in VS2005 or the platform SDK. I think GLUT is causing this, but i'm not 100% sure. Turning on /NODEFAULTLIB and /NODEFAULTLIB:libc.lib generates tons of errors, i'm still digging


Top
 Offline Profile  
 
 Post subject:
PostPosted: 07 Jan 2006, 20:02 
Spring Developer

Joined: 13 Dec 2005, 20:16
AF, have you had any sucess building rts in VS 2005?

I rebuilt glue/glut and rebuilding rts, from /VERBOSE:LIB it looks like the missing symbols are from trying to link glue from the gui code, avi code and a few other things.

more to come.


Top
 Offline Profile  
 
 Post subject:
PostPosted: 07 Jan 2006, 20:05 
User avatar

Joined: 05 Jun 2005, 18:13
Location: NL
Spring doesn't need glut...
And most libraries that it links to are DLL export libaries:
SDL, opengl32, glu32, devil, zlibwapi, glew are all DLL lib files, however it links to a static lib of freetype and SDLmain, so that's where the references to libc might be I think.


Top
 Offline Profile  
 
 Post subject:
PostPosted: 07 Jan 2006, 21:00 
AI Coder
User avatar

Joined: 14 Sep 2004, 10:32
Location: Cookieland
I gave up trying to get hold of VS 2005 enterprise edition or a copy of the full VS 2005 a while ago. Otherwise I'm using VS 2003.


Top
 Offline Profile  
 
 Post subject:
PostPosted: 07 Jan 2006, 21:53 
Spring Developer

Joined: 13 Dec 2005, 20:16
finaly got spring.exe to build

here is what i did



added /VERBOSE:LIB

added libcmt.lib to ignore list in linker options. this depends on the glue problem, if you use the standard build you get libc.lib.

In the project properties, under C/C++ and then Language, change "Treat
wchar_t as Built-in Type" to "es (/Zc:wchar_t)".

add the libraries AdvAPI32.Lib & User32.lib as Additional dependencies in the properties of the project

changed c++ code generation run time target stuff after rebuilding glue 100 times, the end result was a change in the link lib msgs i got. not sure if this is needed to do a real build.

i also didn't get crashrpt to build so i just grabbed a pre-built version


Top
 Offline Profile  
 
 Post subject:
PostPosted: 08 Jan 2006, 00:55 
Spring Developer

Joined: 13 Dec 2005, 20:16
i'm stuck getting a
Quote:
_SCL_SECURE_VALIDATE_RANGE(

error in xstring. I googled this and it may be aproblem with boost and vs8, i tried to patch the boost source but it didn't help. I get this when i select a map.


Top
 Offline Profile  
 
 Post subject:
PostPosted: 08 Jan 2006, 01:00 
User avatar

Joined: 05 Jun 2005, 18:13
Location: NL
If boost has a problem with vs8, I guess there is nothing we can do but wait for a fix... :(


Top
 Offline Profile  
 
 Post subject:
PostPosted: 08 Jan 2006, 02:57 
Spring Developer

Joined: 13 Dec 2005, 20:16
it looks like line 134 of VFSHandler.cpp is causing the problem.

if (equal(dir.begin(), dir.end(), i->first.begin())) {

if i drill into the dir local variable it looks like it loops forever but again i'm a c++ noob so i don't quite know what is happening.


Top
 Offline Profile  
 
 Post subject:
PostPosted: 08 Jan 2006, 06:11 

Joined: 11 May 2005, 15:17
I also had problems with that line, I can├óÔé¼Ôäót remember exactly how I solved it but it was something like this.

*Warning untested code*
if(i->first.find(dir) != string::npos){


Top
 Offline Profile  
 
 Post subject:
PostPosted: 09 Jan 2006, 20:16 
Spring Developer

Joined: 13 Dec 2005, 20:16
Shodan are you saying you can get rts to compile under VS 2005?


Top
 Offline Profile  
 
PostPosted: 18 Jan 2006, 04:50 

Joined: 09 Jan 2006, 17:51
I am using the free copy of Visual C++ 2005 off the Microsoft website. RTS finally compiles, but it is asking for LIBC.lib. I read greenail's instructions, but I don't understand them. Would you please give this C++ newbie a little more help? Thanks.
EDIT:
If anyone wants a copy of boost compiled for VS8.0 I'd be happy to send it. I just don't have any web space.


Top
 Offline Profile  
 
 Post subject:
PostPosted: 19 Jan 2006, 15:05 
Spring Developer

Joined: 13 Dec 2005, 20:16
i gave up on VC8 and tried to compile with codeblocks and the 2003 VC7_1 toolkit, it puked on linking in 2 places. Debug puked by not finding a freetype object during linking, and release puked with some other linking error. I am starting to think i need to aquire a real version unless someone wants to help me with codeblocks. I can post the actual error messages (code blocks doens't let you copy the error text out of the gui!!!!)


Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 582 posts ]  Go to page 1, 2, 3, 4, 5 ... 30  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Site layout created by Roflcopter et al.