compile troubles - stat.mtim - 1.1hg

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

compile troubles - stat.mtim - 1.1hg

Daniel Black-2
having trouble compiling dovecot-1.1hg latest pull

I'm amost thinking _GNU_SOURCE needs to be defined as its built to work

Any suggestions welcome.

make[4]: Nothing to be done for `all'.
make[4]: Leaving directory
`/home/dan/software_projects/dovecot-1.1/src/lib-storage/list'
Making all in index
make[4]: Entering directory
`/home/dan/software_projects/dovecot-1.1/src/lib-storage/index'
Making all in maildir
make[5]: Entering directory
`/home/dan/software_projects/dovecot-1.1/src/lib-storage/index/maildir'
gcc -DHAVE_CONFIG_H -I. -I../../../..  -I../../../../src/lib -I../../../../src/lib-mail -I../../../../src/lib-imap -I../../../../src/lib-index -I../../../../src/lib-storage -I../../../../src/lib-storage/index   -std=gnu99 -g -O2 -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wformat=2 -Wbad-function-cast -Wstrict-aliasing=2 -I/usr/kerberos/include    -MT
maildir-uidlist.o -MD -MP -MF .deps/maildir-uidlist.Tpo -c -o
maildir-uidlist.o maildir-uidlist.c
maildir-uidlist.c: In function 'maildir_uidlist_update_hdr':
maildir-uidlist.c:322: error: request for member 'st_mtim' in something not a
structure or union
make[5]: *** [maildir-uidlist.o] Error 1
make[5]: Leaving directory
`/home/dan/software_projects/dovecot-1.1/src/lib-storage/index/maildir'
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory
`/home/dan/software_projects/dovecot-1.1/src/lib-storage/index'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory
`/home/dan/software_projects/dovecot-1.1/src/lib-storage'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/dan/software_projects/dovecot-1.1/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/dan/software_projects/dovecot-1.1'



fgrep HAVE_STAT config.h
/* #undef HAVE_STATFS_MNTFROMNAME */
/* #undef HAVE_STATVFS_MNTFROMNAME */
#define HAVE_STAT_XTIM
/* #undef HAVE_STAT_XTIMESPEC */

from config.log
configure:28085: checking if struct stat has st_?tim timespec fields
configure:28117:
gcc -c -std=gnu99 -g -O2 -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wformat=2 -Wbad-function-cast -Wstrict-aliasing=2  
conftest.c >&5
conftest.c: In function 'main':
conftest.c:104: warning: unused variable 'x'
configure:28123: $? = 0
configure:28134: result: yes
configure:28149: checking if struct stat has st_?timespec fields
configure:28181:
gcc -c -std=gnu99 -g -O2 -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wformat=2 -Wbad-function-cast -Wstrict-aliasing=2  
conftest.c >&5
conftest.c: In function 'main':
conftest.c:105: error: 'struct stat' has no member named 'st_mtimespec'
conftest.c:105: warning: unused variable 'x'
configure:28187: $? = 1
configure: failed program was:


Portage 2.1.4.4 (default-linux/amd64/2007.0, gcc-4.2.3, glibc-2.6.1-r0,
2.6.22-vs2.2.0.7-gentoo x86_64)
=================================================================
System uname: 2.6.22-vs2.2.0.7-gentoo x86_64 AMD Athlon(tm) 64 X2 Dual Core
Processor 4200+
Timestamp of tree: Sat, 17 May 2008 22:15:01 +0000
distcc 2.18.3 x86_64-pc-linux-gnu (protocols 1 and 2) (default port 3632)
[enabled]
app-shells/bash:     3.2_p33
dev-java/java-config: 1.3.7, 2.1.6
dev-lang/python:     2.4.4-r9
dev-python/pycrypto: 2.0.1-r6
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61-r1
sys-devel/automake:  1.4_p6, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.1
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.23-r3


features.h
#ifdef  _GNU_SOURCE
# define _BSD_SOURCE    1
#endif
....
#if defined _BSD_SOURCE || defined _SVID_SOURCE
# define __USE_MISC     1
#endif

sys/stat.h includes bits/stat.h
#include <features.h>
....
struct stat { ....
#ifdef __USE_MISC
    /* Nanosecond resolution timestamps are stored in a format
       equivalent to 'struct timespec'.  This is the type used
       whenever possible but the Unix namespace rules do not allow the
       identifier 'timespec' to appear in the <sys/stat.h> header.
       Therefore we have to handle the use of this header in strictly
       standard-compliant sources special.  */
    struct timespec st_atim;            /* Time of last access.  */
    struct timespec st_mtim;            /* Time of last modification.  */
    struct timespec st_ctim;            /* Time of last status change.  */



--

Daniel Black
--
Proudly a Gentoo Linux User.
Gnu-PG/PGP signed and encrypted email preferred
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x76677097
GPG Signature D934 5397 A84A 6366 9687  9EB2 861A 4ABA 7667 7097

signature.asc (204 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: compile troubles - stat.mtim - 1.1hg

Jakob Hirsch
Daniel Black wrote:

> having trouble compiling dovecot-1.1hg latest pull

dito.

ST_MTIME_NSEC is ((unsigned long)(st).st_mtim.tv_nsec) (at least on my
system), but st in maildir-uidlist.c:322 is a pointer, so -> has to be used.

Here's a (quick'n'dirty, probably incomplete) patch:

diff -r 6ab2ccae0868 src/lib-storage/index/maildir/maildir-uidlist.c
--- a/src/lib-storage/index/maildir/maildir-uidlist.c   Sat May 17
02:25:40 2008 +0300
+++ b/src/lib-storage/index/maildir/maildir-uidlist.c   Sun May 18
16:44:30 2008 +0200
@@ -318,7 +318,7 @@ static void maildir_uidlist_update_hdr(s
         struct maildir_index_header *mhdr = &uidlist->mbox->maildir_hdr;

         mhdr->uidlist_mtime = st->st_mtime;
-       mhdr->uidlist_mtime_nsecs = ST_MTIME_NSEC(st);
+       mhdr->uidlist_mtime_nsecs = ST_MTIME_NSEC_REF(st);
         mhdr->uidlist_size = st->st_size;
  }

diff -r 6ab2ccae0868 src/lib/compat.h
--- a/src/lib/compat.h  Sat May 17 02:25:40 2008 +0300
+++ b/src/lib/compat.h  Sun May 18 16:44:30 2008 +0200
@@ -67,6 +67,7 @@ typedef int socklen_t;
  #  define HAVE_ST_NSECS
  #  define ST_ATIME_NSEC(st) ((unsigned long)(st).st_atim.tv_nsec)
  #  define ST_MTIME_NSEC(st) ((unsigned long)(st).st_mtim.tv_nsec)
+#  define ST_MTIME_NSEC_REF(st) ((unsigned long)(st)->st_mtim.tv_nsec)
  #  define ST_CTIME_NSEC(st) ((unsigned long)(st).st_ctim.tv_nsec)
  #elif defined (HAVE_STAT_XTIMESPEC)
  #  define HAVE_ST_NSECS

Reply | Threaded
Open this post in threaded view
|

Re: compile troubles - stat.mtim - 1.1hg

Timo Sirainen
On Sun, 2008-05-18 at 16:46 +0200, Jakob Hirsch wrote:
> Daniel Black wrote:
>
> > having trouble compiling dovecot-1.1hg latest pull
>
> dito.
>
> ST_MTIME_NSEC is ((unsigned long)(st).st_mtim.tv_nsec) (at least on my
> system), but st in maildir-uidlist.c:322 is a pointer, so -> has to be used.

Whops. I thought I had tested it, but looks like I was missing
HAVE_STAT_XTIM from my config.h.

> Here's a (quick'n'dirty, probably incomplete) patch:

There's a bit easier way:
http://hg.dovecot.org/dovecot-1.1/rev/e29dafc501cc

signature.asc (196 bytes) Download Attachment