I am getting this error every time, while compiling programs, configuring and installing
some things like binutils, textinfo, etc..
/usr/local/bin/ld: this linker was not configured to use sysroots
collect2: error: ld returned 1 exit status
I want to know clearly about this. When will will come and what is the actual problem, and also how to solve it?
You can fix the errors by including the source code file that contains the definitions as part of the compilation. Alternatively, you can pass . obj files or . lib files that contain the definitions to the linker.
Linker errors occur when the linker is trying to put all the pieces of a program together to create an executable, and one or more pieces are missing. Typically, this can happen when an object file or libraries can't be found by the linker.
GCC uses a separate linker program (called ld.exe ) to perform the linking.
So when we try to assign it a value in the main function, the linker doesn't find the symbol and may result in an “unresolved external symbol” or “undefined reference”. The way to fix this error is to explicitly scope the variable using '::' outside the main before using it.
If you were attempting to install a version of binutils that should work alike the one found in /usr/bin
, you should know that
--sysroot=/
option.--sysroot
option.--sysroot
option will only be accepted by ld if binutils was configured with option --with-sysroot
.So, to cover this use-case, configure binutils with option --with-sysroot=/
.
Try to use gcc with the following option: gcc --sysroot=/usr/local
But, as the others told you in the comments, don't try to mess your system with critical packages such as the binutils
, except if you know what you are doing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With