Binutils usage error: This linker was not configured to use sysrootscollect2: LD returned 1 exit status

Source: Internet
Author: User


Binutils error. When using gcc-O to connect to the target file, the following error occurs:/usr/local/bin/ld: This linker was not configured to use sysrootscollect2: LD returned 1 exit status.


The following error is reported: C compiler cannot create executables.


This may be because there is another version of GNU linker lD that does not match in your/usr/local/bin directory,

At the same time, your environment variables set/usr/local/bin before/usr/bin, or do not set the environment variable that follows. The system first finds the LD under the/usr/local/bin directory when looking for the execution file based on the environment variables. This LD version does not match, so an error is reported. Solution: you only need to set the/usr/bin environment variable to the front, and the system first finds the LD under this directory. Command: Export Path = "/usr/bin: $ path" (I have also done the following: First go to/home/(username) in terminal) /tool/binutils-2.16 (depending on your own version) and then execute the command :. /configure -- With-sysroots this is not mandatory) Note: The above modification is only valid for the current terminal. Another method is to change the LD name in/usr/local/bin. In this way, the system cannot find the LD in the path/usr/local/bin, and will naturally execute the next one, that is, the default/usr/bin environment variable of LD in/usr/bin is after the/usr/local/bin environment variable, the first method is to temporarily adjust the/usr/bin environment variables. Command: sudo mV/usr/local/bin/LD/usr/local/bin/ldxxxx
(Note: Remember that you have made this change. Otherwise, the next time you forget to make this change due to this problem, you will not be able to break your head .)


PS: view the currently set environment variable: export $ path


Set environment variables:

Cd ~

Ls. Pro *. Bash *

Gedit. Profile

In this way, you can open the. profile file and add environment variables to it.

Binutils usage error: This linker was not configured to use sysrootscollect2: LD returned 1 exit status

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.