[re-unsolved] Mingw compiling problems

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2369
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

[re-unsolved] Mingw compiling problems

Post 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

Code: Select all

gcc -v
it complains and says

Code: Select all

sh: gcc: command not found
can anyone help?

also, when i installed it it said there was a newer version available, should i get it?
Last edited by Lord Aro on 12 Aug 2010 07:00, edited 4 times in total.
AroAI - A really feeble attempt at an AI

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Mingw compiling problems

Post 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.
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: Mingw compiling problems

Post 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?
Lord Aro wrote:

Code: Select all

sh: gcc: command not found
Looks like you don't have GCC installed. Reinstall MinGW, and make sure to have g++ compiler selected.
User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2369
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: Mingw compiling problems

Post 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) :bow:
AroAI - A really feeble attempt at an AI

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
User avatar
Gremnon
Tycoon
Tycoon
Posts: 1517
Joined: 16 Sep 2005 12:23
Skype: the_gremnon
Location: /home
Contact:

Re: Mingw compiling problems

Post by Gremnon »

Code: Select all

patch -p0 -i <patchname>
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.
User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2369
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: Mingw compiling problems

Post by Lord Aro »

and when do i input this?

before/after:

Code: Select all

./configure
or

Code: Select all

make
EDIT: also, where do i put the patch file?
AroAI - A really feeble attempt at an AI

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
User avatar
Gremnon
Tycoon
Tycoon
Posts: 1517
Joined: 16 Sep 2005 12:23
Skype: the_gremnon
Location: /home
Contact:

Re: Mingw compiling problems

Post 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.
User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2369
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: Mingw compiling problems

Post by Lord Aro »

um, ok, next problem :roll:
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?
AroAI - A really feeble attempt at an AI

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
User avatar
Gremnon
Tycoon
Tycoon
Posts: 1517
Joined: 16 Sep 2005 12:23
Skype: the_gremnon
Location: /home
Contact:

Re: Mingw compiling problems

Post 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
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: Mingw compiling problems

Post 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
User avatar
Gremnon
Tycoon
Tycoon
Posts: 1517
Joined: 16 Sep 2005 12:23
Skype: the_gremnon
Location: /home
Contact:

Re: Mingw compiling problems

Post by Gremnon »

I've always found it safer to put the -r##### right after checkout, rather than at the end.
User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2369
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: Mingw compiling problems

Post 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) :bow:

thanks for your other answers :bow:
AroAI - A really feeble attempt at an AI

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: [solved] Mingw compiling problems

Post 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
User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2369
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: [solved] Mingw compiling problems

Post 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
AroAI - A really feeble attempt at an AI

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: [solved] Mingw compiling problems

Post 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?
User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2369
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: [solved] Mingw compiling problems

Post by Lord Aro »

thanks!
i was just deleting the whole ottdsrc folder when i'd finished with it
this'll save time a lot :bow:

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]
AroAI - A really feeble attempt at an AI

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
User avatar
Gremnon
Tycoon
Tycoon
Posts: 1517
Joined: 16 Sep 2005 12:23
Skype: the_gremnon
Location: /home
Contact:

Re: [solved] Mingw compiling problems

Post 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.
User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2369
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: [solved] Mingw compiling problems

Post 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 :wink: ) 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?
AroAI - A really feeble attempt at an AI

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: [solved] Mingw compiling problems

Post 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.
User avatar
Gremnon
Tycoon
Tycoon
Posts: 1517
Joined: 16 Sep 2005 12:23
Skype: the_gremnon
Location: /home
Contact:

Re: [solved] Mingw compiling problems

Post 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.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 13 guests