https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106429
Bug ID: 106429 Summary: Building GCC is Inhibited on old Linux Distributions due to the use of "#!/bin/bash" Product: gcc Version: 11.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: other Assignee: unassigned at gcc dot gnu.org Reporter: martin.vahi at softf1 dot com Target Milestone: --- Some newer version of C++_compiler is needed to build applications that use some newer C++ standard. By default old Linux distributions have too old GCC versions, so a newer version of GCC needs to be built before the applications that use newer C++ standard can be built. Old Linux distributions are needed for old hardware, because newer Linux distributions do not always contain all the drivers for old hardware. For example, in the case of openSUSE Linux, drivers for old hardware are literally removed from the package repositories of newer versions of the openSUSE Linux. The paths at a "dependency graph" are: the_use_of_old_hardware --depends-on-> the_availability_of_drivers_for_that_old_hardware --depends-on-> the_use_of_old_operating_system_distributions --depends-on-> possibility_to_backport_applications_to_those_old_distributions apps_that_use_newer_Cpp_standard --depend-on-> some_newer_Cpp_compiler === GCC --depends-during-buildtime-on-> availability_of_some_newer_version_of_Bash_on_PATH --depends-on-> GCC_code_changes_that_are_described_in_this_bug_report To build a newer version of GCC, some newer version of Bash is at least sometimes required, because the building of GCC, for example, version 11.2.0, includes the execution of some Bash scripts. The default Bash implementation tends to reside at the path "/bin/bash", but one needs the newer version of the Bash on PATH only during the building of the GCC. The classical solution in that scenario is export PATH="/path/to/the/newer/Bash/version/bin:$PATH" which means that the new version of the Bash gets found before the system default "/bin/bash" is found. However, if the GCC build related Bash scripts start with #!/bin/bash in stead of #!/usr/bin/env bash then that kind of PATH based Bash executable override does not work. The suggested and tested (GCC v. 11.2.0) workaround is to use grep to find all Bash files that start with the "#!/bin/bash" and replace the "#!/bin/bash" with the "#!/usr/bin/env bash", except the file gcc/contrib/repro_fail because, for some nice amount of luck, leaving that one to its "#!/bin/bash -eu" did not break anything. The version of Bash that turned out to be too old for building the GCC v.11.2.0 was 4.3.48(1)-release (x86_64-suse-linux-gnu) and the version of Bash that was sufficiently new for building GCC v.11.2.0 was Bash v.5.1 Thank You for reading this bug_report/comment.