x86_64 Debian에 GCC 13.1.0 설치

x86_64 Debian에 GCC 13.1.0 설치

여기에 있는 사람 중에 자신의 컴퓨터에 GCC 13.1.0을 설치한 사람이 있나요? 64비트 Debian Linux의 소스에서 빌드하려고 하면 다음 오류 메시지가 나타납니다.

/usr/bin/ld: .libs/hwasan.o: relocation R_X86_64_PC32 against undefined symbol `__ehdr_start' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: nonrepresentable section on output
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:559: libhwasan.la] Error 1
make[4]: Leaving directory '/home/teo/gcc-objdir/x86_64-pc-linux-gnu/libsanitizer/hwasan'
make[3]: *** [Makefile:532: all-recursive] Error 1
make[3]: Leaving directory '/home/teo/gcc-objdir/x86_64-pc-linux-gnu/libsanitizer'
make[2]: *** [Makefile:419: all] Error 2
make[2]: Leaving directory '/home/teo/gcc-objdir/x86_64-pc-linux-gnu/libsanitizer'
make[1]: *** [Makefile:22725: all-target-libsanitizer] Error 2
make[1]: Leaving directory '/home/teo/gcc-objdir'
make: *** [Makefile:1090: all] Error 2

나는 그것을 구성하곤 했다 ../gcc-13.1.0/configure --enable-languages=c,c++ --disable-multilib. 내 현재 GCC 버전은 다음과 같습니다.

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/12.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-12.2.0/configure --enable-languages=c,c++,ada --disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.2.0 (GCC)

이것은 연결 오류이므로 현재 링커가 관련이 있을 수 있다고 생각했습니다. 이것은:

GNU ld (GNU Binutils for Debian) 2.31.1
Copyright (C) 2018 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.

그렇다면 문제가 무엇이라고 생각하시나요? 어떻게 해결할 수 있나요?

Windows에 성공적으로 설치할 가능성이 너무 낮아 시도해 볼 가치도 없습니다. 동의하시나요?

답변1

이 오류는 ld 2.31.1의 버그로 인해 발생한 것 같습니다.https://sourceware.org/bugzilla/show_bug.cgi?id=24458.

이 버그는 ld 2.32와 이후 2.31에서 수정되었습니다(그러나 데비안 10 패키지 저장소에는 포함되지 않은 것 같습니다).

아직 시도하지는 않았지만 가능한 해결 방법은 업데이트된 ld를 얻은 다음(아마도 소스에서 빌드) 이를 gcc 빌드와 함께 사용하는 것입니다(어떤 빌드 플래그가 사용할 링커를 지정할 수 있는지 잘 모르겠습니다. 그러나 아마도 하나가 있을 것입니다).

답변2

export CFLAGS="-O2 -fPIC"
export CXXFLAGS=$CFLAGS
./configure && make

첫 번째 오류 줄에 바로 있습니다."공유 객체를 생성할 때 사용할 수 없습니다. -fPIC으로 다시 컴파일하세요."

답변3

누군가 Debian 기반 배포판에 GCC 13을 설치하고 싶다면 MX-Linux(Debian bookworm base)와 함께 사용할 때 정말 잘 작동(구성, 빌드 및 설치)하는 기사를 찾았습니다.

설치 튜토리얼

관련 정보