Hi all,
I'm trying to compile rsync from the git sources (rev
8bcd6a4afff3cb8197d5589ec4fdf9fe153f53de) the configuration step went
without any reported problems so I ran the make utility to compile the code
base.
The following error was almost immediately returned after running make:
./rsync.h:669:26: fatal error: linux/falloc.h: No such file or directory
The reported line resides in rsync.h and includes the falloc.h header file
if HAVE_FALLOCATE or HAVE_SYS_FALLOCATE is defined by the configuration
step.
#if defined HAVE_FALLOCATE || HAVE_SYS_FALLOCATE
#include <linux/falloc.h>
The generated config.h file (created by ./configure) contains a definition
of HAVE_FALLOCATE (initialized to 1) and HAVE_POSIX_FALLOCATE.
HAVE_SYS_FALLOCATE remains undefined.
I double checked the config.log to see why the configuration step passed and
the final compilation failed.
Here is the code extracted from configure.sh to check the availability of
fallocate:
#include <fcntl.h>
#include <sys/types.h>
int
main ()
{
fallocate(0, 0, 0, 0);
;
return 0;
}
This code compiles (with a warning) and runs on my system:
mulander at bunkier_mysli:~/code/blog/lac$ gcc -std=gnu99 -o conftest -g -O2
-DHAVE_CONFIG_H -Wall -W test.c
test.c: In function 'main':
test.c:6:3: warning: implicit declaration of function 'fallocate'
mulander at bunkier_mysli:~/code/blog/lac$ ./conftest
mulander at bunkier_mysli:~/code/blog/lac$ echo $?
0
Adding an include to linux/falloc.h of course results in a failing
compilation.
I checked the man 2 fallocate page for my system and the synopsis sections
provides the following:
SYNOPSIS
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <fcntl.h>
int fallocate(int fd, int mode, off_t offset, off_t len);
Adding the #define _GNU_SOURCE preprocessor directive removes the
compilation warning - the code still passes.
I tracked down the change that introduced the problematic include and it can
be found on the on-line gitweb repository browser:
http://gitweb.samba.org/?p=rsync.git;a=commitdiff;h=28b519c93b6db30b6520d46f8cd65160213fddd2
Since the change is quite fresh (2011-04-05) I was thinking that this is a
possible configuration/conditional compilation problem. I'm just starting to
learn the rsync code base and I am not sure how this issue should be
correctly handled hence my email to this mailing list in the hope that
people more experienced with the code base could make appropriate steps to
resolve it.
Regards,
Adam Wolk
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.samba.org/pipermail/rsync/attachments/20110515/85e705f7/attachment.html>
Here is the diff I applied to my copy of the sources which allowed me to
pass the compilation without any problems.
Just for the record I'm testing this on Slackware GNU/Linux:
mulander at bunkier_mysli:~/code/blog/lac/rsync$ uname -a
Linux bunkier_mysli 2.6.32.7-grsec #2 SMP Sat Feb 6 11:22:33 CET 2010 i686
AMD Duron(tm) Processor AuthenticAMD GNU/Linux
rsync --version output after applying my patch:
mulander at bunkier_mysli:~/code/blog/lac/rsync$ ./rsync --version
rsync version 3.1.0dev protocol version 31.PR13
Copyright (C) 1996-2011 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
Capabilities:
64-bit files, 64-bit inums, 32-bit timestamps, 64-bit long ints,
socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
append, ACLs, xattrs, iconv, symtimes, prealloc
rsync comes with ABSOLUTELY NO WARRANTY. This is free software, and you
are welcome to redistribute it under certain conditions. See the GNU
General Public Licence for details.
Regards,
Adam Wolk
diff --git a/rsync.h b/rsync.h
index 99c7d6c..a80d11f 100644
--- a/rsync.h
+++ b/rsync.h
@@ -666,7 +666,7 @@ struct ht_int64_node {
#endif
#if defined HAVE_FALLOCATE || HAVE_SYS_FALLOCATE
-#include <linux/falloc.h>
+#include <fcntl.h>
#ifdef FALLOC_FL_KEEP_SIZE
#define SUPPORT_PREALLOCATION 1
#elif defined HAVE_FTRUNCATE
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.samba.org/pipermail/rsync/attachments/20110515/e5cd3242/attachment.html>
Wayne Davison
2011-May-16 15:37 UTC
Compilation problem with linux/falloc.h include in rsync.h
On Sun, May 15, 2011 at 9:36 AM, Mulander <netprobe at gmail.com> wrote:> ?#if defined HAVE_FALLOCATE || HAVE_SYS_FALLOCATE > -#include <linux/falloc.h> > +#include <fcntl.h> > ?#ifdef FALLOC_FL_KEEP_SIZERsync already includes fcntl.h higher up in rsync.h. The problematical include is to try to get FALLOC_FL_KEEP_SIZE defined. I have added a configure check for the include, which should fix things up for you. ..wayne..
Maybe Matching Threads
- [Bug 2243] New: scp ignoring ~/.ssh/config when both source and destination are remote hosts
- [RFC] add support for fallocate()
- [PATCH 1/3] VFS/ioctl: Add punching-hole support to ioctl().
- [PATCH 1/3] VFS/ioctl: Add punching-hole support to ioctl().
- undefined reference to fallocate64