Compiling NewGRF very slow

Discussions about the technical aspects of graphics development, including NewGRF tools and utilities.

Moderator: Graphics Moderators

Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: Compiling NewGRF very slow

Post by Transportman »

planetmaker wrote:there probably is somewhere a .bashrc or a bash.profile file.
Thanks, got it completely working now. Bash tripped over some some spaces in folders in the Windows PATH variable, but adding the needed paths through .bashrc did it.
Maybe you want to write down your experiences, the way to get the compile environment on windows going? As a note for yourself and others to profit from it?
http://dev.openttdcoop.org/projects/home/wiki could well use that addition :)
I will make a guide, I'll do that with a completely clean Windows install in a VM, to make sure I include all needed steps. Then other people don't have to struggle that much with getting things working.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2369
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: Compiling NewGRF very slow

Post by Lord Aro »

In a fit of insanity, I decided to try compiling(?) a newgrf myself. However, i get the same (or similar errors as this):
Transportman wrote:

Code: Select all

File "<string>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'days'
I'm not on windows (arch linux), so it i don't think it's the same (PATH) issue...

Code: Select all

hg log -rtip --template='{time|shortdate}'
succeeds fine

Code: Select all

Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'days'
/bin/bash: let: x=5272 days, 0:00:00 + 65536 * 0: syntax error in expression (error token is "days, 0:00:00 + 65536 * 0")
(repeated several times)


Any ideas?
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
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: Compiling NewGRF very slow

Post by Transportman »

Lord Aro wrote:In a fit of insanity, I decided to try compiling(?) a newgrf myself. However, i get the same (or similar errors as this):
Transportman wrote:

Code: Select all

File "<string>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'days'
I'm not on windows (arch linux), so it i don't think it's the same (PATH) issue...

Code: Select all

hg log -rtip --template='{time|shortdate}'
succeeds fine

Code: Select all

Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'days'
/bin/bash: let: x=5272 days, 0:00:00 + 65536 * 0: syntax error in expression (error token is "days, 0:00:00 + 65536 * 0")
(repeated several times)


Any ideas?
I use the latest makefile from here with a modified version of findversion.sh. The modification to findversion.sh I talked about earlier, but that is just to make it work on Windows.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
User avatar
mart3p
Tycoon
Tycoon
Posts: 1030
Joined: 31 Oct 2005 21:00
Location: UK

Re: Compiling NewGRF very slow

Post by mart3p »

Transportman wrote:I use the latest makefile from here with a modified version of findversion.sh. The modification to findversion.sh I talked about earlier, but that is just to make it work on Windows.
You shouldn't need to modify findversion.sh. It works fine for me compiling ISR on Windows.

I'm using MinGW/Msys and Python 2.7.3.
Image
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: Compiling NewGRF very slow

Post by Transportman »

mart3p wrote:
Transportman wrote:I use the latest makefile from here with a modified version of findversion.sh. The modification to findversion.sh I talked about earlier, but that is just to make it work on Windows.
You shouldn't need to modify findversion.sh. It works fine for me compiling ISR on Windows.

I'm using MinGW/Msys and Python 2.7.3.
I have a different Python version (3.3.5), maybe that's causing the issue on my computer.

Found another minor issue, after doing a make clean and then make again, the makefile fails with the following error:

Code: Select all

[DOC] docs/readme.txt
bash: -c: line 0: syntax error near unexpected token `('
bash: -c: line 0: `[ -z "unix2dos" ] || unix2dos unix2dos 6.0.5 (2014-04-17) MSY
S version. Without Unicode UTF-16 support. With native language support. LOCALED
IR: /usr/share/locale -q docs/readme.txt'
make: *** [docs/readme.txt] Error 2
The line from the Makefile that fails is

Code: Select all

$(_V) [ -z "$(UNIX2DOS)" ] || $(UNIX2DOS) $(UNIX2DOS_FLAGS) $@
UNIX2DOS is in both my Windows and Bash PATH variables as it is part of MSYS.

Running make again after this works fine however.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
User avatar
mart3p
Tycoon
Tycoon
Posts: 1030
Joined: 31 Oct 2005 21:00
Location: UK

Re: Compiling NewGRF very slow

Post by mart3p »

Transportman wrote:
mart3p wrote:
Transportman wrote:I use the latest makefile from here with a modified version of findversion.sh. The modification to findversion.sh I talked about earlier, but that is just to make it work on Windows.
You shouldn't need to modify findversion.sh. It works fine for me compiling ISR on Windows.

I'm using MinGW/Msys and Python 2.7.3.
I have a different Python version (3.3.5), maybe that's causing the issue on my computer.
It's possible to install multiple versions of Python. You could try installing Python 2.7 and changing your PATH variable accordingly.

Due to problems I've had using Msys and paths containing spaces, I installed Python 2.7 in C:\Python27, maybe this would help?
Image
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: Compiling NewGRF very slow

Post by Transportman »

mart3p wrote:
Transportman wrote:hat's causing the issue on my computer.
It's possible to install multiple versions of Python. You could try installing Python 2.7 and changing your PATH variable accordingly.
It was indeed my version of Python that was too new, going back to Python 2.7 fixes the problems I had with findversion.sh.
Due to problems I've had using Msys and paths containing spaces, I installed Python 2.7 in C:\Python27, maybe this would help?
I also had problems with that, will advise against that in the guide I will be making.

The making of the docs still has issues, but for testing purposes that is not a problem.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
User avatar
mart3p
Tycoon
Tycoon
Posts: 1030
Joined: 31 Oct 2005 21:00
Location: UK

Re: Compiling NewGRF very slow

Post by mart3p »

Transportman wrote:The making of the docs still has issues, but for testing purposes that is not a problem.
As ISR doesn't use the facility to generate docs, I've not had this issue. But out of interest, I changed the name of readme.txt to readme.ptxt to trigger the generation of readme.txt. This all works as intended for me, compilation proceeds without errors.

On my system the variable UNIX2DOS is set to unix2dos and UNIX2DOS_FLAGS is set to -q (running the command 'make help' will display all the makefile variable settings). I think your problem is due to the UNIX2DOS_FLAGS variable not being set correctly. So I believe the line in the makefile that fails for you is:

Code: Select all

UNIX2DOS_FLAGS ?= $(shell [ -n $(UNIX2DOS) ] && $(UNIX2DOS) -q --version 2>/dev/null && echo "-q" || echo "")
You could try overriding the setting of this variable by adding the line:

Code: Select all

UNIX2DOS_FLAGS = -q
to makefile.local.
Image
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: Compiling NewGRF very slow

Post by Transportman »

Changing the UNIX2DOS_FLAGS to -q in the Makefile or Makefile.config works, but in a makefile.local it does not work.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
User avatar
mart3p
Tycoon
Tycoon
Posts: 1030
Joined: 31 Oct 2005 21:00
Location: UK

Re: Compiling NewGRF very slow

Post by mart3p »

Transportman wrote:Changing the UNIX2DOS_FLAGS to -q in the Makefile or Makefile.config works, but in a makefile.local it does not work.
Yes you're right. I added the line:

Code: Select all

-include Makefile.local
to the ISR Makefile.config, so that I could use a Makefile.local file for local settings such as my install path.

Anyway this proves the problem is with the setting of the UNIX2DOS_FLAGS variable. But why you're having this problem, I have no idea. :?
Image
Cadde
Transport Coordinator
Transport Coordinator
Posts: 290
Joined: 07 Oct 2004 12:51

Re: Compiling NewGRF very slow

Post by Cadde »

Sorry to revive this topic but i ran into the same issue with the

Code: Select all

print (date(x, y, z)-date(a,b,c)).days 
debacle.

It should actually be...

Code: Select all

print ((date(x, y, z)-date(a,b,c)).days)
As in, an extra set of parenthesis.
As otherwise, the ".days" bit is being applied to the print command.

Surprises me that no one with python experience spotted that...
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Compiling NewGRF very slow

Post by Alberth »

Makefile was created before Python3 was a thing.
Being a retired OpenTTD developer does not mean I know what I am doing.
Cadde
Transport Coordinator
Transport Coordinator
Posts: 290
Joined: 07 Oct 2004 12:51

Re: Compiling NewGRF very slow

Post by Cadde »

I never really liked python. I only like strong typed languages. ;)
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 10 guests