Page 1 of 6
[re-unsolved] Mingw compiling problems
Posted: 18 Dec 2009 19:17
by Lord Aro
i've decided to learn how to compile the source
since i dont have admin access i can't install visual c++ so i went for mingw
have installed it ok i think but when i input the suggested
it complains and says
can anyone help?
also, when i installed it it said there was a newer version available, should i get it?
Re: Mingw compiling problems
Posted: 18 Dec 2009 20:11
by planetmaker
Obviously you have to go and fix your search paths. Have a look at the mingw wiki. It's quite verbose on the installation, especially also on the required search paths.
Re: Mingw compiling problems
Posted: 18 Dec 2009 20:16
by petert
Lord Aro wrote:also, when i installed it it said there was a newer version available, should i get it?
No.
Lord Aro wrote:since i dont have admin access i can't install visual c++ so i went for mingw
Hmm, does MinGW not require admin access or something?
Looks like you don't have GCC installed. Reinstall MinGW, and make sure to have
g++ compiler selected.
Re: Mingw compiling problems
Posted: 19 Dec 2009 10:28
by Lord Aro
thanks people, compiled in about 30 mins
now how to add a patch to the build?
the stickied topic doesnt really explain much...
(yes ok i haven't read all of it but can someone point me to the right place)

Re: Mingw compiling problems
Posted: 19 Dec 2009 14:22
by Gremnon
Unless it's a mercurial/git patch, in which case substitute -p0 for -p1
You can usually tell by opening the patch in a text editor, and if it has lots of a/src... and b/src then try it with -p1 instead.
Also patch will stop and complain if you've used the wrong p option.
Re: Mingw compiling problems
Posted: 19 Dec 2009 15:04
by Lord Aro
and when do i input this?
before/after:
or
EDIT: also, where do i put the patch file?
Re: Mingw compiling problems
Posted: 19 Dec 2009 15:09
by Gremnon
The patch files go in the same place as the configure folder - eg, one level up from the src folder. If you checked out to C:\Ottdsrc and the src folder is C:\Ottdsrc\src, then they go in Ottdsrc
You apply all patches BEFORE ./configure and make - this is because some patches, such as CargoDist, add to source.list, and that has to be parsed so it knows what files to use to compile. It contains rules that add in or remove some OS specific files - no use compiling Unix.cpp if you're making a Windows build.
So, apply patches, ./configure, then make.
Hope that helps.
Re: Mingw compiling problems
Posted: 19 Dec 2009 15:19
by Lord Aro
um, ok, next problem
1. my folders go: ottdsrc\trunk\src
put the patch in trunk or src?
(i think its trunk but i'll check anyway)
wiki is suprisingly non existent on these matters
2. is there a way to download an older source from svn via mingw?
Re: Mingw compiling problems
Posted: 19 Dec 2009 15:25
by Gremnon
Yes, trunk is the folder the .patch and .diff files go into.
If you want an older, or specific revision of trunk, use the following command:
Code: Select all
svn checkout -r##### svn://svn.openttd.org/trunk
Where ##### is the SVN revision number.
For example, for r18000:
Code: Select all
svn checkout -r18000 svn://svn.openttd.org/trunk
Re: Mingw compiling problems
Posted: 19 Dec 2009 15:26
by petert
Lord Aro wrote:wiki is suprisingly non existent on these matters
You didn't look hard enough on the forums. (Hint: Stickies)
Lord Aro wrote:put the patch in trunk or src?
(i think its trunk but i'll check anyway)
Trunk. But you'll have to figure out whether it's -p0 or -p1.
Lord Aro wrote:
2. is there a way to download an older source from svn via mingw?
svn co svn://svn.openttd.org/trunk -rXXXX
Re: Mingw compiling problems
Posted: 19 Dec 2009 15:34
by Gremnon
I've always found it safer to put the -r##### right after checkout, rather than at the end.
Re: Mingw compiling problems
Posted: 19 Dec 2009 17:19
by Lord Aro
petert wrote:You didn't look hard enough on the forums. (Hint: Stickies)
Lord Aro wrote:the stickied topic doesnt really explain much...

(yes ok i haven't read all of it but can someone point me to the right place)

thanks for your other answers

Re: [solved] Mingw compiling problems
Posted: 20 Dec 2009 17:11
by petert
Note that you can also use the following command to update to an older trunk revision:
Code: Select all
svn up -rXXXXX
or
svn update -rXXXXX
Re: [solved] Mingw compiling problems
Posted: 20 Dec 2009 17:55
by Lord Aro
update to an older trunk revision? don't you mean a newer one?
otherwise it would cause problems maybe
atually thinking about it, it probably wouldn't but explain anyway
Re: [solved] Mingw compiling problems
Posted: 20 Dec 2009 17:59
by petert
Well, if you have a clean copy of trunk, and you have a patch for an older version of trunk, then you want to update to an older revision. I guess it should be downgrade, but who cares?
Re: [solved] Mingw compiling problems
Posted: 20 Dec 2009 18:04
by Lord Aro
thanks!
i was just deleting the whole ottdsrc folder when i'd finished with it
this'll save time a lot
is there anything i should delete, like the binary? or will it just overwrite it?
[semi-sarcasm]thank you o mighty compiling master[/semi-sarcasm]
Re: [solved] Mingw compiling problems
Posted: 20 Dec 2009 18:52
by Gremnon
Each time you run 'make' it will generate a new binary, and replace the old one.
Which is sometimes not always good, such as when you add a patch that bumps savegame, and makes your old game unloadable.
But yes, sometimes svn update to an older revision does come in handy. I check out trunk for my pack, and then realise I needed a different revision, so 'update' it to the older revision the CargoDist patch is against.
Re: [solved] Mingw compiling problems
Posted: 20 Dec 2009 18:56
by Lord Aro
its ok that it may bump save game, i'd probably never use the version full time (i'm happy with stable, 32bpp and nightly

) so i'd just use it for testing that the patch worked
also, is it ok to upload (to the forums) a binary with just opengfx and opensfx so it works without original files?
Re: [solved] Mingw compiling problems
Posted: 20 Dec 2009 18:58
by petert
Lord Aro wrote:also, is it ok to upload (to the forums) a binary with just opengfx and opensfx so it works without original files?
Try not to. People should have their own copy of the original graphics and/or a copy of Open(G|S)FX.
Re: [solved] Mingw compiling problems
Posted: 20 Dec 2009 18:59
by Gremnon
I think it is, provided you keep the liscense files that come with them, as per GPL.
Edit: Yes, petert is right there too, but not everyone wants to use them. Also what about people who don't have the game yet, for some reason?
On a related topic, if you ever want to distribute a compiled binary you've made, after you've run make, run 'make bundle_zip' and it'll create the folder trunk/bundles and leave in there a freshly baked zip, just like the ones you'd download from the OpenTTD Website. I *think* if you put OpenG/SFX in the data folder where the binary is made (trunk/bin/data) they'll be included in the zip, but that'll give a significant increase in size to the zipped bundle.