Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old December 3, 2013, 03:04   #1
mrrstark
Adept
 
Join Date: Aug 2013
Posts: 101
mrrstark is on a distinguished road
V in Cygwin, "direct.h" no such file

Trying to compile on Cygwin (&MinGW) but getting this error:
Quote:
...
Successfully compiled z-bitflag.c.
z-file.c:25:21: fatal error: direct.h: No such file or directory
compilation terminated.
Failed to compile z-file.c!

This is from rephial nightlies.
I followed these instructions in compiling.txt

Quote:
Using Cygwin (with MinGW)
-------------------------

Use this option if you want to build a native Windows executable that
can run with or without Cygwin.

Use the Cygwin setup.exe to install the mingw-gcc-core package and any
dependencies suggested by the installer.

Run these commands:

./autogen.sh
./configure --enable-win --with-no-install --host=i686-pc-mingw32
make
mrrstark is offline   Reply With Quote
Old December 3, 2013, 11:07   #2
FunkyGibbon
Rookie
 
Join Date: Dec 2013
Posts: 3
FunkyGibbon is on a distinguished road
Talking

Lurker turned Poster

I've looked at the source, turns out whoever is committing that file is using (most likely) DMC to compile (digital mars compiler) only that set has this 'direct.h' file and it is NOT POSIX or FOS compliant, it will not compile on any GCC compiler on Linux, Windows or OSX.

Strip that include 'direct.h' out and it should compile fine and without errors.

A note: Why is a non-FOS compiler being used in an Open Source project? DMC is only freeware and only on Windows.
FunkyGibbon is offline   Reply With Quote
Old December 3, 2013, 11:21   #3
takkaria
Veteran
 
takkaria's Avatar
 
Join Date: Apr 2007
Posts: 1,844
Donated: $40
takkaria is on a distinguished road
Quote:
Originally Posted by FunkyGibbon View Post
Lurker turned Poster

I've looked at the source, turns out whoever is committing that file is using (most likely) DMC to compile (digital mars compiler) only that set has this 'direct.h' file and it is NOT POSIX or FOS compliant, it will not compile on any GCC compiler on Linux, Windows or OSX.

Strip that include 'direct.h' out and it should compile fine and without errors.

A note: Why is a non-FOS compiler being used in an Open Source project? DMC is only freeware and only on Windows.
I don't think anyone is using DMC. That line works fine with mingw - it's a standard Windows hedaer - just not on cygwin.
__________________
"Physician, heal thyself."
takkaria is online now   Reply With Quote
Old December 3, 2013, 11:37   #4
FunkyGibbon
Rookie
 
Join Date: Dec 2013
Posts: 3
FunkyGibbon is on a distinguished road
Ah! I wasn't aware it was also a windows header, I've never seen it not even on windows.

Perhaps a simple ifdef would be a good choice? Because to compile that on *nix you would have to strip out that include. And it would avoid these compilation issues with people on other OS's.

#include (standard cross platform headers)

#ifdef _WINDOWS
#include direct.h (and other includes needed)
#else
#include (same includes but won't include direct.h)
#endif

FunkyGibbon is offline   Reply With Quote
Old December 3, 2013, 11:57   #5
takkaria
Veteran
 
takkaria's Avatar
 
Join Date: Apr 2007
Posts: 1,844
Donated: $40
takkaria is on a distinguished road
Quote:
Originally Posted by FunkyGibbon View Post
Ah! I wasn't aware it was also a windows header, I've never seen it not even on windows.

Perhaps a simple ifdef would be a good choice? Because to compile that on *nix you would have to strip out that include. And it would avoid these compilation issues with people on other OS's.

#include (standard cross platform headers)

#ifdef _WINDOWS
#include direct.h (and other includes needed)
#else
#include (same includes but won't include direct.h)
#endif

If you look in the file, this is already there.
__________________
"Physician, heal thyself."
takkaria is online now   Reply With Quote
Old December 3, 2013, 12:09   #6
FunkyGibbon
Rookie
 
Join Date: Dec 2013
Posts: 3
FunkyGibbon is on a distinguished road
Well I see the problem, there are only ifdefs for Windows, none for Linux and none for Cygwin and none for OS X, so all it is doing is checking if it is Windows, if it is not there are no ifdefs to prevent any other OS from not including direct.h. Maybe something in the makefile also? (I like to use IDE's not a makefile).

#ifdef WINDOWS
# include <windows.h>
# include <io.h>
# include <direct.h>
#elif __GNU_LINUX__
# include (all includes without windows specific)
#elif __CYGWIN__
# include (all includes with windows specific headers but without direct.h)
#elif __APPLE__ && __MACH__
# include (all includes without windows specific, probably same as Linux includes)
#endif

That would probably solve the issue, though I am no where near my Mac to try it. I am quite used to using single batch ifdefs, especially when compiling code written by mostly Windows using or MinGW using developers. I usually do it this way and I don't have problems.

The main issue is that the direct.h handles the mkdir and so *nix cannot 'mkdir' unless it hits this code below the ifdef. It seems to just fail when hitting the direct.h and it does not look like the compiler gives 2 hoots about the windows ifdef.

Just my 2 cents

Last edited by FunkyGibbon; December 3, 2013 at 12:22.
FunkyGibbon is offline   Reply With Quote
Old December 3, 2013, 12:20   #7
takkaria
Veteran
 
takkaria's Avatar
 
Join Date: Apr 2007
Posts: 1,844
Donated: $40
takkaria is on a distinguished road
Quote:
Originally Posted by FunkyGibbon View Post
Well I see the problem, there are only ifdefs for Windows, none for Linux and none for Cygwin and none for OS X, so all it is doing is checking if it is Windows, if it is not there are no ifdefs to prevent any other OS from not including direct.h. Maybe something in the makefile also? (I like to use IDE's not a makefile).

#ifdef WINDOWS
# include <windows.h>
# include <io.h>
# include <direct.h>
#elif __GNU_LINUX__
# include (all includes without windows specific)
#elif __CYGWIN__
# include (all includes with windows specific headers but without direct.h)
#elif __APPLE__ && __MACH__
# include (all includes without windows specific, probably same as Linux includes)
#endif

That would probably solve the issue, though I am no where near my Mac to try it. I am quite used to using single batch ifdefs, especially when compiling code written by mostly Windows using or MinGW using developers. I usually do it this way and I don't have problems

Just my 2 cents
If you look a bit more closely, you'll see that there are HAVE_*_H ifdef chunks around the relevant header includes. These are set up by either h-basic.h or autoconf or the makefile depending on the platform. The things we want to include are not based on platform but on header file availability, which is what the current setup does.

Obviously we need to stop direct.h being included if we're in cygwin and make sure that HAVE_DIRENT_H is defined in the makefile instead. But we already do what you're suggesting, we just need to tweak it.
__________________
"Physician, heal thyself."
takkaria is online now   Reply With Quote
Old December 3, 2013, 15:25   #8
mrrstark
Adept
 
Join Date: Aug 2013
Posts: 101
mrrstark is on a distinguished road
So for cygwin, can I just comment out the direct.h, or define something to finish the compilation?


I also tried a MinGW shell compile, following the instructions in compiling.txt, but I got some other error, and no files compiled at all. I'm not at home atm, so can't provide the error message here. Is it expected to work as in compiling.txt?
mrrstark is offline   Reply With Quote
Old December 3, 2013, 20:10   #9
Nick
Vanilla maintainer
 
Nick's Avatar
 
Join Date: Apr 2007
Location: Canberra, Australia
Age: 52
Posts: 6,948
Donated: $60
Nick is on a distinguished road
Quote:
Originally Posted by mrrstark View Post
I also tried a MinGW shell compile, following the instructions in compiling.txt, but I got some other error, and no files compiled at all. I'm not at home atm, so can't provide the error message here. Is it expected to work as in compiling.txt?
In MinGW, I just use
Code:
MINGW=yes make -f Makefile.win
from the src directory.
__________________
One for the Dark Lord on his dark throne
In the Land of Mordor where the Shadows lie.
Nick is online now   Reply With Quote
Old December 3, 2013, 23:59   #10
mrrstark
Adept
 
Join Date: Aug 2013
Posts: 101
mrrstark is on a distinguished road
Quote:
Originally Posted by Nick View Post
In MinGW, I just use
Code:
MINGW=yes make -f Makefile.win
from the src directory.
Awesome. That worked.
mrrstark is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
T-Engine4 / ToME4 beta26 aka "Nature's Grace" unleashed! DarkGod ToME 0 May 17, 2011 23:06
T-Engine4 / ToME4 beta16 "World Wide Tome" unleashed! DarkGod ToME 1 December 24, 2010 22:29
Lua "obsolete file error", blargh Therem Harth ToME 4 July 4, 2010 14:02
"Great" drops replaced by "good" drops in vaults: bug or feature? PowerWyrm Vanilla 14 February 27, 2010 15:54
"repeat" Command just little bit "smarter" ClaytonAguiar Vanilla 8 June 17, 2009 15:01


All times are GMT +1. The time now is 12:04.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.