Project

General

Profile

[Solved] Compile on AIX conflicting types for 'etag_create'

Added by rturner over 1 year ago

/bin/sh ../libtool --tag=CC --mode=compile gcc -std=gnu99 -DHAVE_CONFIG_H -DHAVE_VERSIONSTAMP_H -DLIBRARY_DIR="\"/usr/local/lib\"" -DSBIN_DIR="\"/usr/local/sbin\"" -I. -I.. -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES -g -O2 -Wall -W -Wshadow -pedantic -MT liblightcomp_la-etag.lo -MD -MP -MF .deps/liblightcomp_la-etag.Tpo -c -o liblightcomp_la-etag.lo `test -f 'etag.c' || echo './'`etag.c
libtool: compile: gcc -std=gnu99 -DHAVE_CONFIG_H -DHAVE_VERSIONSTAMP_H -DLIBRARY_DIR=\"/usr/local/lib\" -DSBIN_DIR=\"/usr/local/sbin\" -I. -I.. -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES -g -O2 -Wall -W -Wshadow -pedantic -MT liblightcomp_la-etag.lo -MD -MP -MF .deps/liblightcomp_la-etag.Tpo -c etag.c -fPIC -DPIC -o .libs/liblightcomp_la-etag.o
etag.c:146:5: error: conflicting types for 'etag_create'
etag.h:12:5: note: previous declaration of 'etag_create' was here
make3: * [liblightcomp_la-etag.lo] Error 1
make3: Leaving directory `/home/buildbot/buildbot-slaves/externals/aixcompile/build/lighttpd-1.4.55/src'
make2:
[all] Error 2
make2: Leaving directory `/home/buildbot/buildbot-slaves/externals/aixcompile/build/lighttpd-1.4.55/src'
make1:
[all-recursive] Error 1
make1: Leaving directory `/home/buildbot/buildbot-slaves/externals/aixcompile/build/lighttpd-1.4.55'
make: *
[all] Error 2

build/lighttpd-1.4.55 $ ./configure --without-pcre --without-bzip2 --without-zlib --disable-ipv6

build/lighttpd-1.4.55 $ which gcc
/opt/freeware/bin/gcc

build/lighttpd-1.4.55 $ gcc --version
gcc (GCC) 4.6.1
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

build/lighttpd-1.4.55 $ uname -a
AIX aixcompile 3 5 00F7583B4C00 AIX

build/lighttpd-1.4.55 $ oslevel -s
5300-00-00-0000

I am able to compile lighttpd-1.4.45 on this same host, but fails to compile lighttpd-1.4.55. Any help is greatly appreciated.


Replies (18)

RE: Compile on AIX conflicting types for 'etag_create' - Added by gstrauss over 1 year ago

Not enough information. Go look for the previous place in your compile log which contains etag.c.

RE: Compile on AIX conflicting types for 'etag_create' - Added by gstrauss over 1 year ago

Actually:

etag.c:146:5: error: conflicting types for 'etag_create'
etag.h:12:5: note: previous declaration of 'etag_create' was here

Please verify that the prototype in etag.h matches the definition in etag.c. Did you modify etag.c? Did you modify etag.h? Do you have a stray etag.h somewhere that is being found instead of the lighttpd 1.4.55 source code?

Please manually attempt a clean build on AIX. My guess is that something corrupted your buildbot build environment and the environment needs to be reset.

RE: Compile on AIX conflicting types for 'etag_create' - Added by rturner over 1 year ago

Please verify that the prototype in etag.h matches the definition in etag.c.

  1. grep etag_create src/etag.h src/etag.c
    src/etag.h:int etag_create(buffer *etag, const struct stat *st, etag_flags_t flags);
    src/etag.c:int etag_create(buffer *etag, const struct stat *st, etag_flags_t flags) {

Did you modify etag.c? Did you modify etag.h?

no.

  1. md5sum src/etag.h src/etag.c
    52ccaedd64ed45abf82af37710875b44 src/etag.h
    7041c887c44ffde9fe65b98ef2e004c3 src/etag.c

Do you have a stray etag.h somewhere that is being found instead of the lighttpd 1.4.55 source code?

no.

  1. find / -name etag.h 2>/dev/null
    /home/buildbot/buildbot-slaves/externals/aixcompile/build/lighttpd-1.4.55/src/etag.h

Please manually attempt a clean build on AIX. My guess is that something corrupted your buildbot build environment and the environment needs to be reset.

the compile is not being done by buildbot (yet). all commands are being run by myself manually. i just ran the following commands and the same error was produced:

  1. make distclean
  2. ./configure --without-pcre --without-bzip2 --without-zlib --disable-ipv6
  3. make

RE: Compile on AIX conflicting types for 'etag_create' - Added by gstrauss over 1 year ago

AIX might be being obtuse. (I don't have access to an AIX machine, but I have in the past, and the kindest I can be is to say that AIX is obtuse.)

In etag.h, lighttpd issues the declaration:
struct stat; /* declaration */
Try replacing that line with:
#include <sys/stat.h>

RE: Compile on AIX conflicting types for 'etag_create' - Added by rturner over 1 year ago

your suggestion was helpful and is included in the following patch i am applying to successfully compile 1.4.55 on aix.

AT_SYMLINK_NOFOLLOW and AT_FDCWD are not defined on aix.
EEXIST and ENOTEMPTY are duplicates on aix.

--- lighttpd-1.4.55.orig/src/st_fcntl.h    1969-12-31 16:00:00.000000000 -0800
+++ lighttpd-1.4.55/src/st_fcntl.h    2020-07-16 09:14:47.000000000 -0700
@@ -0,0 +1,2 @@
+# define AT_SYMLINK_NOFOLLOW    0x100
+# define AT_FDCWD        -100
--- lighttpd-1.4.55.orig/src/mod_webdav.c    2020-01-31 18:49:09.000000000 -0800
+++ lighttpd-1.4.55/src/mod_webdav.c    2020-07-16 10:40:06.000000000 -0700
@@ -168,6 +168,7 @@
 #include <dirent.h>
 #include <errno.h>
 #include <fcntl.h>
+#include "st_fcntl.h" 
 #include <stdio.h>      /* rename() */
 #include <stdlib.h>     /* strtol() */
 #include <string.h>
@@ -2655,7 +2656,6 @@
         else {
             switch (errno) {
               case EEXIST:
-              case ENOTEMPTY:
                 if (!overwrite) {
                         webdav_xml_response_status(b, src->rel_path, 412);
                         return 412; /* Precondition Failed */
--- lighttpd-1.4.55.orig/src/etag.h    2020-01-31 18:49:09.000000000 -0800
+++ lighttpd-1.4.55/src/etag.h    2020-07-15 15:03:48.000000000 -0700
@@ -4,7 +4,7 @@

 #include "buffer.h" 

-struct stat;            /* declaration */
+#include <sys/stat.h>

 typedef enum { ETAG_USE_INODE = 1, ETAG_USE_MTIME = 2, ETAG_USE_SIZE = 4 } etag_flags_t;

RE: Compile on AIX conflicting types for 'etag_create' - Added by rturner over 1 year ago

sorry about the last post. here is the patch more readable

--- lighttpd-1.4.55.orig/src/st_fcntl.h    1969-12-31 16:00:00.000000000 -0800
+++ lighttpd-1.4.55/src/st_fcntl.h    2020-07-16 09:14:47.000000000 -0700
@@ -0,0 +1,2 @@
+# define AT_SYMLINK_NOFOLLOW    0x100
+# define AT_FDCWD        -100
--- lighttpd-1.4.55.orig/src/mod_webdav.c    2020-01-31 18:49:09.000000000 -0800
+++ lighttpd-1.4.55/src/mod_webdav.c    2020-07-16 10:40:06.000000000 -0700
@@ -168,6 +168,7 @@
 #include <dirent.h>
 #include <errno.h>
 #include <fcntl.h>
+#include "st_fcntl.h" 
 #include <stdio.h>      /* rename() */
 #include <stdlib.h>     /* strtol() */
 #include <string.h>
@@ -2655,7 +2656,6 @@
         else {
             switch (errno) {
               case EEXIST:
-              case ENOTEMPTY:
                 if (!overwrite) {
                         webdav_xml_response_status(b, src->rel_path, 412);
                         return 412; /* Precondition Failed */
--- lighttpd-1.4.55.orig/src/etag.h    2020-01-31 18:49:09.000000000 -0800
+++ lighttpd-1.4.55/src/etag.h    2020-07-15 15:03:48.000000000 -0700
@@ -4,7 +4,7 @@

 #include "buffer.h" 

-struct stat;            /* declaration */
+#include <sys/stat.h>

 typedef enum { ETAG_USE_INODE = 1, ETAG_USE_MTIME = 2, ETAG_USE_SIZE = 4 } etag_flags_t;

RE: Compile on AIX conflicting types for 'etag_create' - Added by gstrauss over 1 year ago

I wrapped your post in 'pre' tags.

What is +#include "st_fcntl.h" ?

RE: Compile on AIX conflicting types for 'etag_create' - Added by rturner over 1 year ago

fcntl.h on aix does not define AT_SYMLINK_NOFOLLOW or AT_FDCWD. so i defined both of those in new file st_fcntl.h using same definition that i had for linux.

RE: Compile on AIX conflicting types for 'etag_create' - Added by gstrauss over 1 year ago

AIX does have AT_FDCWD and AT_SYMLINK_NOFOLLOW, as those are part of the POSIX.1-2008 specification.

mod_webdav.c defines #define _XOPEN_SOURCE 700, though that definition might need to be moved earlier in the file, even before #include "first.h", on AIX. I can't accept a patch which hard-codes those values. Also, anything specific to AIX will need to be wrapped in appropriate #ifdef _AIX. Here is most of a patch, but I'll need some guidance from you (for proper feature define) for how to get the AT_FDCWD and AT_SYMLINK_NOFOLLOW defines from the AIX headers. I would prefer to avoid having to use the big-stick #define _ALL_SOURCE at the top of mod_webdav.c for AIX.

diff --git a/src/etag.h b/src/etag.h
index 7c1dd350..82a7de90 100644
--- a/src/etag.h
+++ b/src/etag.h
@@ -4,7 +4,11 @@

 #include "buffer.h" 

+#ifdef _AIX
+#include <sys/stat.h>
+#else
 struct stat;            /* declaration */
+#endif

 typedef enum { ETAG_USE_INODE = 1, ETAG_USE_MTIME = 2, ETAG_USE_SIZE = 4 } etag_flags_t;

diff --git a/src/mod_webdav.c b/src/mod_webdav.c
index c00f468d..a38082c0 100644
--- a/src/mod_webdav.c
+++ b/src/mod_webdav.c
@@ -2714,7 +2714,9 @@ webdav_copymove_dir (const plugin_config * const pconf,
         else {
             switch (errno) {
               case EEXIST:
+             #if EEXIST != ENOTEMPTY
               case ENOTEMPTY:
+             #endif
                 if (!overwrite) {
                         webdav_xml_response_status(b, &src->rel_path, 412);
                         return 412; /* Precondition Failed */

RE: Compile on AIX conflicting types for 'etag_create' - Added by gstrauss over 1 year ago

fcntl.h on aix does not define AT_SYMLINK_NOFOLLOW or AT_FDCWD. so i defined both of those in new file st_fcntl.h using same definition that i had for linux.

That second part:

so i defined both of those in new file st_fcntl.h using same definition that i had for linux.

That is terrible idea (and is very likely wrong).

RE: Compile on AIX conflicting types for 'etag_create' - Added by rturner over 1 year ago

completely understandable and not my intention to have you use the patch i posted. i was simply following up with my findings, with the expectation that you would have better solution (which your patch most definitely is).

im not satisfied with my workaround for AT_FDCWD and AT_SYMLINK_NOFOLLOW either. so i do appreciate the feedback. i will investigate it further.

thanks for your help

RE: Compile on AIX conflicting types for 'etag_create' - Added by rturner over 1 year ago

i have not been able to find a solution to the missing definitions of AT_FDCWD and AT_SYMLINK_NOFOLLOW on aix. i would be happy to try anything you suggest.

here is the compile time error:

mod_webdav.c: In function 'webdav_unlinkat':
mod_webdav.c:2206:5: warning: implicit declaration of function 'unlinkat' [-Wimplicit-function-declaration]
mod_webdav.c: In function 'webdav_delete_dir':
mod_webdav.c:2244:5: warning: implicit declaration of function 'fdopendir' [-Wimplicit-function-declaration]
mod_webdav.c:2244:51: warning: pointer/integer type mismatch in conditional expression [enabled by default]
mod_webdav.c:2270:13: warning: implicit declaration of function 'fstatat' [-Wimplicit-function-declaration]
mod_webdav.c:2270:52: error: 'AT_SYMLINK_NOFOLLOW' undeclared (first use in this function)
mod_webdav.c:2270:52: note: each undeclared identifier is reported only once for each function it appears in
mod_webdav.c: In function 'webdav_linktmp_rename':
mod_webdav.c:2339:9: warning: implicit declaration of function 'linkat' [-Wimplicit-function-declaration]
mod_webdav.c:2339:24: error: 'AT_FDCWD' undeclared (first use in this function)
mod_webdav.c: In function 'webdav_copymove_file':
mod_webdav.c:2488:25: error: 'AT_FDCWD' undeclared (first use in this function)
mod_webdav.c: In function 'webdav_copymove_dir':
mod_webdav.c:2744:54: warning: pointer/integer type mismatch in conditional expression [enabled by default]
mod_webdav.c:2765:52: error: 'AT_SYMLINK_NOFOLLOW' undeclared (first use in this function)
mod_webdav.c: In function 'webdav_propfind_dir':
mod_webdav.c:3237:51: warning: pointer/integer type mismatch in conditional expression [enabled by default]
mod_webdav.c:3264:52: error: 'AT_SYMLINK_NOFOLLOW' undeclared (first use in this function)
make[4]: *** [mod_webdav_la-mod_webdav.lo] Error 1
make[4]: *** Waiting for unfinished jobs....
mv -f .deps/liblightcomp_la-plugin.Tpo .deps/liblightcomp_la-plugin.Plo
make[4]: Leaving directory `/home/buildbot/buildbot-slaves/externals/aixcompile/build/lighttpd-1.4.55/src'
make[3]: *** [all] Error 2
make[3]: Leaving directory `/home/buildbot/buildbot-slaves/externals/aixcompile/build/lighttpd-1.4.55/src'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/buildbot/buildbot-slaves/externals/aixcompile/build/lighttpd-1.4.55'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/buildbot/buildbot-slaves/externals/aixcompile/build/lighttpd-1.4.55'
failed to build lighttpd-1.4.55
make: *** [lighttpd] Error 1

here is evidence that AT_FDCWD and AT_SYMLINK_NOFOLLOW are not found in /usr/include:

aixcompile/build $ egrep -r "AT_SYMLINK_NOFOLLOW|AT_FDCWD" /usr/include ; echo $?
1

RE: Compile on AIX conflicting types for 'etag_create' - Added by gstrauss over 1 year ago

/usr/include is not the only place for system headers. gcc has a set of headers included with gcc.

Ask gcc to tell give you a list of header includes with -H, and then check those locations, too.
gcc -H -std=gnu99 -DHAVE_CONFIG_H -DHAVE_VERSIONSTAMP_H -DLIBRARY_DIR=\"/usr/local/lib\" -DSBIN_DIR=\"/usr/local/sbin\" -I. -I.. -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES -g -O2 -Wall -W -Wshadow -pedantic -MT liblightcomp_la-etag.lo -MD -MP -MF .deps/liblightcomp_la-etag.Tpo -c etag.c -fPIC -DPIC -o .libs/liblightcomp_la-etag.o

You could try compiling with xlc to see where xlc is pulling headers, if you have xlc available.

IBM's documentation references these standard AT_* defines, so they do exist somewhere.

You might try adding these to the very top of mod_webdav.c

#define _DEFAULT_SOURCE
#define _ALL_SOURCE

and commenting out
#define _XOPEN_SOURCE 700

As I recall, IBM sometimes foobars the standards, and defining _XOPEN_SOURCE might do that.

RE: Compile on AIX conflicting types for 'etag_create' - Added by rturner over 1 year ago

using the -H flag showed there are header files in /opt/freeware too, but still could not find AT_FDCWD and AT_SYMLINK_NOFOLLOW in any of them.

also tried your suggestion and got the same compile error

mod_webdav.c: In function 'webdav_unlinkat':
mod_webdav.c:2209:5: warning: implicit declaration of function 'unlinkat' [-Wimplicit-function-declaration]
mod_webdav.c: In function 'webdav_delete_dir':
mod_webdav.c:2247:5: warning: implicit declaration of function 'fdopendir' [-Wimplicit-function-declaration]
mod_webdav.c:2247:51: warning: pointer/integer type mismatch in conditional expression [enabled by default]
mod_webdav.c:2273:13: warning: implicit declaration of function 'fstatat' [-Wimplicit-function-declaration]
mod_webdav.c:2273:52: error: 'AT_SYMLINK_NOFOLLOW' undeclared (first use in this function)
mod_webdav.c:2273:52: note: each undeclared identifier is reported only once for each function it appears in
mod_webdav.c: In function 'webdav_linktmp_rename':
mod_webdav.c:2342:9: warning: implicit declaration of function 'linkat' [-Wimplicit-function-declaration]
mod_webdav.c:2342:24: error: 'AT_FDCWD' undeclared (first use in this function)
mod_webdav.c: In function 'webdav_copymove_file':
mod_webdav.c:2491:25: error: 'AT_FDCWD' undeclared (first use in this function)
mod_webdav.c: In function 'webdav_copymove_dir':
mod_webdav.c:2747:54: warning: pointer/integer type mismatch in conditional expression [enabled by default]
mod_webdav.c:2768:52: error: 'AT_SYMLINK_NOFOLLOW' undeclared (first use in this function)
mod_webdav.c: In function 'webdav_propfind_dir':
mod_webdav.c:3240:51: warning: pointer/integer type mismatch in conditional expression [enabled by default]
mod_webdav.c:3267:52: error: 'AT_SYMLINK_NOFOLLOW' undeclared (first use in this function)

aixcompile/build $ diff lighttpd-1.4.55.orig/src/mod_webdav.c lighttpd-1.4.55/src/mod_webdav.c 
152a153,154
> #define _DEFAULT_SOURCE
> #define _ALL_SOURCE
153a156
> 
157c160
< #define _XOPEN_SOURCE 700
---
> /* #define _XOPEN_SOURCE 700 */
2657a2661
> #if EEXIST != ENOTEMPTY
2658a2663
> #endif

RE: Compile on AIX conflicting types for 'etag_create' - Added by gstrauss over 1 year ago

Fact: non-ancient versions of AIX support POSIX.1-2008 *at
e.g. https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/s_bostechref/statx.html

What (ancient) version of AIX are you running? Something over a decade old?
Why is the version of GCC so old? http://www.bullfreeware.com has much newer versions.
...It does not sound like these systems are well-maintained. I really hope that these AIX systems are not accessible to the internet and access is severely restricted on the intranet.

RE: Compile on AIX conflicting types for 'etag_create' - Added by gstrauss over 1 year ago

If you do not need mod_webdav, then you might disable it in your build.

--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -149,11 +149,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

RE: Compile on AIX conflicting types for 'etag_create' - Added by rturner over 1 year ago

i was able to successfully compile after disabling mod_webdav as you suggested. and yes, i am using an ancient version of aix (5.3.0.0) for reasons i would rather not get into here. thank you again for your support.

RE: [Solved] Compile on AIX conflicting types for 'etag_create' - Added by gstrauss over 1 year ago

Good luck. At least you're trying to keep up-to-date with the latest and recommended lighttpd release.

    (1-18/18)