Installieren von gcc-4.8 auf Ubuntu 21.10 im Jahr 2022

Installieren von gcc-4.8 auf Ubuntu 21.10 im Jahr 2022

Ich versuche, GCC-4.8 auf Ubuntu 21.10 zu installieren.

Zuerst habe ich versucht, die Installation aus einem Repository durchzuführen, was aber wahrscheinlich daran scheiterte, dass die Version 4.8 zu alt ist:

>sudo apt-get install python-software-properties
>sudo add-apt-repository ppa:ubuntu-toolchain-r/test
>sudo apt-get update
>sudo apt-get install gcc-4.8

Die Ausgabe des letzten Befehls war:

>sudo apt-get install gcc-4.8
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'gcc-4.8-hppa64' for regex 'gcc-4.8'
The following package was automatically installed and is no longer required:
  libfwupdplugin1
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Zweitens habe ich versucht, aus den Quellen zu kompilieren. Ich habe diese Befehle ausgeführt:

>wget http://www.netgull.com/gcc/releases/gcc-4.8.0/gcc-4.8.0.tar.bz2
>tar xjf gcc-4.8.0.tar.bz2 
>sudo apt-get install libgm
>cd gcc-4.8.0/
>./contrib/download_prerequisites 
>./configure --prefix=/app/gcc/4.8.0
>make -j 8

Aber irgendwann bekam ich diesen Fehler:

In file included from ./tm.h:42,
                 from ../.././gcc/cp/init.c:26:
../.././gcc/defaults.h:126:24: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]
  126 |       fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n",  \
      |                        ^
../.././gcc/cp/except.c: In function ‘int doing_eh()’:
../.././gcc/cp/except.c:468:11: warning: unquoted option name ‘-fexceptions’ in format [-Wformat-diag]
  468 |    error ("exception handling disabled, use -fexceptions to enable");
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../.././gcc/cp/except.c:1005:
cfns.gperf: At global scope:
cfns.gperf:101:1: error: ‘const char* libc_name_p(const char*, unsigned int)’ redeclared inline with ‘gnu_inline’ attribute
cfns.gperf:26:14: note: ‘const char* libc_name_p(const char*, unsigned int)’ previously declared here
cfns.gperf:26:14: warning: inline function ‘const char* libc_name_p(const char*, unsigned int)’ used but never defined
make[3]: *** [Makefile:1058: cp/except.o] Error 1
make[3]: *** Waiting for unfinished jobs....
../.././gcc/cp/friend.c: In function ‘tree_node* do_friend(tree, tree, tree, tree, overload_flags, bool)’:
../.././gcc/cp/friend.c:590:15: warning: unquoted sequence of 2 consecutive punctuation characters ‘<>’ in format [-Wformat-diag]
  590 |      "and add <> after the function name here) ");
      |               ^~
../.././gcc/cp/friend.c:590:47: warning: spurious trailing space in format [-Wformat-diag]
  590 |      "and add <> after the function name here) ");
      |                                               ^
../.././gcc/cp/init.c: In function ‘tree_node* build_java_class_ref(tree)’:
../.././gcc/cp/init.c:3028:10: warning: contraction ‘can%'t’ in format; use ‘cannot’ instead [-Wformat-diag]
 3028 |  error ("can%'t find %<class$%> in %qT", type);
      |          ^~~~~~
rm gcc.pod
make[3]: Leaving directory '/home/sda/Program_files/gcc-build/gcc-4.8.0/host-x86_64-unknown-linux-gnu/gcc'
make[2]: *** [Makefile:4163: all-stage1-gcc] Error 2
make[2]: Leaving directory '/home/sda/Program_files/gcc-build/gcc-4.8.0'
make[1]: *** [Makefile:23575: stage1-bubble] Error 2
make[1]: Leaving directory '/home/sda/Program_files/gcc-build/gcc-4.8.0'
make: *** [Makefile:892: all] Error 2

Mein gcc ist „gcc Version 10.3.0 (Ubuntu 10.3.0-11ubuntu1)“. Ich vermute, dass der neue GCC-Compiler einen so alten nicht erstellen kann.

Bitte beraten.

=============================================

NACHVERFOLGEN

Ich habe versucht, einem der unten stehenden Ratschläge zu folgen und habe es in einem anderen Ordner erneut kompiliert – dieselbe Ausgabe, ein Fehler, aber ein anderer.

Ich habe die folgenden Befehle verwendet:

tar xjf gcc-4.8.0.tar.bz2 
./gcc-4.8.0/contrib/download_prerequisites 
mkdir build
cd build/
../gcc-4.8.0/configure --prefix=/usr/local/gcc-4.8.0
make -j 16

Die Ausgabe war:

../../gcc-4.8.0/gcc/cp/semantics.c: In function ‘tree_node* finish_omp_clauses(tree)’:
../../gcc-4.8.0/gcc/cp/semantics.c:4150:16: warning: unquoted identifier or keyword ‘num_threads’ in format [-Wformat-diag]
 4150 |        error ("num_threads expression must be integral");
      |                ^~~~~~~~~~~
../../gcc-4.8.0/gcc/cp/semantics.c: In function ‘tree_node* finish_trait_expr(cp_trait_kind, tree, tree)’:
../../gcc-4.8.0/gcc/cp/semantics.c:5614:15: warning: unquoted identifier or keyword ‘__is_convertible_to’ in format [-Wformat-diag]
 5614 |       sorry ("__is_convertible_to");
      |               ^~~~~~~~~~~~~~~~~~~
../../gcc-4.8.0/gcc/cp/semantics.c: In function ‘tree_node* cxx_eval_call_expression(const constexpr_call*, tree, bool, bool, bool*, bool*)’:
../../gcc-4.8.0/gcc/cp/semantics.c:6797:10: warning: unquoted option name ‘-fconstexpr-depth’ in format [-Wformat-diag]
 6797 |         "-fconstexpr-depth= to increase the maximum)",
      |          ^~~~~~~~~~~~~~~~~
../../gcc-4.8.0/gcc/cp/semantics.c: In function ‘tree_node* finish_decltype_type(tree, bool, tsubst_flags_t)’:
../../gcc-4.8.0/gcc/cp/semantics.c:5326:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
 5326 |           if (DECL_BIT_FIELD_TYPE (expr))
      |           ^~
../../gcc-4.8.0/gcc/cp/semantics.c:5333:9: note: here
 5333 |         case FUNCTION_DECL:
      |         ^~~~
../../gcc-4.8.0/gcc/cp/semantics.c: In function ‘bool potential_constant_expression_1(tree, bool, tsubst_flags_t)’:
../../gcc-4.8.0/gcc/cp/semantics.c:8640:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
 8640 |       if (!literal_type_p (TREE_TYPE (t)))
      |       ^~
../../gcc-4.8.0/gcc/cp/semantics.c:8650:5: note: here
 8650 |     case INIT_EXPR:
      |     ^~~~
rm gcc.pod
make[3]: Leaving directory '/home/sda/Program_files/gcc-build/build/gcc'
make[2]: *** [Makefile:4157: all-stage1-gcc] Error 2
make[2]: Leaving directory '/home/sda/Program_files/gcc-build/build'
make[1]: *** [Makefile:21520: stage1-bubble] Error 2
make[1]: Leaving directory '/home/sda/Program_files/gcc-build/build'
make: *** [Makefile:886: all] Error 2

Irgendwelche anderen Vorschläge?

Mein persönliches Bauchgefühl sagt mir, dass das Problem in GCC v. 10.3.1 liegt, das zum Kompilieren von GCC v. 4.8.0 verwendet wird. Der neue GCC ist möglicherweise nicht mit dem älteren Quellcode kompatibel.

Bitte um Rat

verwandte Informationen