Re: git 1.6.6.1 on glibc 2.2
From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:48:05
Subsystem:
kernel build + files below scripts/ (unless maintained elsewhere), the rest · Maintainers:
Nathan Chancellor, Nicolas Schier, Linus Torvalds
Gabor Z. Papp wrote:
| Gabor Z. Papp wrote:
|> trying to compile git 1.6.6.1 on Linux 2.4.37.7, glibc 2.2.5: |> |> read-cache.c: In function 'fill_stat_cache_info': |> read-cache.c:72: error: 'struct stat' has no member named 'st_ctim'
[...]
Thanks Jonathan, compiles fine defining NO_NSEC, but my glibc is 2.2.5 and the comment abot USE_NSEC says it requires at least glibc 2.2.4. Maybe the comment is wrong? glibc 2.3.6 compiles fine.
Hmm, in the glibc changelog I find this, from ChangeLog.14: | 2003-01-04 Andreas Schwab [off-list ref] | | * sysdeps/unix/sysv/linux/m68k/bits/stat.h: Add nanosecond fields. That’s around the time of glibc 2.3.2. The stat(2) man page tells a little more: | Since kernel 2.5.48, the stat structure supports nanosecond resolution for | the three file timestamp fields. Glibc exposes the nanosecond component | of each field using names either of the form st_atim.tv_nsec, if the | _BSD_SOURCE or _SVID_SOURCE feature test macro is defined, or of the form | st_atimensec, if neither of these macros is defined. On file systems that | do not support sub-second timestamps, these nanosecond fields are returned | with the value 0. Searching a little harder yields commit cvs/glibc-2_3_2~418 (2002-12-31) of git://sourceware.org/git/glibc.git, in which the feature was added. There’s a lovely discussion about it from then on libc-alpha. [1] The comment you mention is from commit bdd4da5 (Make nsec checking optional, 2005-04-13); I am guessing 2.2.4 was just mentioned as a lower bound. So how about something like the following? Please feel free to write something better --- in particular, I am not sure the documentation for USE_NSEC is the most obvious place to look when something goes wrong. Thanks, Jonathan [1] http://sourceware.org/ml/libc-alpha/2002-12/threads.html#00011 -- %< -- Subject: Makefile: document minimal glibc version supporting tv_nsec Compiling git with the default settings and old glibc produces errors like the following: | read-cache.c: In function 'fill_stat_cache_info': | read-cache.c:72: error: 'struct stat' has no member named 'st_ctim' The Makefile seems to imply that versions after 2.2.4 should be okay, but that is not true: NO_NSEC must be set to build with glibc versions before 2.3.2. Reported-by: Gabor Z. Papp <redacted> Signed-off-by: Jonathan Nieder <redacted> ---
diff --git a/Makefile b/Makefile
index fd7f51e..8ebc966 100644
--- a/Makefile
+++ b/Makefile@@ -134,7 +134,7 @@ all:: # "-Wl,-rpath=/path/lib" is used instead. # # Define USE_NSEC below if you want git to care about sub-second file mtimes -# and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and +# and ctimes. Note that you need recent glibc (at least 2.3.2) for this, and # it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely # randomly break unless your underlying filesystem supports those sub-second # times (my ext3 doesn't).