1 Building older GNU coreutils versions on newer systems
2 ======================================================
7 Some older GNU coreutils fail to build on newer GNU/Linux systems.
9 This happens with Coreutils version 8.29 and earlier, on systems
10 using GlibC version 2.28 or newer, Such as Debian 10, CentOS 8, Fedora 29.
14 $ wget https://ftp.gnu.org/gnu/coreutils/coreutils-7.6.tar.xz
15 $ tar -xf coreutils-7.6.tar.xz
20 freadahead.c: In function 'freadahead':
21 freadahead.c:83:3: error: #error "Please port gnulib freadahead.c to
22 your platform! Look at the definition of fflush,
23 fread, ungetc on your system, then report this
26 make[4]: *** [Makefile:1700: freadahead.o] Error 1
28 Other similar errors mention 'freadptr', 'freadseek','fseterr'.
29 Older version (pre 7.2) mention 'tee','eaccess','futimens'.
35 GLibC version 2.28 removed a non-standard header file (libio.h) and some
36 internal symbols which were used by gnulib (a core component of GNU coreutils).
38 These were announced as 'deprecated' in version 2.27 [1], and removed in
39 version 2.28. Gnulib code was adjusted shortly after [2],
40 but the code changes obviously can't be retroactively made to
41 previously-released coreutils versions.
43 [1] https://sourceware.org/ml/libc-announce/2018/msg00000.html
44 [2] https://lists.gnu.org/r/bug-gnulib/2018-03/msg00000.html
46 Older coreutils versions defined functions that were later picked-up
47 by glibc ('tee','eaccess','futimens') resulting in conflicts.
49 See the patches for the exact code changes.
55 The patch files in this directory change the source code of older
56 coreutils versions, enabling successful build on newer systems.
58 Some versions require different patches.
60 Coreutils Versions Patch file
61 5.0 coreutils-5.0-on-glibc-2.28.diff
62 5.97 to 6.9 coreutils-5.97-on-glibc-2.28.diff
63 6.10 coreutils-6.10-on-glibc-2.28.diff
64 6.11 coreutils-6.11-on-glibc-2.28.diff
65 6.12 coreutils-6.12-on-glibc-2.28.diff
66 7.2 to 8.3 coreutils-7.2-on-glibc-2.28.diff
67 8.4 to 8.12 coreutils-8.4-on-glibc-2.28.diff
68 8.13 to 8.16 coreutils-8.13-on-glibc-2.28.diff
69 8.17 coreutils-8.17-on-glibc-2.28.diff
70 8.18 to 8.23 coreutils-8.18-on-glibc-2.28.diff
71 8.24 to 8.29 coreutils-8.24-on-glibc-2.28.diff
72 8.30 and newer [builds without patching]
78 1. Download the desired version from https://ftp.gnu.org/gnu/coreutils .
79 2. Patch using the corresponding patch file (see table above).
80 3. Configure the build, optionally adding the version number
81 to the executables, to ensure they will not conflict with existing
84 5. Optionally install with 'sudo make install'
88 wget https://ftp.gnu.org/gnu/coreutils/coreutils-5.97.tar.gz
89 tar -xf coreutils-5.97.tar.gz
91 patch -p1 < ../coreutils-5.97-on-glibc-2.28.diff
92 ./configure --program-suffix=-5.97
96 This will install the programs (e.g. 'sort', 'head) in
97 /usr/local/bin, with "-5.97" added to each program name (e.g. 'sort-5.97',
101 With very old versions (5.X and 6.X), running "./configure" will
102 hang for a long time at the following step:
103 "checking for mktime..."
104 But will eventually continue successfully.
110 The script 'build-older-versions.sh' automatically performs the manual steps
111 listed above. The script installs each package in a separate directory:
112 Programs in `$HOME/old-coreutils/coreutils-{VERSION}/bin`,
113 manual pages in `$HOME/old-coreutils/coreutils-{VERSION}/share/man`,
114 PDF manual in `$HOME/old-coreutils/coreutils-{VERSION}/share/doc`,
115 INFO pages in `$HOME/old-coreutils/coreutils-{VERSION}/share/info`.
116 It will also create symlinks to all version in a common directory
117 `$HOME/old-coreutils/bin`.
119 Example, running the following commands:
121 ./build-older-versions.sh 5.0
122 ./build-older-versions.sh 5.97
123 ./build-older-versions.sh 6.12
124 ./build-older-versions.sh 7.6
126 Will download, patch, build and install the programs for GNU coreutils
127 versions 5.0,5.97,6.12,7.6 in `$HOME/old-coreutils/bin` :
129 $ ls $HOME/old-coreutils/bin
130 [-5.97 id-5.0 sha224sum-7.6
131 [-6.12 id-5.97 sha256sum-6.12
132 [-7.6 id-6.12 sha256sum-7.6
133 base64-6.12 id-7.6 sha384sum-6.12
134 base64-7.6 install-5.0 sha384sum-7.6
135 basename-5.0 install-5.97 sha512sum-6.12
136 basename-5.97 install-6.12 sha512sum-7.6
137 basename-6.12 install-7.6 shred-5.0
138 basename-7.6 join-5.0 shred-5.97
139 cat-5.0 join-5.97 shred-6.12
140 cat-5.97 join-6.12 shred-7.6
141 cat-6.12 join-7.6 shuf-6.12
142 cat-7.6 kill-5.0 shuf-7.6
143 chcon-6.12 kill-5.97 sleep-5.0
144 chcon-7.6 kill-6.12 sleep-5.97
145 chgrp-5.0 kill-7.6 sleep-6.12
146 chgrp-5.97 link-5.0 sleep-7.6
147 chgrp-6.12 link-5.97 sort-5.0
148 chgrp-7.6 link-6.12 sort-5.97
149 chmod-5.0 link-7.6 sort-6.12
150 chmod-5.97 ln-5.0 sort-7.6
151 chmod-6.12 ln-5.97 split-5.0
152 chmod-7.6 ln-6.12 split-5.97
153 chown-5.0 ln-7.6 split-6.12
154 [... many more files ...]
156 By adding the directory to your $PATH, older versions can be easily used:
158 export PATH=$PATH:$HOME/old-coreutils/bin
159 export MANPATH=$MANPATH:$HOME/old-coreutils/man
165 ========================================================================
167 Copyright (C) 2019-2024 Free Software Foundation, Inc.
169 Permission is granted to copy, distribute and/or modify this document
170 under the terms of the GNU Free Documentation License, Version 1.3 or
171 any later version published by the Free Software Foundation; with no
172 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
173 Texts. A copy of the license is included in the "GNU Free
174 Documentation License" file as part of this distribution.