Opened 5 years ago
Closed 5 years ago
#58550 closed defect (fixed)
lighttpd @1.4.54 does not build on PPC Tiger, Mac OS X 10.4.11, because of timespec type problems
Reported by: | ballapete (Peter "Pete" Dyballa) | Owned by: | ryandesign (Ryan Carsten Schmidt) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.5.4 |
Keywords: | tiger | Cc: | |
Port: | lighttpd |
Description
/opt/local/bin/gcc-apple-4.2 -std=gnu99 -DHAVE_CONFIG_H -DHAVE_VERSIONSTAMP_H -DLIBRARY_DIR="\"/opt/local/lib\"" -DSBIN_DIR="\"/opt/local/sbin\"" -I. -I.. -I/opt/local/include -D_REENTRANT -I/opt/local/include -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES -pipe -Os -arch ppc -Wall -W -Wshadow -pedantic -MT log.o -MD -MP -MF $depbase.Tpo -c -o log.o log.c &&\ mv -f $depbase.Tpo $depbase.Po In file included from log.c:8: base.h:206: error: field 'request_start_hp' has incomplete type make[3]: *** [log.o] Error 1 make[3]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_www_lighttpd/lighttpd/work/lighttpd-1.4.54/src'
That line in base.h
reads inside a large struct:
196 struct connection { 197 connection_state_t state; 198 199 /* timestamps */ 200 time_t read_idle_ts; 201 time_t close_timeout_ts; 202 time_t write_request_ts; 203 204 time_t connection_start; 205 time_t request_start; 206 struct timespec request_start_hp; ««««===== 207 208 size_t request_count; /* number of requests handled in this connection */ 209 size_t loops_per_request; /* to catch endless loops in a single request 210 * 211 * used by mod_rewrite, mod_fastcgi, ... and others 212 * this is self-protection 213 */ 214 215 fdnode *fdn; /* fdevent (fdnode *) object */ 216 int fd; /* the FD for this connection */ 217 int ndx; /* reverse mapping to server->connection[ndx] */ 218 219 /* fd states */ 220 int is_readable; 221 int is_writable; 222 int is_ssl_sock; 223 224 int keep_alive; /* only request.c can enable it, all other just disable */ 225 int keep_alive_idle; /* remember max_keep_alive_idle from config */ 226 227 int file_started; 228 int file_finished; 229 230 chunkqueue *write_queue; /* a large queue for low-level write ( HTTP response ) [ file, mem ] */ 231 chunkqueue *read_queue; /* a small queue for low-level read ( HTTP request ) [ mem ] */ 232 chunkqueue *request_content_queue; /* takes request-content into tempfile if necessary [ tempfile, mem ]*/ 233 234 int traffic_limit_reached; 235 236 off_t bytes_written; /* used by mod_accesslog, mod_rrd */ 237 off_t bytes_written_cur_second; /* used by mod_accesslog, mod_rrd */ 238 off_t bytes_read; /* used by mod_accesslog, mod_rrd */ 239 off_t bytes_header; 240 241 int http_status; 242 243 sock_addr dst_addr; 244 buffer *dst_addr_buf; 245 246 /* request */ 247 request request; 248 request_uri uri; 249 physical physical; 250 response response; 251 252 size_t header_len; 253 254 array *environment; /* used to pass lighttpd internal stuff to the FastCGI/CGI apps, setenv does that */ 255 256 unsigned int mode; /* DIRECT (0) or plugin id */ 257 int async_callback; 258 259 log_error_st *errh; 260 261 void **plugin_ctx; /* plugin connection specific config */ 262 263 specific_config conf; /* global connection specific config */ 264 cond_cache_t *cond_cache; 265 266 buffer *server_name; 267 buffer *proto; 268 269 /* error-handler */ 270 int error_handler_saved_status; 271 http_method_t error_handler_saved_method; 272 273 struct server_socket *srv_socket; /* reference to the server-socket */ 274 int (* network_write)(struct server *srv, struct connection *con, chunkqueue *cq, off_t max_bytes); 275 int (* network_read)(struct server *srv, struct connection *con, chunkqueue *cq, off_t max_bytes); 276 277 /* etag handling */ 278 etag_flags_t etag_flags; 279 280 int8_t conditional_is_valid[16]; /* MUST be >= COMP_LAST_ELEMENT] */ 281 };
The included file log.h
, from line 9, has:
8 struct timespec; /* declaration */
Later log.c
includes, from line 13:
# 13 "log.c" 2 # 1 "/usr/include/time.h" 1 3 4 # 64 "/usr/include/time.h" 3 4 #define _TIME_H_ [...] # 67 "/usr/include/time.h" 2 3 4 # 88 "/usr/include/time.h" 3 4 #define _TIMESPEC struct timespec { time_t tv_sec; long tv_nsec; };
which re-declares timespec after first use. So it might work to include time.h
just before base.h
– and put a guard around line 8 of log.h?
Attachments (8)
Change History (19)
Changed 5 years ago by ballapete (Peter "Pete" Dyballa)
Changed 5 years ago by ballapete (Peter "Pete" Dyballa)
Attachment: | main.2.log added |
---|
Main.log from PPC Tiger with new error
Changed 5 years ago by ballapete (Peter "Pete" Dyballa)
Attachment: | patch-src_log.c_diff added |
---|
Patch to reorder sequence of C include files in src/log.c
comment:1 Changed 5 years ago by ballapete (Peter "Pete" Dyballa)
Legacy support needs to be augmented because I can find only these:
/opt/local/include/LegacySupport/dirent.h:/* fdopendir */ /opt/local/include/LegacySupport/dirent.h:extern DIR *fdopendir(int fd); /opt/local/include/LegacySupport/sys/fcntl.h:#ifndef AT_FDCWD /opt/local/include/LegacySupport/sys/fcntl.h:#define AT_FDCWD -2 /opt/local/include/LegacySupport/sys/fcntl.h:#ifndef AT_SYMLINK_NOFOLLOW /opt/local/include/LegacySupport/sys/fcntl.h:#define AT_SYMLINK_NOFOLLOW 0x0020 /* Act on the symlink itself not the target */ /opt/local/include/LegacySupport/sys/unistd.h:extern int unlinkat(int dirfd, const char *pathname, int flags);
fcopyfile
is missing.
The new error report was lost while uploading the files:
/bin/sh ../libtool --tag=CC --mode=compile /opt/local/bin/gcc-apple-4.2 -std=gnu99 -DHAVE_CONFIG_H -DHAVE_VERSIONSTAMP_H -DLIBRARY_DIR="\"/opt/local/lib\"" -DSBIN_DIR="\"/opt/local/sbin\"" -I. -I.. -I/opt/local/include -D_REENTRANT -I/opt/local/include -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES -pipe -Os -arch ppc -Wall -W -Wshadow -pedantic -MT mod_webdav_la-mod_webdav.lo -MD -MP -MF .deps/mod_webdav_la-mod_webdav.Tpo -c -o mod_webdav_la-mod_webdav.lo `test -f 'mod_webdav.c' || echo './'`mod_webdav.c libtool: compile: /opt/local/bin/gcc-apple-4.2 -std=gnu99 -DHAVE_CONFIG_H -DHAVE_VERSIONSTAMP_H -DLIBRARY_DIR=\"/opt/local/lib\" -DSBIN_DIR=\"/opt/local/sbin\" -I. -I.. -I/opt/local/include -D_REENTRANT -I/opt/local/include -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES -pipe -Os -arch ppc -Wall -W -Wshadow -pedantic -MT mod_webdav_la-mod_webdav.lo -MD -MP -MF .deps/mod_webdav_la-mod_webdav.Tpo -c mod_webdav.c -fno-common -DPIC -o .libs/mod_webdav_la-mod_webdav.o mod_webdav.c: In function 'webdav_fcopyfile_sz': mod_webdav.c:2049: warning: implicit declaration of function 'fcopyfile' mod_webdav.c: In function 'webdav_unlinkat': mod_webdav.c:2207: warning: implicit declaration of function 'unlinkat' mod_webdav.c: In function 'webdav_delete_dir': mod_webdav.c:2245: warning: implicit declaration of function 'fdopendir' mod_webdav.c:2245: warning: pointer/integer type mismatch in conditional expression mod_webdav.c:2271: warning: implicit declaration of function 'fstatat' mod_webdav.c:2271: error: 'AT_SYMLINK_NOFOLLOW' undeclared (first use in this function) mod_webdav.c:2271: error: (Each undeclared identifier is reported only once mod_webdav.c:2271: error: for each function it appears in.) mod_webdav.c: In function 'webdav_linktmp_rename': mod_webdav.c:2340: warning: implicit declaration of function 'linkat' mod_webdav.c:2340: error: 'AT_FDCWD' undeclared (first use in this function) mod_webdav.c: In function 'webdav_copymove_file': mod_webdav.c:2489: error: 'AT_FDCWD' undeclared (first use in this function) mod_webdav.c: In function 'webdav_copymove_dir': mod_webdav.c:2743: warning: pointer/integer type mismatch in conditional expression mod_webdav.c:2764: error: 'AT_SYMLINK_NOFOLLOW' undeclared (first use in this function) mod_webdav.c: In function 'webdav_propfind_dir': mod_webdav.c:3236: warning: pointer/integer type mismatch in conditional expression mod_webdav.c:3263: error: 'AT_SYMLINK_NOFOLLOW' undeclared (first use in this function) make[3]: *** [mod_webdav_la-mod_webdav.lo] Error 1 make[3]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_www_lighttpd/lighttpd/work/lighttpd-1.4.54/src' make[2]: *** [all] Error 2 make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_www_lighttpd/lighttpd/work/lighttpd-1.4.54/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_www_lighttpd/lighttpd/work/lighttpd-1.4.54' make: *** [all] Error 2 make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_www_lighttpd/lighttpd/work/lighttpd-1.4.54' Command failed: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_www_lighttpd/lighttpd/work/lighttpd-1.4.54" && /usr/bin/make -w all Exit code: 2
comment:2 Changed 5 years ago by mf2k (Frank Schima)
Cc: | ryandesign@… removed |
---|---|
Owner: | set to ryandesign |
Status: | new → assigned |
comment:3 Changed 5 years ago by kencu (Ken)
I think we've got some real challenges here getting this new version to work on Tiger. There has been a complete rewrite of mod_webdav.c
and it was written to 10.5+, which is pretty darn generous really of the authors considering everything. Your reordering of the headers in log.c
was very clever and seems to fix that issue. legacysupport
may fill in some of the missing stuff you noticed above, but there is no copyfile
implementation in Tiger we can use...
There is one in libuv
that is used as a fallback on Tiger -- that might turn out to be helpful.
Long story short -- we're going to need to peg the version for Tiger at the last version for the forseeable future, I think.
comment:4 Changed 5 years ago by ballapete (Peter "Pete" Dyballa)
On PPC Leopard, Mac OS X 10.5.8, a similar error occurs:
/bin/sh ../libtool --tag=CC --mode=compile /usr/bin/gcc-4.2 -std=gnu99 -DHAVE_CONFIG_H -DHAVE_VERSIONSTAMP_H -DLIBRARY_DIR="\"/opt/local/lib\"" -DSBIN_DIR="\"/opt/local/sbin\"" -I. -I.. -I/opt/local/include -D_REENTRANT -I/opt/local/include -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES -pipe -Os -arch ppc -Wall -W -Wshadow -pedantic -MT mod_webdav_la-mod_webdav.lo -MD -MP -MF .deps/mod_webdav_la-mod_webdav.Tpo -c -o mod_webdav_la-mod_webdav.lo `test -f 'mod_webdav.c' || echo './'`mod_webdav.c libtool: compile: /usr/bin/gcc-4.2 -std=gnu99 -DHAVE_CONFIG_H -DHAVE_VERSIONSTAMP_H -DLIBRARY_DIR=\"/opt/local/lib\" -DSBIN_DIR=\"/opt/local/sbin\" -I. -I.. -I/opt/local/include -D_REENTRANT -I/opt/local/include -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES -pipe -Os -arch ppc -Wall -W -Wshadow -pedantic -MT mod_webdav_la-mod_webdav.lo -MD -MP -MF .deps/mod_webdav_la-mod_webdav.Tpo -c mod_webdav.c -fno-common -DPIC -o .libs/mod_webdav_la-mod_webdav.o mod_webdav.c: In function ‘webdav_unlinkat’: mod_webdav.c:2207: warning: implicit declaration of function ‘unlinkat’ mod_webdav.c: In function ‘webdav_delete_dir’: mod_webdav.c:2245: warning: implicit declaration of function ‘fdopendir’ mod_webdav.c:2245: warning: pointer/integer type mismatch in conditional expression mod_webdav.c:2271: warning: implicit declaration of function ‘fstatat’ mod_webdav.c:2271: error: ‘AT_SYMLINK_NOFOLLOW’ undeclared (first use in this function) mod_webdav.c:2271: error: (Each undeclared identifier is reported only once mod_webdav.c:2271: error: for each function it appears in.) mod_webdav.c: In function ‘webdav_linktmp_rename’: mod_webdav.c:2340: warning: implicit declaration of function ‘linkat’ mod_webdav.c:2340: error: ‘AT_FDCWD’ undeclared (first use in this function) mod_webdav.c: In function ‘webdav_copymove_file’: mod_webdav.c:2489: error: ‘AT_FDCWD’ undeclared (first use in this function) mod_webdav.c: In function ‘webdav_copymove_dir’: mod_webdav.c:2743: warning: pointer/integer type mismatch in conditional expression mod_webdav.c:2764: error: ‘AT_SYMLINK_NOFOLLOW’ undeclared (first use in this function) mod_webdav.c: In function ‘webdav_propfind_dir’: mod_webdav.c:3236: warning: pointer/integer type mismatch in conditional expression mod_webdav.c:3263: error: ‘AT_SYMLINK_NOFOLLOW’ undeclared (first use in this function) make[3]: *** [mod_webdav_la-mod_webdav.lo] Error 1 make[3]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_www_lighttpd/lighttpd/work/lighttpd-1.4.54/src' make[2]: *** [all] Error 2 make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_www_lighttpd/lighttpd/work/lighttpd-1.4.54/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_www_lighttpd/lighttpd/work/lighttpd-1.4.54' make: *** [all] Error 2 make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_www_lighttpd/lighttpd/work/lighttpd-1.4.54' Command failed: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_www_lighttpd/lighttpd/work/lighttpd-1.4.54" && /usr/bin/make -w all Exit code: 2
I did not change anything in the sequence how C header files are included.
Changed 5 years ago by ballapete (Peter "Pete" Dyballa)
Attachment: | main.3.log added |
---|
Main.log from PPC Leopard
comment:5 follow-up: 6 Changed 5 years ago by gstrauss (Glenn Strauss)
The lighttpd maintainers (myself included) are unable to make small portability changes if nobody reports issues to us.
Please report lighttpd issues on the lighttpd forums (https://redmine.lighttpd.net/projects/lighttpd/boards) or #lighttpd on freenode.
The following should handle the missing timespec definition. It's not required in OS X 10.14 Mojave.
diff --git a/src/base.h b/src/base.h index f21973bf..5d58514d 100644 --- a/src/base.h +++ b/src/base.h @@ -6,6 +6,9 @@ #include <sys/types.h> #include <sys/time.h> +#if defined(__APPLE__) && defined(__MACH__) +#include <time.h> +#endif #include "base_decls.h" #include "buffer.h"
For Mac OS X earlier than 10.5, you'll have to patch lighttpd mod_webdav not to use fcopyfile(), which is easy to do (patch below). lighttpd mod_webdav will handle file copying internally if fcopyfile() is not available.
diff --git a/src/mod_webdav.c b/src/mod_webdav.c index 16f74170..5488db06 100644 --- a/src/mod_webdav.c +++ b/src/mod_webdav.c @@ -2011,7 +2011,7 @@ webdav_prop_select_propnames (const plugin_config * const pconf, } -#if defined(__APPLE__) && defined(__MACH__) +#if defined(__APPLE__) && defined(__MACH__) && 0 #include <copyfile.h> /* fcopyfile() *//* OS X 10.5+ */ #endif #ifdef HAVE_ELFTC_COPYFILE/* __FreeBSD__ */ @@ -2044,7 +2044,7 @@ webdav_fcopyfile_sz (int ifd, int ofd, off_t isz) /*fcntl(ofd, F_SETFL, fcntl(ofd, F_GETFL, 0) & ~O_NONBLOCK);*/ #endif - #if defined(__APPLE__) && defined(__MACH__) + #if defined(__APPLE__) && defined(__MACH__) && 0 if (0 == fcopyfile(ifd, ofd, NULL, COPYFILE_ALL)) return 0;
As for other missing functions, the POSIX 2008 (yes 2008, over 10 years ago) spec defines linkat() fstatat() unlinkat() fdopendir() and associated defines. Most operating systems supported these functions many, many years before they became part of the POSIX 2008 standard. OS X 10.5 Leopard was released Oct 26, 2007. OS X 10.6 Snow Leopard was released Aug 28, 2009, so perhaps lighttpd mod_webdav will now work only with OS X 10.6 Snow Leopard or later. These functions were created to avoid race conditions in filesystem manipulation. It would take some work to provide crippled replacements for these functions for lighttpd mod_webdav. An alternative for OS X 10.5 Leopard and earlier might be to simply remove mod_webdav from the build for OS X before OS X 10.6.
--- a/src/Makefile.am +++ b/src/Makefile.am @@ -147,11 +147,11 @@ mod_evasive_la_SOURCES = mod_evasive.c mod_evasive_la_LDFLAGS = $(common_module_ldflags) mod_evasive_la_LIBADD = $(common_libadd) -lib_LTLIBRARIES += mod_webdav.la -mod_webdav_la_SOURCES = mod_webdav.c -mod_webdav_la_CFLAGS = $(AM_CFLAGS) $(XML_CFLAGS) $(SQLITE_CFLAGS) -mod_webdav_la_LDFLAGS = $(common_module_ldflags) -mod_webdav_la_LIBADD = $(common_libadd) $(XML_LIBS) $(SQLITE_LIBS) $(UUID_LIBS) $(ELFTC_LIB) +#lib_LTLIBRARIES += mod_webdav.la +#mod_webdav_la_SOURCES = mod_webdav.c +#mod_webdav_la_CFLAGS = $(AM_CFLAGS) $(XML_CFLAGS) $(SQLITE_CFLAGS) +#mod_webdav_la_LDFLAGS = $(common_module_ldflags) +#mod_webdav_la_LIBADD = $(common_libadd) $(XML_LIBS) $(SQLITE_LIBS) $(UUID_LIBS) $(ELFTC_LIB) if BUILD_WITH_LUA lib_LTLIBRARIES += mod_magnet.la
As an aside, please note that there is a bug in the new lighttpd mod_webdav, which will also be fixed in the upcoming lighttpd 1.4.55. A patch is posted in https://redmine.lighttpd.net/issues/2958
comment:6 follow-up: 7 Changed 5 years ago by ballapete (Peter "Pete" Dyballa)
Replying to gstrauss:
Your patches work very fine! I'll upload them afterwards. The build has just finished successfully (without mod_webdav). Configure
is still reporting that this modules has been enabled. I'll see whether I can fix this…
Changed 5 years ago by ballapete (Peter "Pete" Dyballa)
Attachment: | src_base.h-Tiger.diff added |
---|
Patch to include time.h to have struct timespec declared
Changed 5 years ago by ballapete (Peter "Pete" Dyballa)
Attachment: | src_mod_webdav.c-Tiger.diff added |
---|
removes some POSIX 2008 particles (fcopyfile(), linkat(), fstatat(), unlinkat(), fdopendir()) from non-Posix 2008 Tiger and Leopard
Changed 5 years ago by ballapete (Peter "Pete" Dyballa)
Attachment: | src_Makefile.am-Tiger.diff added |
---|
removes build of mod_webdav.o from Makefile for non-POSIX 2008 Tiger and Leopard
comment:7 follow-up: 8 Changed 5 years ago by ballapete (Peter "Pete" Dyballa)
Replying to ballapete:
Replying to gstrauss:
Configure
is still reporting that this modules has been enabled. I'll see whether I can fix this…
This effort might take some time – port
has entered a mood in which it wants to download lighttpd-1.4.54_0+ssl.darwin_8.ppc.tbz2
instead of building from source…
comment:8 Changed 5 years ago by ballapete (Peter "Pete" Dyballa)
Replying to ballapete:
This mood was introduced by me: a '#' to comment a patch file. Because src_mod_webdav.c-Tiger.diff
is not necessary. Another patch file is necessary which changes configure
and will be attached soon after. With this configure-Tiger.diff
patch applied lighttpd
built. And nowhere in the output the string 'webdav' appears ./configure --help
does not mention 'webdav' in any way.
Changed 5 years ago by ballapete (Peter "Pete" Dyballa)
Attachment: | configure-Tiger.diff added |
---|
Patch to remove webdav from configure script
comment:9 Changed 5 years ago by ballapete (Peter "Pete" Dyballa)
With the patch files configure-Tiger.diff
and src_Makefile.am-Tiger.diff
lighttpd built on PPC Leopard, Mac OS X 10.5.8.
comment:10 Changed 5 years ago by kencu (Ken)
This seems to work, using the suggestions from the developer above <https://github.com/macports/macports-ports/pull/4760>
comment:11 Changed 5 years ago by ken-cunningham-webuse
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Main.log from PPC Tiger