How to compile with Cygwin?

OpenTTD is a fully open-sourced reimplementation of TTD, written in C++, boasting improved gameplay and many new features.

Moderator: OpenTTD Developers

Post Reply
User avatar
Bouke
Engineer
Engineer
Posts: 93
Joined: 18 Jun 2004 10:11
Location: Oudehorne (Frl), The Netherlands

How to compile with Cygwin?

Post by Bouke »

Well... I searched among the whole forum but I can't find a solution for my compiling problems. I've got experience with PHP, QBasic (haha) and such languages but they don't need to be compiled.

Well, this is what I did.
- Installed TortoiseSVn and Cygwin
- Checkout (SVN) to C:\OpenTTD\
- Opened Cygwin
- cd /cygdrive/c/openttd

And there is where it goes wrong. I type "make" and the bash (??) returns "bash: make: file not found". So I really don't know how to compile the game.

So can anybody tell me how to compile this nice game?
skunk
Engineer
Engineer
Posts: 26
Joined: 01 Mar 2004 07:40
Location: Austria, Vienna

Post by skunk »

Did you install the 'gcc' (Gnu C Compiler)? Maybe this is the problem.

You can check, if you have the gcc, wenn you type 'gcc' into the bash-prompt.
Maybe even 'make' isn't installed (but, then the message should be 'command not found')

Skunk.
User avatar
Bouke
Engineer
Engineer
Posts: 93
Joined: 18 Jun 2004 10:11
Location: Oudehorne (Frl), The Netherlands

Post by Bouke »

Thank you, that helped me :). But you also have to install the 'make' library else it won't work neiter. Now I got my enhanced version working (also thank to this thread).

There are 2 things left I can't fix myself:

1) The MIDI won't play, I try to start it from the jukebox but it just doesn't start!!
2) Is there a way to include cygwin1.dll and cygz.dll into the .exe executable?

Much thanks in advantage!

--Update--:
Some buttons didn't want to work at first dry, so I downloaded the whole "devel" tools which fixed the problems :). But still need those 2 problems fixed please.
User avatar
Bouke
Engineer
Engineer
Posts: 93
Joined: 18 Jun 2004 10:11
Location: Oudehorne (Frl), The Netherlands

Post by Bouke »

Okey, this is what I did:

Code: Select all

$ cd /cygdrive/c/openttd
$ make WIN32=1 WITH_PNG=1 CYGWIN=1 WITH_DIRECTMUSIC=1 WITH_NETWORK=1
This crashed at network.c (bunches of errors and warnings). So I removed WITH_NETWORK=1:

Code: Select all

$ make WIN32=1 WITH_PNG=1 CYGWIN=1 WITH_DIRECTMUSIC=1
This also crashed at w32dm2.cpp so I removed WITH_DIRECTMUSIC=1:

Code: Select all

$ make WIN32=1 WITH_PNG=1 CYGWIN=1
1. And finally... that seems to work :). Even still I can't get my music to work and those .dll-files aren't included too :(. And the exit message says Unix instead of Windows. Is there anyway to fix this problems?

2. With removing the WITH_NETWORK=1 networkplaying is disabled, how can I compile OTTD wíth network support?
Error messages when I compile with networksupport:

Code: Select all

rnetwork.c:161: error: syntax error before "_listensocket"
network.c:161: warning: type defaults to `int' in declaration of `_listensocket'
network.c:161: warning: data defenition has no type or storage class
network.c: In function `NetworkSendCommand':
network.c:301: error: `INVALID_SOCKET' undeclared (first use in this function)
etc...
Line 161 reads:

Code: Select all

static SOCKET _listensocket;
As far as my knowledge goes (that musn't be really far ;)) this would be wrong IMO.
User avatar
Bouke
Engineer
Engineer
Posts: 93
Joined: 18 Jun 2004 10:11
Location: Oudehorne (Frl), The Netherlands

After playing around.

Post by Bouke »

Today I started testing again, but now the game generates this stackdump:

Code: Select all

Exception: STATUS_ACCESS_VIOLATION at eip=004A194A
eax=0000001A ebx=6111B310 ecx=0000001A edx=FFFFFFFF esi=00000000 edi=6111B310
ebp=0022EEB8 esp=0022EE60 program=C:\Program Files\OpenTTD\ttd.exe, pid 2404, thread main
cs=001B ds=0023 es=0023 fs=0038 gs=0000 ss=0023
Stack trace:
Frame     Function  Args
0022EEB8  004A194A  (77E46CA5, 00240000, 00000000, 002468E0)
0022EFE8  004A1ABE  (00400000, 00000000, 0024236B, 00000001)
0022F058  004A271E  (00000001, 10040168, 100400A8, 00000001)
0022F0A8  61005F54  (0022F0C0, 002305DC, 00000000, 0022F108)
0022FF88  6100616B  (00000000, 00000000, 00000000, 00000000)
End of stack trace
Is this due to the latest source I've downloaded or am I still doing things wrong?

I think it has to do with this error when I try to compile:

Code: Select all

/usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/../../../../i686-pc-cygwin/bind/lid: warning: cannot find entry symbol _WinMainCRTStartup; defaulting to 00401000
User avatar
Korenn
Tycoon
Tycoon
Posts: 1735
Joined: 26 Mar 2004 01:27
Location: Netherlands
Contact:

Post by Korenn »

normally when a compiler complains about missing symbols it is because you're not linking all required libraries...

I have no experience with cygwin, however :(
User avatar
Bouke
Engineer
Engineer
Posts: 93
Joined: 18 Jun 2004 10:11
Location: Oudehorne (Frl), The Netherlands

Post by Bouke »

Very weird, I'm just using the makefile, so it isn't me who has to include the libraries (I think?).

With what tool do you compile with then? Since I really want to compile OpenTTD and to start coding C. :).
User avatar
Korenn
Tycoon
Tycoon
Posts: 1735
Joined: 26 Mar 2004 01:27
Location: Netherlands
Contact:

Post by Korenn »

Bouke wrote:Very weird, I'm just using the makefile, so it isn't me who has to include the libraries (I think?).

With what tool do you compile with then? Since I really want to compile OpenTTD and to start coding C. :).
ms visual c++

but that costs money so might be hard to get, the free .net development tools have a compiler too, but I don't know if you can compile ottd with it.
User avatar
Bouke
Engineer
Engineer
Posts: 93
Joined: 18 Jun 2004 10:11
Location: Oudehorne (Frl), The Netherlands

Post by Bouke »

Korenn wrote:
Bouke wrote:Very weird, I'm just using the makefile, so it isn't me who has to include the libraries (I think?).

With what tool do you compile with then? Since I really want to compile OpenTTD and to start coding C. :).
ms visual c++

but that costs money so might be hard to get, the free .net development tools have a compiler too, but I don't know if you can compile ottd with it.
I did download the free 2003 .net command line. The command to compile is cl. Cl /? brings up this list of options. Do you think we could compile OpenTTD with this command. If so, how? :oops:
SHADOW-XIII
Tycoon
Tycoon
Posts: 14275
Joined: 09 Jan 2003 08:37

Post by SHADOW-XIII »

how about Dev CPP ?? anyone tried ??
what are you looking at? it's a signature!
User avatar
orudge
Administrator
Administrator
Posts: 25223
Joined: 26 Jan 2001 20:18
Skype: orudge
Location: Banchory, UK
Contact:

Post by orudge »

DevC++ is MinGW32 with a GUI. MinGW32 is a Win32 port of GCC, which is what Cygwin is too.
User avatar
Bouke
Engineer
Engineer
Posts: 93
Joined: 18 Jun 2004 10:11
Location: Oudehorne (Frl), The Netherlands

Post by Bouke »

After all compiling with Cygwin isn't as easy as typing "make". So I decided to try Microsoft Visual 6 C++. I've managed to create a "Debug" build, but I can't create a "Release" build since I can't create a libpng.lib. Can somebody help me here? I've downloaded the whole libpng package and also the zlib package.

My best guess is that I have to put the zlib in c:\libraries\zlib and pnglib in c:\libraries\lpng125. libpng includes also a MV6 "workspace". Then I select that I only want ZLib Lib and PNG Lib in the Build menu. Then it tries to build libpng first, that fails because zlib lib hasn't been created yet. But afterwards it tries to build the zlib lip, that's where it throws me this error:

Code: Select all

--------------------Configuration: zlib - Win32 LIB--------------------
Compiling...
gzio.c
Compiling...
adler32.c
compress.c
crc32.c
deflate.c
trees.c
uncompr.c
Generating Code...
Compiling...
infblock.c
fatal error C1083: Cannot open source file: 'C:\Libraries\zlib\infblock.c': No such file or directory
infcodes.c
fatal error C1083: Cannot open source file: 'C:\Libraries\zlib\infcodes.c': No such file or directory
inffast.c
inflate.c
inftrees.c
infutil.c
fatal error C1083: Cannot open source file: 'C:\Libraries\zlib\infutil.c': No such file or directory
zutil.c
Generating Code...
Error executing cl.exe.

zlib.lib - 3 error(s), 0 warning(s)
I've googled whole night long but couldn't find an solution. Can somebody help me please?

(We're nearing target -> OpenTTD Release Build instead of Debug Build :))
User avatar
Bouke
Engineer
Engineer
Posts: 93
Joined: 18 Jun 2004 10:11
Location: Oudehorne (Frl), The Netherlands

Post by Bouke »

After downloading the usefull packet from http://sourceforge.net/projects/openttd/ it all worked, no errors :). Another thing... why can't OpenTTD use DirectX 9 instead of the really old DirectX7? And why can't it use the newest versions of zlib and libpng?

Kind regards.
Post Reply

Return to “General OpenTTD”

Who is online

Users browsing this forum: No registered users and 4 guests