Skip to contentSkip to conversation

git 1.6.6.1 on glibc 2.2

DISCUSSION Gabor Z. Papp 2 participants 4 messages Jun 15, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

Hello all,

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' read-cache.c:73: error: 'struct stat' has no member named 'st_mtim' read-cache.c: In function 'read_index_from':
read-cache.c:1316: error: 'struct stat' has no member named 'st_mtim' read-cache.c: In function 'write_index':
read-cache.c:1581: error: 'struct stat' has no member named 'st_mtim'
make: *** [read-cache.o] Error 1

#1 lore raw

Hi!

Quoted 6 lines · Gabor Z. Papp

Hello all,

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 for the report. Perhaps:

$ grep -C3 st_ctim Makefile
# randomly break unless your underlying filesystem supports those sub-second
# times (my ext3 doesn't).
#
# Define USE_ST_TIMESPEC if your "struct stat" uses "st_ctimespec" instead of
# "st_ctim"
#
# Define NO_NSEC if your "struct stat" does not have "st_ctim.tv_nsec"
# available.  This automatically turns USE_NSEC off.
#
# Define USE_STDEV below if you want git to care about the underlying device

Hope that helps,
Jonathan

#2 lore raw

* Jonathan Nieder <[email protected]>:

| > 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 for the report.  Perhaps:
| # Define NO_NSEC if your "struct stat" does not have "st_ctim.tv_nsec"
| # available.  This automatically turns USE_NSEC off.

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.

#3 lore raw
Quoted 6 lines · Gabor Z. Papp

| 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'

[...]

Quoted 3 lines

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  <[email protected]>
|
|	* 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.

---

Makefile +1 -1
index fd7f51e..8ebc966 100644
@@ -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).