compiling cfengine under cygwin

"Rob Brown" <[email protected]>
Newsgroups gmane.comp.sysutils.cfengine.bugs
Message-ID <000901c8ec28$de84c7f0$fc3af13f@RobBrown>
I was having problems compiling latest cfengine (2.2.7) on Windows under the
latest build of cygwin (1.5.25).
With the help of a skilled colleague (thanks, Jared) we were able to get it
to compile after making the changes below.
 
ERROR #1:
gcc -DHAVE_CONFIG_H -I. -I/usr/include/db4 -I/usr/include   -g -O2
-Wreturn-type -Wmissing-prototypes -Wuninitialized  -g -O2
-I/usr/include/db4 -g -O2 -I/usr/include/db4 -MT do.o -MD -MP -MF
.deps/do.Tpo -c -o do.o do.c
do.c: In function `CheckTimeZone':
do.c:2732: error: called object is not a function
 
SOLUTION:
change line 2732 in do.c
from:
   strcpy(tz,timezone());
to:
   strcpy(tz,_timezone);
 
-----
 
ERROR #2:
gcc -DHAVE_CONFIG_H -I. -I/usr/include/db4 -I/usr/include   -g -O2
-Wreturn-type -Wmissing-prototypes -Wuninitialized  -g -O2
-I/usr/include/db4 -g -O2 -I/usr/include/db4 -MT cfexecd.o -MD -MP -MF
.deps/cfexecd.Tpo -c -o cfexecd.o cfexecd.c
cfexecd.c: In function `StartServer':
cfexecd.c:232: warning: initialization makes pointer from integer without a
cast
cfexecd.c:320: error: `_P_NOWAIT' undeclared (first use in this function)
cfexecd.c:320: error: (Each undeclared identifier is reported only once
cfexecd.c:320: error: for each function it appears in.)
 
SOLUTION:
added the following lines to the end of cf.defs.h (we weren't sure where
these belonged)
#ifndef _P_WAIT
# define _P_WAIT 0
# define _P_NOWAIT 1
# define _P_OVERLAY 2
# define _P_NOWAITO 3
# define _P_DETACH 4
# define WAIT_CHILD 0
# define WAIT_GRANDCHILD 1
#endif
 
After making these 2 changes, make completes compile without any errors.
Since I'm new to the list I'm not sure the proper procedure/format for
submitting patches, but I have attached them to this message. Perhaps
someone in the know can put them in the proper spot.
Thanks,
 
Rob Brown

_______________________________________________
Bug-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/bug-cfengine
do.c.patch (application/octet-stream, 235 B)
--- src/do.c	2008-07-22 10:51:52.875508400 -0700
+++ src/do.c_patched	2008-07-22 10:48:05.174175400 -0700
@@ -2729,7 +2729,7 @@
 #ifdef NT
    
    tzset();
-   strcpy(tz,timezone());
+   strcpy(tz,_timezone);
    
 #else
 #ifndef AOS
cf.defs.h.patch (application/octet-stream, 623 B)
--- src/cf.defs.h	2008-07-22 10:36:01.557275600 -0700
+++ src/cf.defs.h_patched	2008-07-22 11:11:32.161068200 -0700
@@ -2280,6 +2280,16 @@
 #  define FILE_SEPARATOR_STR "/"
 #endif
 
+#ifndef _P_WAIT
+#  define _P_WAIT       0
+#  define _P_NOWAIT     1
+#  define _P_OVERLAY    2
+#  define _P_NOWAITO    3
+#  define _P_DETACH     4
+#  define WAIT_CHILD    0
+#  define WAIT_GRANDCHILD       1
+#endif
+
 /********************************************************************/
 /* All prototypes                                                   */
 /********************************************************************/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.