php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40488 Changes to TSRM cause builds to fail under cygwin
Submitted: 2007-02-14 23:15 UTC Modified: 2007-02-15 19:14 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: phil dot lello at homecall dot co dot uk Assigned:
Status: Closed Package: Compile Failure
PHP Version: 5.2.1 OS: cygwin (WinXP)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
39 + 2 = ?
Subscribe to this entry?

 
 [2007-02-14 23:15 UTC] phil dot lello at homecall dot co dot uk
Description:
------------
Build fails under cygwin due to conflicting struct redefinitions.

Note that I have verified 5.2.0 builds correctly from un-modified source.

This issue appears to be due to changes to #ifdef's in TSRM under 5.2.1

Reproduce code:
---------------
./configure
make


Expected result:
----------------
php builds

Actual result:
--------------
php doesn't build:
$ make
/bin/sh /home/Administrator/src/php-5.2.1/libtool --silent --preserve-dup-deps --mode=compile gcc -I/home/Administrator/src/php-5.2.1/ext/pdo_sqlite/sqlite/src -DPDO_SQLITE_BUNDLED=1 -DSQLITE_OMIT_CURSOR -I/home/Administrator/src/php-5.2.1/ext -Iext/pdo_sqlite/ -I/home/Administrator/src/php-5.2.1/ext/pdo_sqlite/ -DPHP_ATOM_INC -I/home/Administrator/src/php-5.2.1/include -I/home/Administrator/src/php-5.2.1/main -I/home/Administrator/src/php-5.2.1 -I/usr/include/libxml2 -I/home/Administrator/src/php-5.2.1/ext/date/lib -I/home/Administrator/src/php-5.2.1/TSRM -I/home/Administrator/src/php-5.2.1/Zend    -I/usr/include -g -O2  -c /home/Administrator/src/php-5.2.1/ext/pdo_sqlite/sqlite/src/date.c -o ext/pdo_sqlite/sqlite/src/date.lo 
In file included from /home/Administrator/src/php-5.2.1/Zend/../TSRM/TSRM.h:23,
                 from /home/Administrator/src/php-5.2.1/Zend/zend_alloc.h:27,
                 from /home/Administrator/src/php-5.2.1/Zend/zend.h:224,
                 from /home/Administrator/src/php-5.2.1/main/php.h:34,
                 from /home/Administrator/src/php-5.2.1/main/php_reentrancy.h:24,
                 from /home/Administrator/src/php-5.2.1/ext/pdo_sqlite/sqlite/src/date.c:57:
/home/Administrator/src/php-5.2.1/Zend/../TSRM/tsrm_config.w32.h:10:20: crtdbg.h: No such file or directory
In file included from /home/Administrator/src/php-5.2.1/TSRM/tsrm_virtual_cwd.h:26,
                 from /home/Administrator/src/php-5.2.1/main/php.h:409,
                 from /home/Administrator/src/php-5.2.1/main/php_reentrancy.h:24,
                 from /home/Administrator/src/php-5.2.1/ext/pdo_sqlite/sqlite/src/date.c:57:
/home/Administrator/src/php-5.2.1/TSRM/tsrm_config_common.h:4:16: operator '|' has no right operand
In file included from /home/Administrator/src/php-5.2.1/main/php.h:409,
                 from /home/Administrator/src/php-5.2.1/main/php_reentrancy.h:24,
                 from /home/Administrator/src/php-5.2.1/ext/pdo_sqlite/sqlite/src/date.c:57:
/home/Administrator/src/php-5.2.1/TSRM/tsrm_virtual_cwd.h:47:20: direct.h: No such file or directory
In file included from /home/Administrator/src/php-5.2.1/TSRM/tsrm_virtual_cwd.h:55,
                 from /home/Administrator/src/php-5.2.1/main/php.h:409,
                 from /home/Administrator/src/php-5.2.1/main/php_reentrancy.h:24,
                 from /home/Administrator/src/php-5.2.1/ext/pdo_sqlite/sqlite/src/date.c:57:
/home/Administrator/src/php-5.2.1/TSRM/readdir.h:10:1: warning: "_WIN32_WINNT" redefined
In file included from /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/windows.h:48,
                 from /home/Administrator/src/php-5.2.1/ext/pdo_sqlite/sqlite/src/os.h:55,
                 from /home/Administrator/src/php-5.2.1/ext/pdo_sqlite/sqlite/src/date.c:51:
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/windef.h:20:1: warning: this is the location of the previous definition
In file included from /home/Administrator/src/php-5.2.1/TSRM/tsrm_virtual_cwd.h:55,
                 from /home/Administrator/src/php-5.2.1/main/php.h:409,
                 from /home/Administrator/src/php-5.2.1/main/php_reentrancy.h:24,
                 from /home/Administrator/src/php-5.2.1/ext/pdo_sqlite/sqlite/src/date.c:57:
/home/Administrator/src/php-5.2.1/TSRM/readdir.h:26: error: `_MAX_FNAME' undeclared here (not in a function)
In file included from /home/Administrator/src/php-5.2.1/main/php.h:409,
                 from /home/Administrator/src/php-5.2.1/main/php_reentrancy.h:24,
                 from /home/Administrator/src/php-5.2.1/ext/pdo_sqlite/sqlite/src/date.c:57:
/home/Administrator/src/php-5.2.1/TSRM/tsrm_virtual_cwd.h:58: error: conflicting types for 'mode_t'
/usr/include/cygwin/types.h:205: error: previous declaration of 'mode_t' was here
In file included from /usr/include/dirent.h:6,
                 from /home/Administrator/src/php-5.2.1/main/php_reentrancy.h:28,
                 from /home/Administrator/src/php-5.2.1/ext/pdo_sqlite/sqlite/src/date.c:57:
/usr/include/sys/dirent.h:21: error: redefinition of `struct dirent'
/usr/include/sys/dirent.h:55: error: conflicting types for 'DIR'
/home/Administrator/src/php-5.2.1/TSRM/readdir.h:38: error: previous declaration of 'DIR' was here
/usr/include/sys/dirent.h:58: error: conflicting types for 'opendir'
/home/Administrator/src/php-5.2.1/TSRM/readdir.h:41: error: previous declaration of 'opendir' was here
/usr/include/sys/dirent.h:58: error: conflicting types for 'opendir'
/home/Administrator/src/php-5.2.1/TSRM/readdir.h:41: error: previous declaration of 'opendir' was here
/usr/include/sys/dirent.h:59: error: conflicting types for 'readdir'
/home/Administrator/src/php-5.2.1/TSRM/readdir.h:42: error: previous declaration of 'readdir' was here
/usr/include/sys/dirent.h:59: error: conflicting types for 'readdir'
/home/Administrator/src/php-5.2.1/TSRM/readdir.h:42: error: previous declaration of 'readdir' was here
/usr/include/sys/dirent.h:60: error: conflicting types for 'readdir_r'
/home/Administrator/src/php-5.2.1/TSRM/readdir.h:43: error: previous declaration of 'readdir_r' was here
/usr/include/sys/dirent.h:60: error: conflicting types for 'readdir_r'
/home/Administrator/src/php-5.2.1/TSRM/readdir.h:43: error: previous declaration of 'readdir_r' was here
/usr/include/sys/dirent.h:61: error: conflicting types for 'rewinddir'
/home/Administrator/src/php-5.2.1/TSRM/readdir.h:45: error: previous declaration of 'rewinddir' was here
/usr/include/sys/dirent.h:61: error: conflicting types for 'rewinddir'
/home/Administrator/src/php-5.2.1/TSRM/readdir.h:45: error: previous declaration of 'rewinddir' was here
/usr/include/sys/dirent.h:62: error: conflicting types for 'closedir'
/home/Administrator/src/php-5.2.1/TSRM/readdir.h:44: error: previous declaration of 'closedir' was here
/usr/include/sys/dirent.h:62: error: conflicting types for 'closedir'
/home/Administrator/src/php-5.2.1/TSRM/readdir.h:44: error: previous declaration of 'closedir' was here
make: *** [ext/pdo_sqlite/sqlite/src/date.lo] Error 1


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-02-15 00:02 UTC] phil dot lello at homecall dot co dot uk
The attached patches appear to resolve this issue, however I don't have CVS access so will leave this as open.

--- TSRM.h	2007-01-01 09:35:45.000000000 +0000
+++ TSRM.h.new	2007-02-14 23:52:36.762615800 +0000
@@ -13,16 +13,15 @@
 #ifndef TSRM_H
 #define TSRM_H
 
-/* #ifndef WIN32 */
-#ifndef WIN32
+#ifndef __CYGWIN__
+# ifdef WIN32
+#  define TSRM_WIN32
+#  include "tsrm_config.w32.h"
+# endif
+#else
 # include <tsrm_config.h>
 #endif
 
-#ifdef WIN32
-# define TSRM_WIN32
-# include "tsrm_config.w32.h"
-#endif
-
 #ifdef TSRM_WIN32
 #	ifdef TSRM_EXPORTS
 #	define TSRM_API __declspec(dllexport)
--- tsrm_config_common.h	2005-12-20 14:24:14.000000000 +0000
+++ tsrm_config_common.h.new	2007-02-14 23:52:36.782644600 +0000
@@ -1,8 +1,10 @@
 #ifndef TSRM_CONFIG_COMMON_H
 #define TSRM_CONFIG_COMMON_H
 
-#if WINNT|WIN32
-# define TSRM_WIN32
+#ifndef __CYGWIN__
+# if WINNT|WIN32
+#  define TSRM_WIN32
+# endif
 #endif
 
 #ifdef TSRM_WIN32
 [2007-02-15 09:52 UTC] tony2001@php.net
Is this the only patch required to compile PHP on Cygwin?
(I suspect there might be many more, since we never actually supported Cygwin)
 [2007-02-15 12:21 UTC] tony2001@php.net
Btw, the first part of the patch is incorrect.

#ifndef __CYGWIN__ /* !cygwin has a very broad meaning, but this part is for win32 only */
# ifdef WIN32
#  define TSRM_WIN32
#  include "tsrm_config.w32.h"
# endif
#else
# include <tsrm_config.h>
#endif

The correct ifdef would be:

#if !defined(__CYGWIN__) && defined(WIN32)
# define TSRM_WIN32
# include "tsrm_config.w32.h"
#else
# include <tsrm_config.h>
#endif


 [2007-02-15 19:00 UTC] phil dot lello at homecall dot co dot uk
Thanks for the correction to my patch.

Using the default configuration (e.g. ./configure with no options), and this patch, php builds fine, and the functionality I've needed all seems to work correctly too, although I'm only using php-cli at the moment.

Running make test shows that most tests pass, and I submitted the failures to QA. A quick scan of those indicates they are down to limitations in cygwin's POSIX emulation, and not actually php bugs.

FYI, the failures were:

Bug #39602 (Invalid session.save_handler crashes PHP) [Zend/tests/bug39602.phpt]
strftime() and gmstrftime() tests [ext/date/tests/009.phpt]
Bug #27780 (strtotime(+1 xxx) returns a wrong date/time) [ext/date/tests/bug27780.phpt]
Bug #32555 (strtotime("tomorrow") can return false) [ext/date/tests/bug32555.phpt]
Bug #33532 (Different output for strftime() and date()) [ext/date/tests/bug33532.phpt]
date_default_timezone_get() function [1] [ext/date/tests/date_default_timezone_get-1.phpt]
date_default_timezone_get() function [2] [ext/date/tests/date_default_timezone_get-2.phpt]
date_default_timezone_set() function [1] [ext/date/tests/date_default_timezone_set-1.phpt]
SPL: SplObjectStorage serialization [ext/spl/tests/observer_003.phpt]
SPL: SplObjectStorage serialization & overloading [ext/spl/tests/observer_004.phpt]
SPL: SplObjectStorage serialization & visibility [ext/spl/tests/observer_005.phpt]
disk_total_space() and disk_free_space() tests [ext/standard/tests/file/disk.phpt]
stream_socket_client() and invalid arguments [ext/standard/tests/file/stream_002.phpt]
symlink() & friends [ext/standard/tests/file/symlink.phpt]
Bug #25665 (var_dump () hangs on Nan and INF) [ext/standard/tests/math/bug25665.phpt]
inet_ntop() & inet_pton() tests [ext/standard/tests/network/inet.phpt]
Streams Based Unix Domain Loopback test [ext/standard/tests/network/unixloop.phpt]
 [2007-02-15 19:14 UTC] tony2001@php.net
Patch committed, thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 20:01:28 2024 UTC