Open TTD can't be compiled with MinGW

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

Post Reply
Joe#
Engineer
Engineer
Posts: 17
Joined: 15 Jan 2013 00:51

Open TTD can't be compiled with MinGW

Post by Joe# »

Hi,

Seeing a wiki tutorial page for doing this, I had a go at compiling OpenTTD for my Windows 8.1 64bit OS yesterday but I couldn't because MinGW's implementation of the POSIX header file "unistd.h" does not implement: fdatasync(int) which is called by "ini.cpp" at line 84.

To makesure there wasn't something I was doing wrong I sent an email to the MinGW users mailing list and Gisle replied:
fsync() nor fdatasync() isn't part of MingW, but can easily
be replaced by:

#include <io.h>

extern __inline__ int fdatasync (int fd)
{
return _commit(fd);
}

(or a macro).

The POSIX distinction between fsync() and fdatasync() is probably
not important for OpenTTD. Looking at:
http://git.openttd.org/?p=trunk.git;a=b ... da;hb=HEAD

the code around 'WITH_FDATASYNC' looks fishy.

Ref:
https://msdn.microsoft.com/en-us/librar ... 2147217396
So I think the Wiki page for the MinGW tutorial should be disabled until MinGW can compile OpenTTD.
Joe#
Engineer
Engineer
Posts: 17
Joined: 15 Jan 2013 00:51

Re: Open TTD can't be compiled with MinGW

Post by Joe# »

Kieth from the MinGW users mailing list:
> fsync() nor fdatasync() isn't part of MingW,

They aren't even guaranteed to be supported by a POSIX conforming
system, since both are designated as "optional", (which means that
applications wishing to use them should check the applicable feature
test macros, to ensure that they are provided); since MinGW defines
*neither* _POSIX_FSYNC *nor* _POSIX_SYNCHRONIZED_IO, it should be clear
that neither function will be supported, and there is therefore no
requirement, (even under POSIX.1-2008), to provide so much as even a
stub implementation.

> ...snip...
>
> the code around 'WITH_FDATASYNC' looks fishy.

Agreed; very fishy indeed, for there appears to be no attempt whatsoever
to check API availability, before gratuitously assuming support.
Eddi
Tycoon
Tycoon
Posts: 8269
Joined: 17 Jan 2007 00:14

Re: Open TTD can't be compiled with MinGW

Post by Eddi »

you should probably post that on the bug tracker, so a dev can review it.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 39 guests