1Building older GNU coreutils versions on newer systems 2====================================================== 3 4Overview 5-------- 6 7Some older GNU coreutils fail to build on newer GNU/Linux systems. 8 9This happens with Coreutils version 8.29 and earlier, on systems 10using GlibC version 2.28 or newer, Such as Debian 10, CentOS 8, Fedora 29. 11 12A typical error is: 13 14 $ wget https://ftp.gnu.org/gnu/coreutils/coreutils-7.6.tar.xz 15 $ tar -xf coreutils-7.6.tar.xz 16 $ cd coreutils-7.6 17 $ ./configure 18 $ make 19 [...] 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 24 to bug-gnulib." 25 [...] 26 make[4]: *** [Makefile:1700: freadahead.o] Error 1 27 28Other similar errors mention 'freadptr', 'freadseek','fseterr'. 29Older version (pre 7.2) mention 'tee','eaccess','futimens'. 30 31 32Details 33------- 34 35GLibC version 2.28 removed a non-standard header file (libio.h) and some 36internal symbols which were used by gnulib (a core component of GNU coreutils). 37 38These were announced as 'deprecated' in version 2.27 [1], and removed in 39version 2.28. Gnulib code was adjusted shortly after [2], 40but the code changes obviously can't be retroactively made to 41previously-released coreutils versions. 42 43[1] https://sourceware.org/ml/libc-announce/2018/msg00000.html 44[2] https://lists.gnu.org/r/bug-gnulib/2018-03/msg00000.html 45 46Older coreutils versions defined functions that were later picked-up 47by glibc ('tee','eaccess','futimens') resulting in conflicts. 48 49See the patches for the exact code changes. 50 51 52Supplied patches 53---------------- 54 55The patch files in this directory change the source code of older 56coreutils versions, enabling successful build on newer systems. 57 58Some versions require different patches. 59 60Coreutils Versions Patch file 615.0 coreutils-5.0-on-glibc-2.28.diff 625.97 to 6.9 coreutils-5.97-on-glibc-2.28.diff 636.10 coreutils-6.10-on-glibc-2.28.diff 646.11 coreutils-6.11-on-glibc-2.28.diff 656.12 coreutils-6.12-on-glibc-2.28.diff 667.2 to 8.3 coreutils-7.2-on-glibc-2.28.diff 678.4 to 8.12 coreutils-8.4-on-glibc-2.28.diff 688.13 to 8.16 coreutils-8.13-on-glibc-2.28.diff 698.17 coreutils-8.17-on-glibc-2.28.diff 708.18 to 8.23 coreutils-8.18-on-glibc-2.28.diff 718.24 to 8.29 coreutils-8.24-on-glibc-2.28.diff 728.30 and newer [builds without patching] 73 74 75Manual build 76------------ 77 781. Download the desired version from https://ftp.gnu.org/gnu/coreutils . 792. Patch using the corresponding patch file (see table above). 803. Configure the build, optionally adding the version number 81 to the executables, to ensure they will not conflict with existing 82 (newer) executables 834. Build with 'make' 845. Optionally install with 'sudo make install' 85 86Example: 87 88 wget https://ftp.gnu.org/gnu/coreutils/coreutils-5.97.tar.gz 89 tar -xf coreutils-5.97.tar.gz 90 cd coreutils-5.97 91 patch -p1 < ../coreutils-5.97-on-glibc-2.28.diff 92 ./configure --program-suffix=-5.97 93 make 94 sudo make install 95 96This 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', 98'head-5.97'). 99 100NOTE: 101With very old versions (5.X and 6.X), running "./configure" will 102hang for a long time at the following step: 103 "checking for mktime..." 104But will eventually continue successfully. 105 106 107Automated build 108--------------- 109 110The script 'build-older-versions.sh' automatically performs the manual steps 111listed above. The script installs each package in a separate directory: 112Programs in `$HOME/old-coreutils/coreutils-{VERSION}/bin`, 113manual pages in `$HOME/old-coreutils/coreutils-{VERSION}/share/man`, 114PDF manual in `$HOME/old-coreutils/coreutils-{VERSION}/share/doc`, 115INFO pages in `$HOME/old-coreutils/coreutils-{VERSION}/share/info`. 116It will also create symlinks to all version in a common directory 117`$HOME/old-coreutils/bin`. 118 119Example, running the following commands: 120 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 125 126Will download, patch, build and install the programs for GNU coreutils 127versions 5.0,5.97,6.12,7.6 in `$HOME/old-coreutils/bin` : 128 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 ...] 155 156By adding the directory to your $PATH, older versions can be easily used: 157 158 export PATH=$PATH:$HOME/old-coreutils/bin 159 export MANPATH=$MANPATH:$HOME/old-coreutils/man 160 161 162 163 164 165======================================================================== 166 167Copyright (C) 2019-2023 Free Software Foundation, Inc. 168 169Permission is granted to copy, distribute and/or modify this document 170under the terms of the GNU Free Documentation License, Version 1.3 or 171any later version published by the Free Software Foundation; with no 172Invariant Sections, with no Front-Cover Texts, and with no Back-Cover 173Texts. A copy of the license is included in the "GNU Free 174Documentation License" file as part of this distribution. 175