Compiling on Windows Guide - Feedback needed
Moderator: Graphics Moderators
-
- Tycoon
- Posts: 2792
- Joined: 22 Feb 2011 18:34
Compiling on Windows Guide - Feedback needed
Hi all,
After my recent struggles to reduce compile time and bring the compiling of my NewGRFs to the Windows platform instead of using a Linux VM, I made a short guide on how to setup the system on Windows to also work with the make command. I just finished it, and would like to have some feedback on it before I merge it in with the DevZone-wiki. I'll probably have to rewrite some parts to be consistent with the rest of the wiki, and not place stuff double, but I wanted to have some feedback before I do that.
Are the steps I take clear, do I need to clarify or expand some stuff? Are there any errors in it? All comments are welcome.
After my recent struggles to reduce compile time and bring the compiling of my NewGRFs to the Windows platform instead of using a Linux VM, I made a short guide on how to setup the system on Windows to also work with the make command. I just finished it, and would like to have some feedback on it before I merge it in with the DevZone-wiki. I'll probably have to rewrite some parts to be consistent with the rest of the wiki, and not place stuff double, but I wanted to have some feedback before I do that.
Are the steps I take clear, do I need to clarify or expand some stuff? Are there any errors in it? All comments are welcome.
- Attachments
-
- Windows Guide.pdf
- Guide
- (261.96 KiB) Downloaded 337 times
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
Re: Compiling on Windows Guide - Feedback needed
I've had a quick read through and it looks very good.
There is a better way of setting the Path variable though. The method you describe will work fine but it means you permanently have all the additions in your system path. It is better to set the path only for your compile environment. This also avoids the possibility of an error breaking the Windows system path.
The way I do this is with a batch file. Here is an example from an NML project that I have been experimenting with:
The second line adds all the necessary paths to the existing system path. The final line starts the command interpreter cmd.exe. After this batch file is run, commands such as 'make', 'make clean', 'make install', etc. can be run from the command line as normal.

There is a better way of setting the Path variable though. The method you describe will work fine but it means you permanently have all the additions in your system path. It is better to set the path only for your compile environment. This also avoids the possibility of an error breaking the Windows system path.
The way I do this is with a batch file. Here is an example from an NML project that I have been experimenting with:
Code: Select all
@echo off
PATH=C:\NML;C:\TortoiseHg;C:\Python27;C:\MinGW\msys\1.0\bin;C:\MinGW\bin;%Path%
cmd
Re: Compiling on Windows Guide - Feedback needed
not sure why that would be "better"... it'd rather be confusing to me to have different paths depending on how you opened the shell...
Re: Compiling on Windows Guide - Feedback needed
As I said:Eddi wrote:not sure why that would be "better"... it'd rather be confusing to me to have different paths depending on how you opened the shell...
Some Windows users are reluctant to make changes to their environmental variables, see here.mart3p wrote:This also avoids the possibility of an error breaking the Windows system path.

Re: Compiling on Windows Guide - Feedback needed
Looks simple enough. I shall try this next time I'll be working on NewGRF stuff.
From the looks of it not much can be wrong, so you might as well add it to the Devzone wiki now. If something needs to be changed later, it will only be minor edits I think.
From the looks of it not much can be wrong, so you might as well add it to the Devzone wiki now. If something needs to be changed later, it will only be minor edits I think.
Re: Compiling on Windows Guide - Feedback needed
There's a typo in the Python section:
Choose the installer that matches your system, or stick with the x86-version if you are unsure fo which version to use.
Re: Compiling on Windows Guide - Feedback needed
I tried setting up an environment following the guide. Here's what I came across:
- Python download URL was unavailable, because a new version is released since. Maybe link to https://www.python.org/downloads/ and state that the 2.x version should be downloaded (not 3.x due to findversion.sh).
- I would not just ploink everything into the C-root, but rather in a subdirectory to avoid cluttering.
- In the Path section, TortoiseHg will add itself to the Path, so that doesn't have to be duplicated. I would also just let Python add itself through the install option.
- In the Path section, it is not tested if the MinGW\bin directory is added to the Path variable correctly. This can be done for instance with gcc --version command.
- Maybe add the suggestion that Shift+rightclick in a folder adds the option to the context menu to open a command window there.
- Add a note about the UNIX2DOS issue (viewtopic.php?p=1123126#p1123126)
Apart from that it all works. Way easier than a virtual linux.
- Python download URL was unavailable, because a new version is released since. Maybe link to https://www.python.org/downloads/ and state that the 2.x version should be downloaded (not 3.x due to findversion.sh).
- I would not just ploink everything into the C-root, but rather in a subdirectory to avoid cluttering.
- In the Path section, TortoiseHg will add itself to the Path, so that doesn't have to be duplicated. I would also just let Python add itself through the install option.
- In the Path section, it is not tested if the MinGW\bin directory is added to the Path variable correctly. This can be done for instance with gcc --version command.
- Maybe add the suggestion that Shift+rightclick in a folder adds the option to the context menu to open a command window there.
- Add a note about the UNIX2DOS issue (viewtopic.php?p=1123126#p1123126)
Apart from that it all works. Way easier than a virtual linux.
Re: Compiling on Windows Guide - Feedback needed
that must be a new option, i don't remember it from the last time i installed python on windowsFooBar wrote:I would also just let Python add itself through the install option.
-
- Tycoon
- Posts: 2792
- Joined: 22 Feb 2011 18:34
Re: Compiling on Windows Guide - Feedback needed
I added it to the wiki as a single page, incorporating most feedback, what do you all think of it?
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
Re: Compiling on Windows Guide - Feedback needed
Very good! I think you should link to it from here: http://dev.openttdcoop.org/projects/home/wiki
Also on the subject of links: some links to external websites aren't working, while I think you meant to do that though.
Also on the subject of links: some links to external websites aren't working, while I think you meant to do that though.
-
- Tycoon
- Posts: 2792
- Joined: 22 Feb 2011 18:34
Re: Compiling on Windows Guide - Feedback needed
I did not add it yet to get some feedback and I did not yet figure out where to place the link (and which parts can be made obsolete).FooBar wrote:Very good! I think you should link to it from here: http://dev.openttdcoop.org/projects/home/wiki
Thanks for spotting, missed the : that is needed to make a link out of something.Also on the subject of links: some links to external websites aren't working, while I think you meant to do that though.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: Compiling on Windows Guide - Feedback needed
I think it might be a good time now, after some time to think about it, to add it to the wiki after all? 

OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
-
- Tycoon
- Posts: 2792
- Joined: 22 Feb 2011 18:34
Re: Compiling on Windows Guide - Feedback needed
I added the link to the Welcome page, near the very top, which I think is the best place to put the link.planetmaker wrote:I think it might be a good time now, after some time to think about it, to add it to the wiki after all?
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: Compiling on Windows Guide - Feedback needed
Perfect, thank youTransportman wrote:I added the link to the Welcome page, near the very top, which I think is the best place to put the link.planetmaker wrote:I think it might be a good time now, after some time to think about it, to add it to the wiki after all?

OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: Compiling on Windows Guide - Feedback needed
I tried your Guide...and failed
All programs are installed and the test commands worked:

Code: Select all
./findversion.sh: line 80: dirname: command not found
./findversion.sh: line 80: cd: HOME not set
/bin/bash: cut: command not found
...nmlc --version
hg
python
exit()
gcc --version
bash
exit
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: Compiling on Windows Guide - Feedback needed
well... seems the version detection also needs the common tools dirname and cut. They should also be available for standard mingw indstalls.
The HOME variable could be set in your .bashrc:
The HOME variable could be set in your .bashrc:
Code: Select all
export HOME=PATH/TO/HOMEDIR
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: Compiling on Windows Guide - Feedback needed
solved these Problems....
but i get a new error
To say the truth: I hate command line things and environmental variables....
but i get a new error

Code: Select all
4 "dach 2 make.bat"
[GIMP] gfx/terrain.png
/bin/bash: : command not found
make: *** [gfx/terrain.png] Error 127
./dach 2 make.bat: line 3: Pause: command not found
-
- Tycoon
- Posts: 2792
- Joined: 22 Feb 2011 18:34
Re: Compiling on Windows Guide - Feedback needed
Is bash available on your system? What happens when you just type "bash" in cmd? Does it load bash or does it give an error? If it loads properly, I guess you are using GIMP and bash doesn't know where it is located. Maybe you need to add GIMP to your path (as I described for the other programs here.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
Re: Compiling on Windows Guide - Feedback needed
bash:
I added
The project, which i'd like to compile is the "example project" from the Dev Zone.
Code: Select all
bash-3.1$
to the environmental variable PATH. But still the same error.."C:\Program Files\GIMP 2\bin"
The project, which i'd like to compile is the "example project" from the Dev Zone.
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: Compiling on Windows Guide - Feedback needed
If you have any paths or filenames with spaces, the scripts will break hard. That includes the paths to required binaries like nml or gimp or whatever.
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Who is online
Users browsing this forum: Ahrefs [Bot] and 9 guests