While trying to compile gdc 4.8.2 on Cygwin following the generic install instrcutions at http://wiki.dlang.org/GDC/Installation/Generic I encountered the following errors. The gcc source I used is the one provided when you tell cygwin's setup.exe to give you the source for it's gcc-core package version 4.8.2-2 ../../gcc-4.8.2/gcc/d/dfrontend/filename.c: In static member function ‘static int FileName::ensurePathExists(const char*)’: ../../gcc-4.8.2/gcc/d/dfrontend/filename.c:597:43: error: ‘sep’ was not declared in this scope if (path[strlen(path) - 1] != sep) ^ ../../gcc-4.8.2/gcc/d/dfrontend/filename.c:606:21: error: ‘r’ was not declared in this scope if (r) ^ ../../gcc-4.8.2/gcc/d/dfrontend/filename.c:611:25: error: ‘errno’ was not declared in this scope if (errno != EEXIST) ^ ../../gcc-4.8.2/gcc/d/dfrontend/filename.c:611:34: error: ‘EEXIST’ was not declared in this scope if (errno != EEXIST) ^ When looking at the source file there appears to be an impossible #if condition of: #if _WIN32 ... #elif POSIX ... #endif I am no expert when it comes system related compiling but I would have thought that these should just be #else statements or perhaps an some #if including __CYGWIN__
From the source: object.h --- #define POSIX (__linux__ || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun) filename.c --- #if _WIN32 char sep = '\\'; #elif POSIX char sep = '/'; #endif if (path[strlen(path) - 1] != sep) --- So cygwin is neither _WIN32 or POSIX. http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_system#WindowswithCygwinPOSIX There is a debian patch that supports at hurd and kfreebsd. https://anonscm.debian.org/viewvc/gcccvs/branches/sid/gcc-8/debian/patches/gdc-frontend-posix.diff?revision=9713&view=markup Cygwin should be checked and added as well.