Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. :-1: error: collect2: fatal error: cannot find 'ld'
Forum Updated to NodeBB v4.3 + New Features

:-1: error: collect2: fatal error: cannot find 'ld'

Scheduled Pinned Locked Moved Unsolved General and Desktop
34 Posts 8 Posters 10.8k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S sude

    @KroMignon It is rasbian and i am using raspberry pi 3 and i use qt creator in raspberry.

    JonBJ Offline
    JonBJ Offline
    JonB
    wrote on last edited by JonB
    #18

    @sude
    Since your RPi does not have the locate command I suggested earlier, now try:

    find / -name ld -print 2>/dev/null
    

    and show the output (better if you copy & paste the command run plus the output as text than show screen shots).

    S 1 Reply Last reply
    0
    • JonBJ JonB

      @sude
      Since your RPi does not have the locate command I suggested earlier, now try:

      find / -name ld -print 2>/dev/null
      

      and show the output (better if you copy & paste the command run plus the output as text than show screen shots).

      S Offline
      S Offline
      sude
      wrote on last edited by
      #19

      @JonB

      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.

      JonBJ 1 Reply Last reply
      0
      • S sude

        @JonB

        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.

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #20

        @sude
        OK, hold on, that is strange.

        which ld shows no ld executable on your PATH.

        But the find shows /usr/bin/ld. That should be both executable and on your PATH.

        • Output from ls -l /usr/bin/ld?
        • Output from echo $PATH?
        S 1 Reply Last reply
        0
        • JonBJ JonB

          @sude
          OK, hold on, that is strange.

          which ld shows no ld executable on your PATH.

          But the find shows /usr/bin/ld. That should be both executable and on your PATH.

          • Output from ls -l /usr/bin/ld?
          • Output from echo $PATH?
          S Offline
          S Offline
          sude
          wrote on last edited by
          #21

          @JonB
          pi@raspberrypi:~ $ ls -l /usr/bin/ld
          toplam 0

          It is zero how can i echo :(

          JonBJ 2 Replies Last reply
          0
          • S sude

            @JonB
            pi@raspberrypi:~ $ ls -l /usr/bin/ld
            toplam 0

            It is zero how can i echo :(

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by
            #22

            @sude

            pi@raspberrypi:~ $ ls -l /usr/bin/ld
            toplam 0
            

            I 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-ld
            

            Since 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/ld
            

            on 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
            
            1 Reply Last reply
            0
            • S sude

              @JonB
              pi@raspberrypi:~ $ ls -l /usr/bin/ld
              toplam 0

              It is zero how can i echo :(

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by JonB
              #23

              @sude said in :-1: error: collect2: fatal error: cannot find 'ld':

              pi@raspberrypi:~ $ ls -l /usr/bin/ld
              toplam 0

              Ah, hang on, that is indeed what you get if /usr/bin/ls is an (empty) directory:

              mkdir empty
              ls -l empty
              total 0
              

              Maybe toplam means total in your language?!

              OK, that is indeed strange. /usr/bin/ld should be, or be a soft link to, an executable file, not a directory!

              Go back to the find command. Assuming RPi find accepts -ls, try:

              find / -name ld -ls 2>/dev/null
              

              If 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.

              S 1 Reply Last reply
              0
              • JonBJ JonB

                @sude said in :-1: error: collect2: fatal error: cannot find 'ld':

                pi@raspberrypi:~ $ ls -l /usr/bin/ld
                toplam 0

                Ah, hang on, that is indeed what you get if /usr/bin/ls is an (empty) directory:

                mkdir empty
                ls -l empty
                total 0
                

                Maybe toplam means total in your language?!

                OK, that is indeed strange. /usr/bin/ld should be, or be a soft link to, an executable file, not a directory!

                Go back to the find command. Assuming RPi find accepts -ls, try:

                find / -name ld -ls 2>/dev/null
                

                If 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.

                S Offline
                S Offline
                sude
                wrote on last edited by
                #24

                @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 -ld find / -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:~ $

                JonBJ 1 Reply Last reply
                0
                • S sude

                  @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 -ld find / -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:~ $

                  JonBJ Offline
                  JonBJ Offline
                  JonB
                  wrote on last edited by
                  #25

                  @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 ld installed/properly installed. Earlier you said sudo apt install -y build-essential was reporting "installed", but it doesn't feel right to me. Maybe you should try uninstall and reinstall, I don't know. I believe that until which ld returns an executable file path (e.g. /usr/bin/ld) you are in a bad state. But I know nothing about RPi....

                  S 2 Replies Last reply
                  0
                  • JonBJ JonB

                    @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 ld installed/properly installed. Earlier you said sudo apt install -y build-essential was reporting "installed", but it doesn't feel right to me. Maybe you should try uninstall and reinstall, I don't know. I believe that until which ld returns an executable file path (e.g. /usr/bin/ld) you are in a bad state. But I know nothing about RPi....

                    S Offline
                    S Offline
                    sude
                    wrote on last edited by
                    #26

                    @JonB Thank you for your help but it cant be solved. :(

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #27

                      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.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      S 1 Reply Last reply
                      1
                      • SGaistS SGaist

                        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.

                        S Offline
                        S Offline
                        sude
                        wrote on last edited by
                        #28

                        @SGaist I tried it too but it didnt work. I dont know what i do wrong.

                        1 Reply Last reply
                        0
                        • JonBJ JonB

                          @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 ld installed/properly installed. Earlier you said sudo apt install -y build-essential was reporting "installed", but it doesn't feel right to me. Maybe you should try uninstall and reinstall, I don't know. I believe that until which ld returns an executable file path (e.g. /usr/bin/ld) you are in a bad state. But I know nothing about RPi....

                          S Offline
                          S Offline
                          sude
                          wrote on last edited by
                          #29

                          @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

                          JonBJ 1 Reply Last reply
                          0
                          • S sude

                            @jsulm Actually I did not use cross compile and my program features like that.

                            6086cf1a-3da1-4d07-a5ca-15002f50d9f2-image.png

                            A Offline
                            A Offline
                            anil_arise
                            wrote on last edited by
                            #30

                            @sude show complete compile error with .pro file

                            1 Reply Last reply
                            0
                            • S sude

                              @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

                              JonBJ Offline
                              JonBJ Offline
                              JonB
                              wrote on last edited by
                              #31

                              @sude said in :-1: error: collect2: fatal error: cannot find 'ld':

                              ls: Could not access '/usr/bin/ld': No such file or directory

                              Earlier (4 days ago above) you reported:

                              find / -name ld -print 2>/dev/null
                              /usr/bin/ld

                              Then 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/ld as 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.

                              S 1 Reply Last reply
                              0
                              • JonBJ JonB

                                @sude said in :-1: error: collect2: fatal error: cannot find 'ld':

                                ls: Could not access '/usr/bin/ld': No such file or directory

                                Earlier (4 days ago above) you reported:

                                find / -name ld -print 2>/dev/null
                                /usr/bin/ld

                                Then 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/ld as 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.

                                S Offline
                                S Offline
                                sude
                                wrote on last edited by
                                #32

                                @JonB Thank you for your help this is complicated situation and i tried diffirent things so much. If i directed to wrong way please forgive me and again thank you for your help.

                                1 Reply Last reply
                                0
                                • SGaistS Offline
                                  SGaistS Offline
                                  SGaist
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #33

                                  Then do things in a simpler fashion:

                                  1. restart from a clean image for your RPi
                                  2. install build-essential
                                  3. compile a dummy hello world cpp application

                                  Once you have that working, continue the setup of the rest of the dependencies you need.

                                  Interested in AI ? www.idiap.ch
                                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  1 Reply Last reply
                                  0
                                  • hskoglundH Offline
                                    hskoglundH Offline
                                    hskoglund
                                    wrote on last edited by
                                    #34

                                    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/ld and I got this:
                                    lrwxrwxrwx 1 root root 22 Feb 6 2020 /usr/bin/ld -> arm-linux-gnueabihf-ld

                                    So 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.

                                    1 Reply Last reply
                                    1

                                    • Login

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular
                                    • Users
                                    • Groups
                                    • Search
                                    • Get Qt Extensions
                                    • Unsolved