Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qt6 Raspberry Pi cross compliation error.

Qt6 Raspberry Pi cross compliation error.

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
19 Posts 11 Posters 6.6k Views
  • 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.
  • H Offline
    H Offline
    H0rBIe
    wrote on 25 Nov 2022, 09:59 last edited by
    #9

    Hello,

    I also came across this problem. I tried compiling everything with the GCC 10 version which is installed on my RPI. I will give the older Linux version a try using an old Notebook. I am also not very deep into compiler dependencies, so hopefully this also works for me.

    BR

    1 Reply Last reply
    0
    • R rickiewars
      6 Oct 2022, 08:48

      @shuchun Temporary solution:

      I've fixed the latest issue. The last issue was due to my rpi-sysroot symlink repair not done correctly.
      Make sure with fixing the symlinks, you use the following commands:

      $ wget https://raw.githubusercontent.com/riscv/riscv-poky/master/scripts/sysroot-relativelinks.py
      $ chmod +x sysroot-relativelinks.py 
      $ python3 sysroot-relativelinks.py $TARGET_SYSROOT
      

      The temporary solution on the original issue for me was downgrading the host to an Ubuntu 20.04 based distro.
      Looks like we'll have to deal with the older distro untill the Qt devs solve this issue with the newer 22.04 version.
      I suspect that the issue is caused by a mismatch between GCC (and gLibC) versions on the Pi and the Host but I'm not sure about that. Alternatively, you can try to update the GCC and GLibC versions on the Raspberry Pi.

      K Offline
      K Offline
      Kumi
      wrote on 25 Dec 2022, 14:37 last edited by
      #10

      @rickiewars I have encountered all the problems mentioned in the thread. Your posts were very helpful, I managed to compile and run QT on my RPI4. The sysroot-relativelinks.py fixed the problem with dbus and upgrading the GCC on my rpi to gcc-11, solved the problem with undefined references.

      D 1 Reply Last reply 5 Jan 2023, 14:54
      0
      • K Kumi
        25 Dec 2022, 14:37

        @rickiewars I have encountered all the problems mentioned in the thread. Your posts were very helpful, I managed to compile and run QT on my RPI4. The sysroot-relativelinks.py fixed the problem with dbus and upgrading the GCC on my rpi to gcc-11, solved the problem with undefined references.

        D Offline
        D Offline
        Dane 0
        wrote on 5 Jan 2023, 14:54 last edited by
        #11

        @Kumi How did you upgrade to gcc-11 on your RPi? I've tried using the gcc10 cross compiler on Ubuntu 22.04 (sudo apt install gcc-10-aarch64-linux-gnu g++-10-aarch64-linux-gnu) however this didn't help.

        M 1 Reply Last reply 24 Jan 2023, 16:56
        0
        • D Offline
          D Offline
          davethomas_again
          wrote on 17 Jan 2023, 12:55 last edited by
          #12

          Same errors.

          I used

          symlinks -rc rpi-sysroot
          

          Is sysroot-relativelinks.py different so that I need to use it instead?

          Kumi,

          How does changing the compiler on the rpi help? That won't change the libraries on the Bullseye distribution that seem to be the issue.

          Thanks!

          D 1 Reply Last reply 17 Jan 2023, 14:39
          0
          • D davethomas_again
            17 Jan 2023, 12:55

            Same errors.

            I used

            symlinks -rc rpi-sysroot
            

            Is sysroot-relativelinks.py different so that I need to use it instead?

            Kumi,

            How does changing the compiler on the rpi help? That won't change the libraries on the Bullseye distribution that seem to be the issue.

            Thanks!

            D Offline
            D Offline
            davethomas_again
            wrote on 17 Jan 2023, 14:39 last edited by
            #13

            @davethomas_again

            There does seem to be a difference in what the symlinks (that's built into Ubuntu) does versus the sysroots-relativelinks.py script.

            I deleted all the sysroot files, and redid the rsync. Deleted everything in the build folders and redid the configure.

            It's still compiling---3000 out of 8066 files. I'm pretty sure that's beyond where it was failing for dbus issues.

            I guess I'll get to the unresolved references issue. Is the theory that the libc needs to be rebuilt with a compatible compiler on the rpi, then rsync'ed back to the host machine? Obviously, nothing you do on the rpi will help the build on the host--unless you copy files over from the rpi into sysroot.

            Right?

            1 Reply Last reply
            0
            • D Offline
              D Offline
              davethomas_again
              wrote on 17 Jan 2023, 19:43 last edited by
              #14

              Yes, same place.

              Down to the link phase, now get the unresolved externals.

              I tried /usr/bin/aarch64-linux-gnu-gcc-11 and -9. (and same g++). My rpi Bullseye has gcc and g++ 10.2.1 20210110.

              So, one gcc release earlier and one later.

              Anyone have a cross-compiler known to work?

              1 Reply Last reply
              0
              • D Offline
                D Offline
                davethomas_again
                wrote on 18 Jan 2023, 12:45 last edited by davethomas_again
                #15

                I've tried gcc-9, -10, and -11. I get the same unresolved externals at link time like this:

                usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld: /home/dave/rpi-sysroot/lib/aarch64-linux-gnu/libpthread.so.0: undefined reference to `_dl_make_stack_executable@GLIBC_PRIVATE'
                /usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld: /home/dave/rpi-sysroot/lib/aarch64-linux-gnu/libpthread.so.0: undefined reference to `__libc_dlclose@GLIBC_PRIVATE'
                /usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld: /home/dave/rpi-sysroot/lib/aarch64-linux-gnu/libpthread.so.0: undefined reference to `__libc_dlopen_mode@GLIBC_PRIVATE'
                /usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld: /home/dave/rpi-sysroot/lib/aarch64-linux-gnu/libpthread.so.0: undefined reference to `__libc_longjmp@GLIBC_PRIVATE'
                /usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld: /home/dave/rpi-sysroot/lib/aarch64-linux-gnu/libpthread.so.0: undefined reference to `__libc_allocate_rtsig_private@GLIBC_PRIVATE'
                /usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld: /home/dave/rpi-sysroot/lib/aarch64-linux-gnu/libpthread.so.0: undefined reference to `__libc_thread_freeres@GLIBC_PRIVATE'
                /usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld: /home/dave/rpi-sysroot/lib/aarch64-linux-gnu/libdl.so.2: undefined reference to `_dl_addr@GLIBC_PRIVATE'
                /usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld: /home/dave/rpi-sysroot/lib/aarch64-linux-gnu/libpthread.so.0: undefined reference to `__libc_pthread_init@GLIBC_PRIVATE'
                /usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld: /home/dave/rpi-sysroot/lib/aarch64-linux-gnu/libpthread.so.0: undefined reference to `__libc_current_sigrtmin_private@GLIBC_PRIVATE'
                /usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld: /home/dave/rpi-sysroot/lib/aarch64-linux-gnu/libdl.so.2: undefined reference to `_dl_sym@GLIBC_PRIVATE'
                /usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld: /home/dave/rpi-sysroot/lib/aarch64-linux-gnu/libpthread.so.0: undefined reference to `__libc_dlsym@GLIBC_PRIVATE'
                /usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld: /home/dave/rpi-sysroot/lib/aarch64-linux-gnu/libpthread.so.0: undefined reference to `__libc_current_sigrtmax_private@GLIBC_PRIVATE'
                /usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld: /home/dave/rpi-sysroot/lib/aarch64-linux-gnu/libdl.so.2: undefined reference to `_dl_vsym@GLIBC_PRIVATE'
                collect2: error: ld returned 1 exit status
                

                @rickiewars

                You said:

                Downgrading to an Ubuntu 20.04 based distro solved this first issue for me

                Do you know what gcc and g++ compiler you used? If I was sure that 20.04 would resolve, I'd start over. But, that's a lot of work and I think only the toolchain matters.

                Thanks!

                1 Reply Last reply
                0
                • D Dane 0
                  5 Jan 2023, 14:54

                  @Kumi How did you upgrade to gcc-11 on your RPi? I've tried using the gcc10 cross compiler on Ubuntu 22.04 (sudo apt install gcc-10-aarch64-linux-gnu g++-10-aarch64-linux-gnu) however this didn't help.

                  M Offline
                  M Offline
                  Maxxi
                  wrote on 24 Jan 2023, 16:56 last edited by
                  #16

                  @Dane-0 I had the same problem with Ubuntu 22.04 and Qt6. Using gcc-11 on raspberry pi solved the issue. However, you need to cross compile the gcc-11 for the raspberry pi. To do so, first you need to set up a cross compiler using the same version of glibc, binutils, and gcc that you have on your raspberry pi system. This link is exactly what you need to do:
                  https://solarianprogrammer.com/2018/05/06/building-gcc-cross-compiler-raspberry-pi/

                  Follow the instruction in this tutorial exactly, and finally add these paths to your LD_LIBRARY_PATH variable on your pi:
                  /path/to/gcc-11/lib
                  /path/to/gcc-11/lib64

                  I hope this will help you.

                  D 1 Reply Last reply 28 Jan 2023, 15:32
                  0
                  • M Maxxi
                    24 Jan 2023, 16:56

                    @Dane-0 I had the same problem with Ubuntu 22.04 and Qt6. Using gcc-11 on raspberry pi solved the issue. However, you need to cross compile the gcc-11 for the raspberry pi. To do so, first you need to set up a cross compiler using the same version of glibc, binutils, and gcc that you have on your raspberry pi system. This link is exactly what you need to do:
                    https://solarianprogrammer.com/2018/05/06/building-gcc-cross-compiler-raspberry-pi/

                    Follow the instruction in this tutorial exactly, and finally add these paths to your LD_LIBRARY_PATH variable on your pi:
                    /path/to/gcc-11/lib
                    /path/to/gcc-11/lib64

                    I hope this will help you.

                    D Offline
                    D Offline
                    davethomas_again
                    wrote on 28 Jan 2023, 15:32 last edited by
                    #17

                    @Maxxi

                    Thanks!

                    I punted and downgraded to Ubuntu 20. When I get a chance, I'll try again on 22.

                    1 Reply Last reply
                    0
                    • C Offline
                      C Offline
                      Christian Niekler
                      wrote on 23 Oct 2023, 09:53 last edited by Christian Niekler
                      #18

                      Is there any progress on this? Did anyone solve this? I am having the same issue. I am using the Cross-Compile Qt6 for Raspberry Pi documentation. Host Ubuntu 22.04, Target Raspberry Pi Bookworm. I can Build for the Host, and can also configure it for the Target without issues, but when I try to build it for target I always get the issue FAILED qtbase/libQt6DBus.so.6.5.3. I am using aarch64-linux-gnu-g++-11.

                      ninja --version
                      1.10.1
                      cmake --version
                      cmake version 3.28.20231020-g35c7e23 (self build)

                      EDIT:
                      On my Raspberry I have gcc --version -> 12.2.0. Maybe I should use the version 12 cross compiler as well.

                      1 Reply Last reply
                      0
                      • N Offline
                        N Offline
                        Nobuddy
                        wrote on 25 Oct 2024, 22:42 last edited by
                        #19

                        I'm aware this is ancient history but I was running into this problem as well (I've corrected it) and feel it necessary to add a bit more context and my analysis of what I think is happening. Tl;dr I was able to correct the aforementioned error by running the sysroot-relativesymlinks.py script mentioned above, re-running the configure, and rebuilding.

                        As noted previously, symlinks doesn't quite fix everything and I also had to use the Python symlink script. What I noticed, though, after running symlinks the first time is that a few shared libraries (such as Dbus) were not being correctly re-linked. Specifically:

                        aaron@AUSTIN:~$ ls -l rpi-sysroot/lib/aarch64-linux-gnu/libdbus*
                        -rw-r--r-- 1 aaron aaron 785514 Sep 16  2023 rpi-sysroot/lib/aarch64-linux-gnu/libdbus-1.a
                        lrwxrwxrwx 1 aaron aaron     42 Sep 16  2023 rpi-sysroot/lib/aarch64-linux-gnu/libdbus-1.so -> /lib/aarch64-linux-gnu/libdbus-1.so.3.32.4
                        lrwxrwxrwx 1 aaron aaron     19 Sep 16  2023 rpi-sysroot/lib/aarch64-linux-gnu/libdbus-1.so.3 -> libdbus-1.so.3.32.4
                        -rw-r--r-- 1 aaron aaron 395336 Sep 16  2023 rpi-sysroot/lib/aarch64-linux-gnu/libdbus-1.so.3.32.4
                        

                        Notice how libdbus-1.so is still pointing to my system's (aarch64) version of libdbus, which also did not exist, since my system is x86_64 -- so the link itself was bad. So just a reminder to ensure that all of the links in your sysroot do not point to anything outside of that sysroot.

                        Hopefully this helps any Googler in the future.

                        1 Reply Last reply
                        0

                        • Login

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