Results 1 to 3 of 3

Thread: Cross compiling qt6 for RPI 64 bit (aarch64)

  1. #1
    Join Date
    Jun 2012
    Posts
    219
    Thanks
    28
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Cross compiling qt6 for RPI 64 bit (aarch64)

    I'm trying to cross compile qt6 for Bullseye on an Ubuntu 22.04.

    Everything compiles, but I seeing unresolved externals that (I think) should be in clib:
    Qt Code:
    1. /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'
    2. /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'
    3. /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'
    4. /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'
    5. /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'
    6. /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'
    7. /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'
    8. /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'
    9. /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'
    10. /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'
    11. /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'
    12. /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'
    13. /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'
    To copy to clipboard, switch view to plain text mode 

    Another forum has a post saying that this is probably due to a mismatch between the cross-compiler on Ubuntu and the rpi.

    Here's what's on the pi:

    Qt Code:
    1. pi@raspberrypi:~ $ g++ --version
    2. g++ (Debian 10.2.1-6) 10.2.1 20210110
    To copy to clipboard, switch view to plain text mode 

    Here's what I have in the "toolchain.cmake":

    Qt Code:
    1. set(CMAKE_C_COMPILER /usr/bin/aarch64-linux-gnu-gcc-10)
    2. set(CMAKE_CXX_COMPILER /usr/bin/aarch64-linux-gnu-g++-10)
    To copy to clipboard, switch view to plain text mode 

    I've also tried the -9 and -11 versions of gcc and g++, but get the same errors.

    The poster said he solved the error by downgrading the Ubuntu host to 20.x. I'd do that, if I thought it would work, but seems like I should be able to use the same cross-compiler.

    Three questions:

    1) Are the unresolved externals indeed (likely) due to an incompatible C run time used by the cross-compiler?
    2) What cross compiler toolchain should I use?
    3) What cross compiler is available for cross-compiling on Ubuntu 20 (if any) that's not on Ubuntu 22?

    Here's the guide I've been using:

    https://wiki.qt.io/Cross-Compile_Qt_6_for_Raspberry_Pi
    Thanks!

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,246
    Thanks
    303
    Thanked 866 Times in 853 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Cross compiling qt6 for RPI 64 bit (aarch64)

    I do not know if this is the cause, but unlike in Windows with Microsoft compilers, the order of modules specified in the linker command matters in linux / gcc. If any module depends on references defined in another module, the module that resolves the dependency must come after the module that needs it on the command line.

    I pounded my head on the wall for some time trying to get something to link before I learned this nugget.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Jun 2012
    Posts
    219
    Thanks
    28
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Cross compiling qt6 for RPI 64 bit (aarch64)

    Quote Originally Posted by d_stranz View Post
    I do not know if this is the cause, but unlike in Windows with Microsoft compilers, the order of modules specified in the linker command matters in linux / gcc. If any module depends on references defined in another module, the module that resolves the dependency must come after the module that needs it on the command line.

    I pounded my head on the wall for some time trying to get something to link before I learned this nugget.
    I don't understand why, but starting over with host Ubuntu 20.04 works fine.

    Someone posted that on another forum, but that didn't make sense to me. And, since it takes a LONG time to recompile everything that's needed to get to the link stage, I was hesitant to even try. Seemed like all I should need was the right toolchain.

    But, spent a couple of days trying various gcc and g++ versions, including the version on the target (Bullseye aarch rpi) and the version on Ubuntu 20.04 on the Ubuntu 22 host.

    I followed the guide exactly--on Ubuntu 22 there were several issues I was able to work-around just to get to the "show-stopper" at link time.

    On Ubuntu 20.04, worked first time, zero issues!

    Go figure.

Similar Threads

  1. Cross Compiling Qt for ARM with OpenGL
    By RhnBlk in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 4th June 2013, 12:42
  2. How to cross-compiling in Qt
    By sanjeet in forum Qt for Embedded and Mobile
    Replies: 2
    Last Post: 29th April 2011, 19:14
  3. Cross Compiling for MIPS
    By WayneFresh in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 22nd October 2010, 19:25
  4. Steps for cross compiling
    By Yayati.Ekbote in forum Installation and Deployment
    Replies: 0
    Last Post: 3rd March 2010, 11:20
  5. cross compiling
    By tommy in forum Installation and Deployment
    Replies: 1
    Last Post: 8th March 2009, 19:02

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.