<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><span class="Apple-style-span" style="font-family: monospace;">Hi all,<br>
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.<br><br>The following error was almost immediately returned after running make:<br>
<br>./rsync.h:669:26: fatal error: linux/falloc.h: No such file or directory<br><br>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.<br>
<br></span></span><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="font-family: monospace; ">#if defined HAVE_FALLOCATE || HAVE_SYS_FALLOCATE<br>
#include <linux/falloc.h></span></span><br><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><span class="Apple-style-span" style="font-family: monospace;"><br>
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.<br><br>I double checked the config.log to see why the configuration step passed and the final compilation failed.<br>
<br>Here is the code extracted from configure.sh to check the availability of fallocate:<br><br></span></span><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><span class="Apple-style-span" style="font-family: monospace;">#include <fcntl.h><br>
#include <sys/types.h><br>int<br>main ()<br>{<br>fallocate(0, 0, 0, 0);<br>  ;<br>  return 0;<br>}<br><br>This code compiles (with a warning) and runs on my system:<br><br></span></span><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><span class="Apple-style-span" style="font-family: monospace;">mulander@bunkier_mysli:~/code/blog/lac$ gcc -std=gnu99 -o conftest -g -O2 -DHAVE_CONFIG_H -Wall -W test.c<br>
<br>test.c: In function 'main':<br>test.c:6:3: warning: implicit declaration of function 'fallocate'<br>mulander@bunkier_mysli:~/code/blog/lac$ ./conftest<br>mulander@bunkier_mysli:~/code/blog/lac$ echo $?<br>
0<br><br>Adding an include to linux/falloc.h of course results in a failing compilation.<br><br>I checked the man 2 fallocate page for my system and the synopsis sections provides the following:<br><br></span></span><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="font-family: monospace; ">SYNOPSIS<br>
       #define _GNU_SOURCE             /* See feature_test_macros(7) */<br>       #include <fcntl.h><br><br>       int fallocate(int fd, int mode, off_t offset, off_t len);<br><br>Adding the #define _GNU_SOURCE preprocessor directive removes the compilation warning - the code still passes.<br>
<br>I tracked down the change that introduced the problematic include and it can be found on the on-line gitweb repository browser: <a href="http://gitweb.samba.org/?p=rsync.git;a=commitdiff;h=28b519c93b6db30b6520d46f8cd65160213fddd2">http://gitweb.samba.org/?p=rsync.git;a=commitdiff;h=28b519c93b6db30b6520d46f8cd65160213fddd2</a><br>
<br>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.<br>
<br>Regards,<br>Adam Wolk<br></span></span>