Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. QT 5.10 Cross Compilation raspberry Pi Issue cannot find crt1.o & cannot find -lm
Forum Updated to NodeBB v4.3 + New Features

QT 5.10 Cross Compilation raspberry Pi Issue cannot find crt1.o & cannot find -lm

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
14 Posts 7 Posters 6.9k Views 5 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.
  • sierdzioS Offline
    sierdzioS Offline
    sierdzio
    Moderators
    wrote on last edited by
    #2

    Try setting the CROSS_COMPILE to x64:

    -device-option CROSS_COMPILE=~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-
    

    Because otherwise it all looks good. Or maybe your toolchain is broken.

    (Z(:^

    1 Reply Last reply
    3
    • Q Offline
      Q Offline
      qt_help
      wrote on last edited by
      #3

      Tried with -x64 still same

      /home/nbabu/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++ -c -march=armv8-a -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard --sysroot=/home/nbabu/raspi/sysroot -O2 -std=gnu++11 -w -fPIC -I. -I/home/nbabu/raspi/qtbase/mkspecs/devices/linux-rasp-pi3-g++ -o verifyspec.o verifyspec.cpp

      /home/nbabu/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++ -mfloat-abi=hard --sysroot=/home/nbabu/raspi/sysroot -Wl,-O1 -Wl,-rpath-link,/home/nbabu/raspi/sysroot/opt/vc/lib -Wl,-rpath-link,/home/nbabu/raspi/sysroot/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/home/nbabu/raspi/sysroot/lib/arm-linux-gnueabihf -o verifyspec verifyspec.o
      /home/nbabu/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find crt1.o: No such file or directory
      /home/nbabu/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find crti.o: No such file or directory
      /home/nbabu/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lm
      collect2: error: ld returned 1 exit status
      Makefile:66: recipe for target 'verifyspec' failed
      make: *** [verifyspec] Error 1
      Note: Also available for Linux: linux-clang linux-icc

      zhmhZ 1 Reply Last reply
      0
      • sierdzioS Offline
        sierdzioS Offline
        sierdzio
        Moderators
        wrote on last edited by
        #4

        Then it is a broken toolchain or sysroot. Make sure you have all the dependencies installed on Raspbian and run sysroot + symlink fix on your toolchain. Then git pull in your toolchain dir to make sure it's up to date.

        (Z(:^

        1 Reply Last reply
        2
        • S Offline
          S Offline
          sefer
          wrote on last edited by sefer
          #5

          Hi,

          may you have to execute rsync on ~/raspi folder
          raspberrypi.local is the ip of the pi3, example 192.168.1.10

          mkdir sysroot sysroot/usr sysroot/opt
          rsync -avz pi@raspberrypi.local:/lib sysroot
          rsync -avz pi@raspberrypi.local:/usr/include sysroot/usr
          rsync -avz pi@raspberrypi.local:/usr/lib sysroot/usr
          rsync -avz pi@raspberrypi.local:/opt/vc sysroot/opt

          1 Reply Last reply
          1
          • Q qt_help

            Tried with -x64 still same

            /home/nbabu/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++ -c -march=armv8-a -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard --sysroot=/home/nbabu/raspi/sysroot -O2 -std=gnu++11 -w -fPIC -I. -I/home/nbabu/raspi/qtbase/mkspecs/devices/linux-rasp-pi3-g++ -o verifyspec.o verifyspec.cpp

            /home/nbabu/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++ -mfloat-abi=hard --sysroot=/home/nbabu/raspi/sysroot -Wl,-O1 -Wl,-rpath-link,/home/nbabu/raspi/sysroot/opt/vc/lib -Wl,-rpath-link,/home/nbabu/raspi/sysroot/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/home/nbabu/raspi/sysroot/lib/arm-linux-gnueabihf -o verifyspec verifyspec.o
            /home/nbabu/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find crt1.o: No such file or directory
            /home/nbabu/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find crti.o: No such file or directory
            /home/nbabu/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lm
            collect2: error: ld returned 1 exit status
            Makefile:66: recipe for target 'verifyspec' failed
            make: *** [verifyspec] Error 1
            Note: Also available for Linux: linux-clang linux-icc

            zhmhZ Offline
            zhmhZ Offline
            zhmh
            wrote on last edited by
            #6

            @qt_help as @sefer said the sysroot folder should be create and rsysc in the ~/raspi address

            1 Reply Last reply
            0
            • A Offline
              A Offline
              ab_en
              wrote on last edited by
              #7

              Any known solutions to this? Why is rsync necessary for correct build?

              jsulmJ 1 Reply Last reply
              0
              • A ab_en

                Any known solutions to this? Why is rsync necessary for correct build?

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #8

                @ab_en said in QT 5.10 Cross Compilation raspberry Pi Issue cannot find crt1.o & cannot find -lm:

                Why is rsync necessary for correct build?

                To synchronise the sysroot (which is basically copy of the RPi file system).
                Strictly speaking rsync is not necessary, you can simply copy the content of /usr from your RPi to your host machine. But rsync is convenient to synchronise the sysroot if you change something on RPi.

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                A 1 Reply Last reply
                0
                • jsulmJ jsulm

                  @ab_en said in QT 5.10 Cross Compilation raspberry Pi Issue cannot find crt1.o & cannot find -lm:

                  Why is rsync necessary for correct build?

                  To synchronise the sysroot (which is basically copy of the RPi file system).
                  Strictly speaking rsync is not necessary, you can simply copy the content of /usr from your RPi to your host machine. But rsync is convenient to synchronise the sysroot if you change something on RPi.

                  A Offline
                  A Offline
                  ab_en
                  wrote on last edited by
                  #9

                  @jsulm Ok! I was able to copy the the usr/ folder from the RPi and I got through that issue, but now it is saying the file or file format is not recognized:

                  > /home/abenezerargaw/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++ -mfloat-abi=hard --sysroot=/home/abenezerargaw/raspi/sysroot -Wl,-O1 -Wl,-rpath-link,/home/abenezerargaw/raspi/sysroot/opt/vc/lib -Wl,-rpath-link,/home/abenezerargaw/raspi/sysroot/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/home/abenezerargaw/raspi/sysroot/lib/arm-linux-gnueabihf -o verifyspec verifyspec.o      
                  > /home/abenezerargaw/raspi/sysroot/usr/lib/crt1.o: file not recognized: File format not recognized
                  > collect2: error: ld returned 1 exit status
                  > Makefile:68: recipe for target 'verifyspec' failed
                  > gmake: *** [verifyspec] Error 1
                  Note: Also available for Linux: linux-clang linux-icc
                  
                  ERROR: Cannot compile a minimal program. The toolchain or QMakeSpec is broken.
                  
                  

                  I assume I would need to rebuild the file but I am unsure how to do this. Any suggestions or guidance? (the more detailed the better! -- Thank you in advance)

                  A sierdzioS 2 Replies Last reply
                  0
                  • A ab_en

                    @jsulm Ok! I was able to copy the the usr/ folder from the RPi and I got through that issue, but now it is saying the file or file format is not recognized:

                    > /home/abenezerargaw/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++ -mfloat-abi=hard --sysroot=/home/abenezerargaw/raspi/sysroot -Wl,-O1 -Wl,-rpath-link,/home/abenezerargaw/raspi/sysroot/opt/vc/lib -Wl,-rpath-link,/home/abenezerargaw/raspi/sysroot/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/home/abenezerargaw/raspi/sysroot/lib/arm-linux-gnueabihf -o verifyspec verifyspec.o      
                    > /home/abenezerargaw/raspi/sysroot/usr/lib/crt1.o: file not recognized: File format not recognized
                    > collect2: error: ld returned 1 exit status
                    > Makefile:68: recipe for target 'verifyspec' failed
                    > gmake: *** [verifyspec] Error 1
                    Note: Also available for Linux: linux-clang linux-icc
                    
                    ERROR: Cannot compile a minimal program. The toolchain or QMakeSpec is broken.
                    
                    

                    I assume I would need to rebuild the file but I am unsure how to do this. Any suggestions or guidance? (the more detailed the better! -- Thank you in advance)

                    A Offline
                    A Offline
                    ab_en
                    wrote on last edited by
                    #10

                    @ab_en @sierdzio

                    1 Reply Last reply
                    0
                    • A ab_en

                      @jsulm Ok! I was able to copy the the usr/ folder from the RPi and I got through that issue, but now it is saying the file or file format is not recognized:

                      > /home/abenezerargaw/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++ -mfloat-abi=hard --sysroot=/home/abenezerargaw/raspi/sysroot -Wl,-O1 -Wl,-rpath-link,/home/abenezerargaw/raspi/sysroot/opt/vc/lib -Wl,-rpath-link,/home/abenezerargaw/raspi/sysroot/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/home/abenezerargaw/raspi/sysroot/lib/arm-linux-gnueabihf -o verifyspec verifyspec.o      
                      > /home/abenezerargaw/raspi/sysroot/usr/lib/crt1.o: file not recognized: File format not recognized
                      > collect2: error: ld returned 1 exit status
                      > Makefile:68: recipe for target 'verifyspec' failed
                      > gmake: *** [verifyspec] Error 1
                      Note: Also available for Linux: linux-clang linux-icc
                      
                      ERROR: Cannot compile a minimal program. The toolchain or QMakeSpec is broken.
                      
                      

                      I assume I would need to rebuild the file but I am unsure how to do this. Any suggestions or guidance? (the more detailed the better! -- Thank you in advance)

                      sierdzioS Offline
                      sierdzioS Offline
                      sierdzio
                      Moderators
                      wrote on last edited by
                      #11

                      @ab_en said in QT 5.10 Cross Compilation raspberry Pi Issue cannot find crt1.o & cannot find -lm:

                      raspbian-x64

                      Do you have 64b Raspbian installed on that RPi? If not, then you should not compile your Qt using 64b compiler.

                      (Z(:^

                      A 1 Reply Last reply
                      1
                      • sierdzioS sierdzio

                        @ab_en said in QT 5.10 Cross Compilation raspberry Pi Issue cannot find crt1.o & cannot find -lm:

                        raspbian-x64

                        Do you have 64b Raspbian installed on that RPi? If not, then you should not compile your Qt using 64b compiler.

                        A Offline
                        A Offline
                        ab_en
                        wrote on last edited by
                        #12

                        @sierdzio Yes, I am running Poky Yocto Project Distribution image for RPi4 64b

                        A Pablo J. RoginaP 2 Replies Last reply
                        0
                        • A ab_en

                          @sierdzio Yes, I am running Poky Yocto Project Distribution image for RPi4 64b

                          A Offline
                          A Offline
                          ab_en
                          wrote on last edited by
                          #13

                          @ab_en same issue persists if non 64b selected fyi

                          1 Reply Last reply
                          0
                          • A ab_en

                            @sierdzio Yes, I am running Poky Yocto Project Distribution image for RPi4 64b

                            Pablo J. RoginaP Offline
                            Pablo J. RoginaP Offline
                            Pablo J. Rogina
                            wrote on last edited by
                            #14

                            @ab_en said in QT 5.10 Cross Compilation raspberry Pi Issue cannot find crt1.o & cannot find -lm:

                            Poky Yocto Project Distribution image for RPi4 64b

                            So are you sure the cross-compiler you use (i.e. ~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-) which seems to come from Rasbperry Foundation repo is Ok/compatible with such OS/distribution?

                            Upvote the answer(s) that helped you solve the issue
                            Use "Topic Tools" button to mark your post as Solved
                            Add screenshots via postimage.org
                            Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                            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