It may work, but I don't like it. Can you please try this one instead,
and report whether it works?
Different error:
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -I. -I./Include -DPy_BUILD_CORE -c ./Modules/posixmodule.c -o Modules/posixmodule.o
In file included from Include/Python.h:57,
from Modules/posixmodule.c:30:
Include/pyport.h:520: warning: `struct winsize' declared inside parameter list
Include/pyport.h:520: warning: its scope is only this definition or declaration, which is probably not what you want
Include/pyport.h:521: warning: `struct winsize' declared inside parameter list
Modules/posixmodule.c: In function `_pystat_fromstructstat':
Modules/posixmodule.c:1306: error: structure has no member named `st_atimespec'
Modules/posixmodule.c:1307: error: structure has no member named `st_mtimespec'
Modules/posixmodule.c:1308: error: structure has no member named `st_ctimespec'
Modules/posixmodule.c: In function `posix_chroot':
Modules/posixmodule.c:1735: error: `chroot' undeclared (first use in this function)
Modules/posixmodule.c:1735: error: (Each undeclared identifier is reported only once
Modules/posixmodule.c:1735: error: for each function it appears in.)
Modules/posixmodule.c: In function `posix_setgroups':
Modules/posixmodule.c:5506: warning: implicit declaration of function `setgroups'
Modules/posixmodule.c: In function `posix_wait3':
Modules/posixmodule.c:5590: warning: implicit declaration of function `wait3'
Modules/posixmodule.c: In function `posix_wait4':
Modules/posixmodule.c:5614: warning: implicit declaration of function `wait4'
Modules/posixmodule.c: In function `posix_lstat':
Modules/posixmodule.c:5701: error: `lstat' undeclared (first use in this function)
Modules/posixmodule.c: In function `posix_major':
Modules/posixmodule.c:6337: warning: implicit declaration of function `major'
Modules/posixmodule.c: In function `posix_minor':
Modules/posixmodule.c:6350: warning: implicit declaration of function `minor'
Modules/posixmodule.c: In function `posix_makedev':
Modules/posixmodule.c:6363: warning: implicit declaration of function `makedev'
Modules/posixmodule.c: In function `posix_getloadavg':
Modules/posixmodule.c:7955: warning: implicit declaration of function `getloadavg'
*** Error code 1
Stop in /bu/pkg/Python-2.5.1 (line 1111 of Makefile).
__BSD_VISIBLE is there (it wasn't there before and that's what was causing my original problem).
dnm@kili:/bu/pkg/Python-2.5.1$ grep _BSD_SOURCE pyconfig.h
dnm@kili:/bu/pkg/Python-2.5.1$ grep _BSD_VISIBLE pyconfig.h
#define __BSD_VISIBLE 1
I don't understand what's causing the problem, though:
/usr/include/unistd.h:
#if __XPG_VISIBLE >= 500
ssize_t pread(int, void *, size_t, off_t);
ssize_t pwrite(int, const void *, size_t, off_t);
int ttyname_r(int, char *, size_t)
__attribute__((__bounded__(__string__,2,3)));
#endif
#if __BSD_VISIBLE || __XPG_VISIBLE <= 500
/* Interfaces withdrawn by X/Open Issue 5 Version 0 */
void *brk(void *);
int chroot(const char *);
int getdtablesize(void);
int getpagesize(void);
char *getpass(const char *);
void *sbrk(int);
#endif
#if __POSIX_VISIBLE >= 200112 || __XPG_VISIBLE >= 420
int lockf(int, int, off_t);
#endif
---
posixmodule.i:
ssize_t pread(int, void *, size_t, off_t);
ssize_t pwrite(int, const void *, size_t, off_t);
int ttyname_r(int, char *, size_t)
__attribute__((__bounded__(__string__,2,3)));
# 188 "/usr/include/unistd.h" 3 4
int lockf(int, int, off_t);
---
Plus, I get lots of warnings that I didn't get using my patch. Sample:
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -I. -I./Include -DPy_BUILD_CORE -c ./Modules/threadmodule.c -o Modules/threadmodule.o
In file included from Include/Python.h:57,
from Modules/threadmodule.c:5:
Include/pyport.h:520: warning: `struct winsize' declared inside parameter list
Include/pyport.h:520: warning: its scope is only this definition or declaration, which is probably not what you want
Include/pyport.h:521: warning: `struct winsize' declared inside parameter list
Here are the differences between the pyconfig.h with my patch and with yours:
dnm@kili:/bu/pkg/Python-2.5.1$ diff pyconfig.h pyconfig.h.martin
93c93
< #define HAVE_CURSES_RESIZETERM 1
---
/* #undef HAVE_CURSES_RESIZETERM */
647c647
< #define HAVE_TERM_H 1
---
744c744
< #define MVWDELCH_IS_EXPRESSION 1
---
/* #undef MVWDELCH_IS_EXPRESSION */
863c863
< #define WINDOW_HAS_FLAGS 1
---
/* #undef WINDOW_HAS_FLAGS */
932c932
< /* #undef _POSIX_C_SOURCE */
---
#define _POSIX_C_SOURCE 200112L
941c941
< /* #undef _XOPEN_SOURCE */
---
#define _XOPEN_SOURCE 600
944c944
< /* #undef _XOPEN_SOURCE_EXTENDED */
---
#define _XOPEN_SOURCE_EXTENDED 1
Thanks,
dnm