This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Building on CygWin 1.7: PATH_MAX redefined
Type: compile error Stage: resolved
Components: Build, Windows Versions: Python 3.4, Python 3.5
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: BreamoreBoy, Nicholas.DiPiazza, Scott.Rostrup, berker.peksag, jbinder, jlt63, masamoto, rpetrov, stutzbach
Priority: normal Keywords:

Created on 2010-04-27 16:43 by jbinder, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
python-build-logs.tar.gz jbinder, 2010-04-27 16:43 Logs of ./configure and make output
py_cygwin_build-3.1.3.txt Scott.Rostrup, 2010-12-24 04:05 Log of make error
Messages (9)
msg104334 - (view) Author: Jeff Binder (jbinder) Date: 2010-04-27 16:43
Building Python 3.1.2 on Cygwin 1.7, I got errors in main.c stemming from a warning: PATH_MAX redefined (see attached log).  I got around this by commenting out the #define.  I don't know if the best solution is #ifndef, #undef, or something else. . . . I know CygWin has changed the value of PATH_MAX in 1.7 (see: http://www.cygwin.com/cygwin-ug-net/ov-new1.7.html), though I'm not sure why that would cause this problem.
msg113037 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-08-05 20:01
None of the developers are much up on Cygwin and I am not sure it is directly supported by the core distribution. If it is not, this should be closed unless you have a specific patch.

In any case, you might do better with your question on python-list. Also, PEP11 list Jason Tishler (jason@tishler.net) as Cygwin maintainer.

Next time, please attach an edited, plain-text .txt log that can be viewed in the browser. I would have to be really motivated to download and extract a tar.gz file.
msg124589 - (view) Author: Scott Rostrup (Scott.Rostrup) Date: 2010-12-24 04:05
I just encountered this error in python 3.1.3 on cygwin 1.7.
I used the same fix as jbinder.

Old Modules/main.c (line 13):

  #if defined(MS_WINDOWS) || defined(__CYGWIN__)
  #include <windows.h>
  #ifdef HAVE_FCNTL_H
  #include <fcntl.h>
  #define PATH_MAX MAXPATHLEN
  #endif
  #endif

I guess now cygwin is defining PATH_MAX, one possible fix with ifndef:

  #if defined(MS_WINDOWS) || defined(__CYGWIN__)
  #include <windows.h>
  #ifdef HAVE_FCNTL_H
  #include <fcntl.h>
  #ifndef
  #define PATH_MAX MAXPATHLEN
  #endif
  #endif
  #endif

This compiled and worked for me and it appears jbinder as well.
msg161910 - (view) Author: Nicholas DiPiazza (Nicholas.DiPiazza) Date: 2012-05-29 20:14
In Python3.1.2-src/Modules/main.c

I actually had to use this to get it to work:

#if defined(MS_WINDOWS) || defined(__CYGWIN__)
#include <windows.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifndef HAVE_FCNTL_H
#define PATH_MAX MAXPATHLEN
#endif
#endif
msg224260 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-07-29 21:51
main.c has this.

#if defined(MS_WINDOWS) || defined(__CYGWIN__)
#include <windows.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#define PATH_MAX MAXPATHLEN
#endif
#endif

Wouldn't inserting #else before #define fix this issue?
msg224619 - (view) Author: Roumen Petrov (rpetrov) * Date: 2014-08-03 08:31
Hi Mark,
#else before is not solution. See  unified diff below as post by Scott Rostrup lack definition

Some additional information:
a) move outside #ifdef HAVE_FCNTL_H : definition PATH_MAX is not related to control functions on open files (fcntl.h)
b) HAVE_FCNTL_H is defined for MSC build as well. so no impact on other build

--- a/Modules/main.c
+++ b/Modules/main.c
@@ -9,6 +9,8 @@
 #include <windows.h>
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
+#endif
+#ifndef PATH_MAX
 #define PATH_MAX MAXPATHLEN
 #endif
 #endif
--
msg241698 - (view) Author: Masayuki Yamamoto (masamoto) * Date: 2015-04-21 04:37
This issue resolved on default branch in #20597 .

In 3.4 branch latest, PATH_MAX seems unused already in Modules/main.c:12 and Python/pythonrun.c:35.
I want to cherry-pick #20597 to 3.4 branch.
msg305403 - (view) Author: Masayuki Yamamoto (masamoto) * Date: 2017-11-02 02:10
This issue has been out-of-date since Python 3.4 maintenance became security status.
msg305411 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2017-11-02 10:20
Thank you for doing issue triage, Masayuki!
History
Date User Action Args
2022-04-11 14:57:00adminsetgithub: 52794
2017-11-02 10:20:49berker.peksagsetstatus: open -> closed

nosy: + berker.peksag
messages: + msg305411

resolution: out of date
stage: resolved
2017-11-02 02:10:11masamotosetmessages: + msg305403
2015-04-21 04:37:47masamotosetnosy: + masamoto
messages: + msg241698
2014-08-03 08:31:05rpetrovsetmessages: + msg224619
2014-07-30 00:24:34terry.reedysetnosy: - terry.reedy
2014-07-29 21:56:16BreamoreBoysetcomponents: + Windows
2014-07-29 21:53:22rpetrovsetnosy: + rpetrov
2014-07-29 21:51:17BreamoreBoysetversions: + Python 3.4, Python 3.5, - Python 3.1
nosy: + stutzbach, jlt63, BreamoreBoy

messages: + msg224260

components: + Build, - Installation, Windows
2012-05-29 20:14:41Nicholas.DiPiazzasetnosy: + Nicholas.DiPiazza
messages: + msg161910
2010-12-24 04:05:38Scott.Rostrupsetfiles: + py_cygwin_build-3.1.3.txt
nosy: + Scott.Rostrup
messages: + msg124589

2010-08-10 11:37:32floxsetcomponents: + Windows
2010-08-05 20:01:56terry.reedysetnosy: + terry.reedy
messages: + msg113037
2010-04-27 16:43:09jbindercreate