Bug creation and email sending has been disabled, file new bugs at gcc.gnu.org/bugzilla
Bug 109 - Error compiling 4.8.2 on Cygwin
Summary: Error compiling 4.8.2 on Cygwin
Status: NEW
Alias: None
Product: GDC
Classification: Unclassified
Component: gdc (show other bugs)
Version: 4.8.x
Hardware: All All
: --- normal
Assignee: Iain Buclaw
URL:
Depends on:
Blocks:
 
Reported: 2014-03-29 01:18 CET by james.darnley
Modified: 2017-11-10 22:36 CET (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description james.darnley 2014-03-29 01:18:07 CET
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__
Comment 1 Iain Buclaw 2017-11-10 22:36:58 CET
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.