Hi,
I've just tried to build the current SVN HEAD of Cherokee on MinGW, and
when tracing is enabled (as per the README), the following error is produced
during the make stage:
gcc -o cherokee_show.exe cherokee_show.o ./.libs/libcherokee-config.a
/e/cherokee/svn/cherokee/cherokee/.libs/libcherokee-server.a
/e/cherokee/svn/cherokee/cherokee/.libs/libcherokee-client.a
./.libs/libcherokee-base.a ./.libs/libcherokee-client.a
/e/cherokee/svn/cherokee/cherokee/.libs/libcherokee-base.a -lpthread -lpcre
-lwsock32 -lws2_32
./.libs/libcherokee-base.a(util.o):util.c:(.text+0xd2b): undefined reference
to `flockfile'
./.libs/libcherokee-base.a(util.o):util.c:(.text+0xd5a): undefined reference
to `funlockfile'
collect2: ld returned 1 exit status
make[2]: *** [cherokee_show.exe] Error 1
make[2]: Leaving directory `/e/cherokee/svn/cherokee/cherokee'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/e/cherokee/svn/cherokee'
make: *** [all] Error 2
This is caused by the following block in cherokee/util.c (offending lines are
marked with a * symbol):
913 if (use_syslog) {
914 syslog (LOG_DEBUG, "%s", output.buf);
915 } else {
916* flockfile (stdout);
917 fprintf (stdout, "%s", output.buf);
918* funlockfile (stdout);
919 }
It looks like this change was introduced in SVN rev 292, and completely
prevents compilation on MinGW.
Here's my patch:
----8<---- begin patch
Index: cherokee/util.c
===================================================================
--- cherokee/util.c (revision 323)
+++ cherokee/util.c (working copy)
@@ -913,9 +913,13 @@
if (use_syslog) {
syslog (LOG_DEBUG, "%s", output.buf);
} else {
+#ifdef HAVE_FLOCKFILE
flockfile (stdout);
+#endif
fprintf (stdout, "%s", output.buf);
+#ifdef HAVE_FUNLOCKFILE
funlockfile (stdout);
+#endif
}
out:
Index: configure.in
===================================================================
--- configure.in (revision 323)
+++ configure.in (working copy)
@@ -219,7 +219,7 @@
AC_FUNC_MEMCMP
AC_FUNC_MMAP
-AC_CHECK_FUNCS(gmtime gmtime_r localtime localtime_r getrlimit getdtablesize
readdir_r)
+AC_CHECK_FUNCS(gmtime gmtime_r localtime localtime_r getrlimit getdtablesize
readdir_r flockfile funlockfile)
AH_BOTTOM([
----8<---- end patch
This makes the configure script check for flockfile and funlockfile. If
they're not available (e.g. on MinGW), they're not used.
Theoretically you could lock the file using Windows API functions, but in my
opinion that's a really dirty way to do things, not to mention the fact that
IIRC you can't pull a Windows file handle out of a FILE * struct. To get
around that you'd have to have a separate "windows only" version of the Trace
functionality -- in that instance, the cure is worse than the disease...
In other news, I now have a cute little script that builds Cherokee from
source. I'm just working on making it log the process to disk, then I can add
a daily task to the Windows Task Scheduler to make the build run daily
(probably at around 9PM or so UK time).
I'm still waiting on SVN write access and the "FTP file dump for the Windows
binaries", alo (hint hint) :)
Thanks.
--
Phil. | Kitsune: Acorn RiscPC SA202 64M+6G ViewFinder
[EMAIL PROTECTED] | Cheetah: Athlon64 3200+ A8VDeluxeV2 512M+100G
http://www.philpem.me.uk/ | Tiger: Toshiba SatPro4600 Celeron700 256M+40G
_______________________________________________
Cherokee mailing list
[email protected]
http://www.0x50.org/cgi-bin/mailman/listinfo/cherokee