/ bin / ld :이 링커는 sysroot를 사용하도록 구성되지 않았습니다.

문제

프로그램을 컴파일 할 때 문제가 발생했습니다.

/bin/ld: this linker was not configured to use sysroots
collect2: error: ld returned 1 exit status

풀다

  • 업그레이드binutils

분석

확인 후이 기사에서는 .NET Framework를 컴파일하고 설치할 ld때 구성 sysroot매개 변수 가 없기 때문에 문제의 원인을 언급합니다 .

그런 다음 가능한 해결책은 ld링커 를 다시 설치하는 것 입니다.

ld버전을 확인하십시오 . 여기에서 사용되는 방법은 제공 할 수있는 ld패키지 를 찾는 것입니다 .

[root: ~]# yum whatprovides ld
Loaded plugins: fastestmirror
Repository epel is listed more than once in the configuration
Repository epel-debuginfo is listed more than once in the configuration
Repository epel-source is listed more than once in the configuration
base                                                                                                                    | 3.6 kB  00:00:00
epel                                                                                                                    | 4.7 kB  00:00:00
extras                                                                                                                  | 2.9 kB  00:00:00
updates                                                                                                                 | 2.9 kB  00:00:00
Loading mirror speeds from cached hostfile
binutils-2.27-43.base.el7.x86_64 : A GNU collection of binary utilities
Repo        : base
Matched from:
Filename    : /usr/bin/ld



binutils-2.27-43.base.el7_8.1.x86_64 : A GNU collection of binary utilities
Repo        : updates
Matched from:
Filename    : /usr/bin/ld



binutils-2.25.1-22.base.el7.x86_64 : A GNU collection of binary utilities
Repo        : installed
Matched from:
Filename    : /bin/ld



binutils-2.25.1-22.base.el7.x86_64 : A GNU collection of binary utilities
Repo        : installed
Matched from:
Filename    : /usr/bin/ld



쿼리 결과는 제안 현재 그 ld링커 버전 2.25.1-22, 하지 최신 버전 2.27-43 .

이에 영감을 받아 업데이트binutils :

[root: ~]# yum upgrade binutils
Loaded plugins: fastestmirror
Repository epel is listed more than once in the configuration
Repository epel-debuginfo is listed more than once in the configuration
Repository epel-source is listed more than once in the configuration
base                                                                                                                    | 3.6 kB  00:00:00
epel                                                                                                                    | 4.7 kB  00:00:00
extras                                                                                                                  | 2.9 kB  00:00:00
updates                                                                                                                 | 2.9 kB  00:00:00
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package binutils.x86_64 0:2.25.1-22.base.el7 will be updated
---> Package binutils.x86_64 0:2.27-43.base.el7_8.1 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================
 Package                        Arch                         Version                                       Repository                     Size
===============================================================================================================================================
Updating:
 binutils                       x86_64                       2.27-43.base.el7_8.1                          updates                       5.9 M

Transaction Summary
===============================================================================================================================================
Upgrade  1 Package

Total download size: 5.9 M
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
binutils-2.27-43.base.el7_8.1.x86_64.rpm                                                                                | 5.9 MB  00:00:00
BDB2053 Freeing read locks for locker 0xcd: 17326/140635147335424
BDB2053 Freeing read locks for locker 0xce: 17326/140635147335424
BDB2053 Freeing read locks for locker 0xcf: 17326/140635147335424
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : binutils-2.27-43.base.el7_8.1.x86_64                                                                                        1/2
  Cleanup    : binutils-2.25.1-22.base.el7.x86_64                                                                                          2/2
  Verifying  : binutils-2.27-43.base.el7_8.1.x86_64                                                                                        1/2
binutils-2.25.1-22.base.el7.x86_64 was supposed to be removed but is not!
  Verifying  : binutils-2.25.1-22.base.el7.x86_64                                                                                          2/2

Updated:
  binutils.x86_64 0:2.27-43.base.el7_8.1

Failed:
  binutils.x86_64 0:2.25.1-22.base.el7

Complete!

업데이트가 완료된 후 프로그램을 다시 컴파일하면 문제가 해결됩니다 .

추천

출처blog.csdn.net/qq_29695701/article/details/108760466