:-1: error: collect2: fatal error: cannot find 'ld'
-
@sude
Since your RPi does not have thelocatecommand I suggested earlier, now try:find / -name ld -print 2>/dev/nulland show the output (better if you copy & paste the command run plus the output as text than show screen shots).
-
pi@raspberrypi:~ $ which ld
pi@raspberrypi:~ $ find / -name ld -print 2>/dev/null
/usr/bin/ld
/usr/lib/compat-ld/ld
/usr/lib/gold-ld/ld
/usr/share/doc/binutils/ld
pi@raspberrypi:~ $My terminal output is like that.
-
@sude
OK, hold on, that is strange.which ldshows noldexecutable on yourPATH.But the
findshows/usr/bin/ld. That should be both executable and on yourPATH.- Output from
ls -l /usr/bin/ld? - Output from
echo $PATH?
- Output from
-
pi@raspberrypi:~ $ ls -l /usr/bin/ld toplam 0I don't understand. The output should look something like mine under Ubuntu:
ls -l /usr/bin/ld lrwxrwxrwx 1 root root 19 Oct 20 12:09 /usr/bin/ld -> x86_64-linux-gnu-ldSince it's a soft link on mine and may be on yours, now try:
ls -lL /usr/bin/ld -rwxr-xr-x 1 root root 1740384 Oct 20 12:09 /usr/bin/ldon yours, please?
It is zero how can i echo :(
What is zero? On mine:
echo $PATH /home/jon/.local/bin:/home/jon/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin -
@sude said in :-1: error: collect2: fatal error: cannot find 'ld':
pi@raspberrypi:~ $ ls -l /usr/bin/ld
toplam 0Ah, hang on, that is indeed what you get if
/usr/bin/lsis an (empty) directory:mkdir empty ls -l empty total 0Maybe
toplammeanstotalin your language?!OK, that is indeed strange.
/usr/bin/ldshould be, or be a soft link to, an executable file, not a directory!Go back to the
findcommand. Assuming RPifindaccepts-ls, try:find / -name ld -ls 2>/dev/nullIf not try:
ls -ld `find / -name ld -print 2>/dev/null`Note those two
` ("backtick") characters, you will have to find that on your keyboard. -
@sude said in :-1: error: collect2: fatal error: cannot find 'ld':
pi@raspberrypi:~ $ ls -l /usr/bin/ld
toplam 0Ah, hang on, that is indeed what you get if
/usr/bin/lsis an (empty) directory:mkdir empty ls -l empty total 0Maybe
toplammeanstotalin your language?!OK, that is indeed strange.
/usr/bin/ldshould be, or be a soft link to, an executable file, not a directory!Go back to the
findcommand. Assuming RPifindaccepts-ls, try:find / -name ld -ls 2>/dev/nullIf not try:
ls -ld `find / -name ld -print 2>/dev/null`Note those two
` ("backtick") characters, you will have to find that on your keyboard.@JonB
pi@raspberrypi:~ $ find / -name ld -ls 2>/dev/null
300053 0 lrwxrwxrwx 1 root root 16 Şub 6 2020 /usr/lib/compat-ld/ld -> ../../bin/ld.bfd
300055 0 lrwxrwxrwx 1 root root 17 Şub 6 2020 /usr/lib/gold-ld/ld -> ../../bin/ld.gold
299210 4 drwxr-xr-x 2 root root 4096 Mar 5 2021 /usr/share/doc/binutils/ld
pi@raspberrypi:~ $ ls -ldfind / -name ld -print 2>/dev/null
lrwxrwxrwx 1 root root 16 Şub 6 2020 /usr/lib/compat-ld/ld -> ../../bin/ld.bfd
lrwxrwxrwx 1 root root 17 Şub 6 2020 /usr/lib/gold-ld/ld -> ../../bin/ld.gold
drwxr-xr-x 2 root root 4096 Mar 5 2021 /usr/share/doc/binutils/ld
pi@raspberrypi:~ $ -
@JonB
pi@raspberrypi:~ $ find / -name ld -ls 2>/dev/null
300053 0 lrwxrwxrwx 1 root root 16 Şub 6 2020 /usr/lib/compat-ld/ld -> ../../bin/ld.bfd
300055 0 lrwxrwxrwx 1 root root 17 Şub 6 2020 /usr/lib/gold-ld/ld -> ../../bin/ld.gold
299210 4 drwxr-xr-x 2 root root 4096 Mar 5 2021 /usr/share/doc/binutils/ld
pi@raspberrypi:~ $ ls -ldfind / -name ld -print 2>/dev/null
lrwxrwxrwx 1 root root 16 Şub 6 2020 /usr/lib/compat-ld/ld -> ../../bin/ld.bfd
lrwxrwxrwx 1 root root 17 Şub 6 2020 /usr/lib/gold-ld/ld -> ../../bin/ld.gold
drwxr-xr-x 2 root root 4096 Mar 5 2021 /usr/share/doc/binutils/ld
pi@raspberrypi:~ $@sude
Well, again I don't understand/am surprised at your output.Earlier your showed 4 matches for
ld, including/usr/bin/ld. Now you show only 3 matches, not including/usr/bin/ld. I don't know why....Last try:
ls -ld /usr/bin/ld?ls -lLd /usr/bin/ld?
Assuming those show it's a directory, or even that it does not exist, it does not look to me as though your RPi has
ldinstalled/properly installed. Earlier you saidsudo apt install -y build-essentialwas reporting "installed", but it doesn't feel right to me. Maybe you should try uninstall and reinstall, I don't know. I believe that untilwhich ldreturns an executable file path (e.g./usr/bin/ld) you are in a bad state. But I know nothing about RPi.... -
@sude
Well, again I don't understand/am surprised at your output.Earlier your showed 4 matches for
ld, including/usr/bin/ld. Now you show only 3 matches, not including/usr/bin/ld. I don't know why....Last try:
ls -ld /usr/bin/ld?ls -lLd /usr/bin/ld?
Assuming those show it's a directory, or even that it does not exist, it does not look to me as though your RPi has
ldinstalled/properly installed. Earlier you saidsudo apt install -y build-essentialwas reporting "installed", but it doesn't feel right to me. Maybe you should try uninstall and reinstall, I don't know. I believe that untilwhich ldreturns an executable file path (e.g./usr/bin/ld) you are in a bad state. But I know nothing about RPi.... -
Hi,
In that case you should maybe go with the nuclear option and restart from a clean installation on your RPi. As written by @JonB, if having installed build-essential does not give you all the tools, then there's likely something wrong with your system.
-
Hi,
In that case you should maybe go with the nuclear option and restart from a clean installation on your RPi. As written by @JonB, if having installed build-essential does not give you all the tools, then there's likely something wrong with your system.
-
@sude
Well, again I don't understand/am surprised at your output.Earlier your showed 4 matches for
ld, including/usr/bin/ld. Now you show only 3 matches, not including/usr/bin/ld. I don't know why....Last try:
ls -ld /usr/bin/ld?ls -lLd /usr/bin/ld?
Assuming those show it's a directory, or even that it does not exist, it does not look to me as though your RPi has
ldinstalled/properly installed. Earlier you saidsudo apt install -y build-essentialwas reporting "installed", but it doesn't feel right to me. Maybe you should try uninstall and reinstall, I don't know. I believe that untilwhich ldreturns an executable file path (e.g./usr/bin/ld) you are in a bad state. But I know nothing about RPi....@JonB said in :-1: error: collect2: fatal error: cannot find 'ld':
ls -lLd /usr/bin/ld
pi@raspberrypi:~ $ ls -ld /usr/bin/ld
ls: Could not access '/usr/bin/ld': No such file or directory
pi@raspberrypi:~ $ ls -lLd /usr/bin/ld
ls: Could not access '/usr/bin/ld': No such file or directory -
@sude show complete compile error with .pro file
-
@JonB said in :-1: error: collect2: fatal error: cannot find 'ld':
ls -lLd /usr/bin/ld
pi@raspberrypi:~ $ ls -ld /usr/bin/ld
ls: Could not access '/usr/bin/ld': No such file or directory
pi@raspberrypi:~ $ ls -lLd /usr/bin/ld
ls: Could not access '/usr/bin/ld': No such file or directory@sude said in :-1: error: collect2: fatal error: cannot find 'ld':
ls: Could not access '/usr/bin/ld': No such file or directoryEarlier (4 days ago above) you reported:
find / -name ld -print 2>/dev/null
/usr/bin/ldThen it disappeared.... Why?
I give up, because it seems to me you are not reporting a consistent situation. You or your file system seem to be changing while you are trying to sort this. Which sounds like you are making some changes/doing some actions you are not telling us about.
I have suggested you uninstall and reinstall the build development package. Maybe you should check again what is installed and what error you get now.
Plenty of other people succeed in doing development on an RPi. I believe the development package, or your base OS distro, should have
/usr/bin/ldas an executable file, that is the case under most Linuxes and seems to be what your build/make is expecting. I know no more than this about your situation. -
@sude said in :-1: error: collect2: fatal error: cannot find 'ld':
ls: Could not access '/usr/bin/ld': No such file or directoryEarlier (4 days ago above) you reported:
find / -name ld -print 2>/dev/null
/usr/bin/ldThen it disappeared.... Why?
I give up, because it seems to me you are not reporting a consistent situation. You or your file system seem to be changing while you are trying to sort this. Which sounds like you are making some changes/doing some actions you are not telling us about.
I have suggested you uninstall and reinstall the build development package. Maybe you should check again what is installed and what error you get now.
Plenty of other people succeed in doing development on an RPi. I believe the development package, or your base OS distro, should have
/usr/bin/ldas an executable file, that is the case under most Linuxes and seems to be what your build/make is expecting. I know no more than this about your situation. -
Then do things in a simpler fashion:
- restart from a clean image for your RPi
- install build-essential
- compile a dummy hello world cpp application
Once you have that working, continue the setup of the rest of the dependencies you need.
-
Hi, just want to add: I have an Raspberry with Raspbian 10 and Qt 5.11.3 and Qt Creator 4.8.2 installed on it, it works fine compiling some Qt programs.
I tried what @JonB suggested:
ls -lL /usr/bin/ldand I got this:
lrwxrwxrwx 1 root root 22 Feb 6 2020 /usr/bin/ld -> arm-linux-gnueabihf-ldSo try what @SGaist suggests: a clean install, then try @JonB's command again, it if shows something similar to my output above your good to go.
