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