[Dovecot] [2.2-UNSTABLE] compilation error: 'POSIX_FADV_WILLNEED' undeclared

Michael Grimm trashcan at odo.in-berlin.de
Tue Oct 23 22:06:51 EEST 2012


Hi --

I am trying to compile 2.2 (acd76b5272e9) at FreeBSD 9.0:

| libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/lib 
	-I/usr/local/include -std=gnu99 -O2 -Wall -W -Wmissing-prototypes \
	-Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wformat=2 \
	-Wbad-function-cast -fno-builtin-strftime -Wstrict-aliasing=2 \
	-I/usr/local/include -MT fs-posix.lo -MD -MP -MF .deps/fs-posix.Tpo \
	-c fs-posix.c  -fPIC -DPIC -o .libs/fs-posix.o
| fs-posix.c: In function 'fs_posix_prefetch':
| fs-posix.c:298: warning: implicit declaration of function 'posix_fadvise'
| fs-posix.c:298: error: 'POSIX_FADV_WILLNEED' undeclared (first use in this function)
| fs-posix.c:298: error: (Each undeclared identifier is reported only once
| fs-posix.c:298: error: for each function it appears in.)
| gmake[3]: *** [fs-posix.lo] Error 1
| gmake[3]: Leaving directory `/usr/local/etc/dovecot/SOURCE/dovecot-2.2/src/lib-fs'
| gmake[2]: *** [all-recursive] Error 1
| gmake[2]: Leaving directory `/usr/local/etc/dovecot/SOURCE/dovecot-2.2/src'
| gmake[1]: *** [all-recursive] Error 1
| gmake[1]: Leaving directory `/usr/local/etc/dovecot/SOURCE/dovecot-2.2'
| gmake: *** [all] Error 2

From configure logfile:

| checking for posix_fadvise... no

After a modification (stolen from src/lib-storage/index/index-mail.c) ...

| --- dovecot-2.2-modified/src/lib-fs/fs-posix.c	2012-10-23 20:27:31.348919455 +0200
| +++ dovecot-2.2/src/lib-fs/fs-posix.c	2012-10-23 20:26:39.435300269 +0200
| @@ -295,10 +295,12 @@
|  			return TRUE;
|  	}
|  
| +#if defined(HAVE_POSIX_FADVISE) && defined(POSIX_FADV_WILLNEED)
|  	if (posix_fadvise(file->fd, 0, length, POSIX_FADV_WILLNEED) < 0) {
|  		i_error("posix_fadvise(%s) failed: %m", _file->path);
|  		return TRUE;
|  	}
| +#endif
|  	return FALSE;
|  }

... the compilations runs to completion, and dovecot-2.2 UNSTABLE is running.

But: I do not have the knowledge to judge if that "fix" will be the right one.

Just to let you know and with regards,
Michael




More information about the dovecot mailing list