2022년에 Ubuntu 21.10에 gcc-4.8 설치

2022년에 Ubuntu 21.10에 gcc-4.8 설치

Ubuntu 21.10에 GCC-4.8을 설치하려고 합니다.

먼저 저장소에서 설치를 시도했지만 버전 4.8이 너무 오래되었기 때문에 실패했습니다.

>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

마지막 명령의 출력은 다음과 같습니다.

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

둘째, 소스로부터 컴파일을 시도했습니다. 다음 명령을 실행했습니다.

>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

하지만 결국 다음과 같은 오류가 발생했습니다.

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

내 gcc는 "gcc 버전 10.3.0(Ubuntu 10.3.0-11ubuntu1)"입니다. 나는 새로운 GCC 컴파일러가 그런 오래된 것을 만들 수 없다고 추측합니다.

조언해주세요.

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

후속 조치

나는 아래에 주어진 조언을 따르려고 노력했고 다른 폴더에서 다시 컴파일했습니다. 동일한 출력, 오류, 그러나 다른 폴더입니다.

다음 명령을 사용했습니다.

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

출력은 다음과 같습니다.

../../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

다른 제안이 있나요?

내 개인적인 직감은 문제가 GCC v. 4.8.0을 컴파일하는 데 사용되는 GCC v. 10.3.1에 있다는 것입니다. 새로운 GCC는 이전 소스 코드와 호환되지 않을 수 있습니다.

조언 부탁드립니다

관련 정보