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. failed to build simple project using cross compiled qt for aarch64
Forum Updated to NodeBB v4.3 + New Features

failed to build simple project using cross compiled qt for aarch64

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
5 Posts 2 Posters 371 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.
  • 123newuser1 Offline
    123newuser1 Offline
    123newuser
    wrote on last edited by
    #1

    Hi ,
    i have decent level understanding and experience with qt but this is my first time trying my hands on cross compilation in qt
    i have installed Qt 5.12.12 in the location/home/traana-dww37v3/Qt5.12.12 after that i have cross compiled it for aarch64 by running this command

    /home/traana-dww37v3/Qt5.12.12/5.12.12/Src/configure -release -static -opensource -confirm-license     -platform linux-g++     -xplatform linux-aarch64-gnu-g++     -device-option CROSS_COMPILE=/usr/bin/aarch64-linux-gnu-  -sysroot /home/traana-dww37v3/brd_rootfs    -extprefix /home/traana-dww37v3/Qt5.12.12_static/static_aarch_64  -nomake examples -nomake tests    -skip qtwebengine
    

    here brd_rootfs is the target board's rootfs (its a aarch64 architecture) which i have extracted in /home/traana-dww37v3/brd_rootfs
    i was able to configure and install
    now i have added this version of qt in qtcreator and trying to build a simple applicationScreenshot from 2024-09-12 17-41-25.png Screenshot from 2024-09-12 17-39-29.png

    and my .pro file looks like this

    QT       += core gui
    
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
    CONFIG += c++11
    
    LIBS += -L/home/traana-dww37v3/brd_rootfs/usr/lib
    
    QMAKE_LFLAGS += --sysroot=/home/traana-dww37v3/brd_rootfs
    QMAKE_CXXFLAGS += --sysroot=/home/traana-dww37v3/brd_rootfs
    
    SOURCES += \
        main.cpp \
        mainwindow.cpp
    
    HEADERS += \
        mainwindow.h
    
    FORMS += \
        mainwindow.ui
    
    # Default rules for deployment.
    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target
    

    and when i build i get the fallowing errors

    :-1: error: /usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/lib/../lib/Scrt1.o: in function `_start':
    :-1: error: (.text+0x24): undefined reference to `__libc_csu_init'
    :-1: error: (.text+0x28): undefined reference to `__libc_csu_fini'
    :-1: error: (.text+0x2c): undefined reference to `__libc_csu_fini'
    :-1: error: /usr/aarch64-linux-gnu/lib/libdl.so: undefined reference to `_dl_addr@GLIBC_PRIVATE'
    :-1: error: /usr/aarch64-linux-gnu/lib/libdl.so: undefined reference to `_dl_sym@GLIBC_PRIVATE'
    :-1: error: /usr/aarch64-linux-gnu/lib/libdl.so: undefined reference to `_dl_vsym@GLIBC_PRIVATE'
    

    i understand these errors are related to linker
    i have required Scrt1.o and crt1.o in my /home/traana-dww37v3/brd_rootfs/usr/lib location which i am pointing to so i am not understanding why i am still getting the error
    should i point the compiler to use the libraries from cross compiler toolchain which is there in my host machine at /usr/aarch64-linux-gnu/lib location or it should use the target board rootfs
    please help me understand what i am doing wrong and how do i resolve this issue
    thanks in advance for any help

    VRoninV 1 Reply Last reply
    0
    • 123newuser1 123newuser

      Hi ,
      i have decent level understanding and experience with qt but this is my first time trying my hands on cross compilation in qt
      i have installed Qt 5.12.12 in the location/home/traana-dww37v3/Qt5.12.12 after that i have cross compiled it for aarch64 by running this command

      /home/traana-dww37v3/Qt5.12.12/5.12.12/Src/configure -release -static -opensource -confirm-license     -platform linux-g++     -xplatform linux-aarch64-gnu-g++     -device-option CROSS_COMPILE=/usr/bin/aarch64-linux-gnu-  -sysroot /home/traana-dww37v3/brd_rootfs    -extprefix /home/traana-dww37v3/Qt5.12.12_static/static_aarch_64  -nomake examples -nomake tests    -skip qtwebengine
      

      here brd_rootfs is the target board's rootfs (its a aarch64 architecture) which i have extracted in /home/traana-dww37v3/brd_rootfs
      i was able to configure and install
      now i have added this version of qt in qtcreator and trying to build a simple applicationScreenshot from 2024-09-12 17-41-25.png Screenshot from 2024-09-12 17-39-29.png

      and my .pro file looks like this

      QT       += core gui
      
      greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
      
      CONFIG += c++11
      
      LIBS += -L/home/traana-dww37v3/brd_rootfs/usr/lib
      
      QMAKE_LFLAGS += --sysroot=/home/traana-dww37v3/brd_rootfs
      QMAKE_CXXFLAGS += --sysroot=/home/traana-dww37v3/brd_rootfs
      
      SOURCES += \
          main.cpp \
          mainwindow.cpp
      
      HEADERS += \
          mainwindow.h
      
      FORMS += \
          mainwindow.ui
      
      # Default rules for deployment.
      qnx: target.path = /tmp/$${TARGET}/bin
      else: unix:!android: target.path = /opt/$${TARGET}/bin
      !isEmpty(target.path): INSTALLS += target
      

      and when i build i get the fallowing errors

      :-1: error: /usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/lib/../lib/Scrt1.o: in function `_start':
      :-1: error: (.text+0x24): undefined reference to `__libc_csu_init'
      :-1: error: (.text+0x28): undefined reference to `__libc_csu_fini'
      :-1: error: (.text+0x2c): undefined reference to `__libc_csu_fini'
      :-1: error: /usr/aarch64-linux-gnu/lib/libdl.so: undefined reference to `_dl_addr@GLIBC_PRIVATE'
      :-1: error: /usr/aarch64-linux-gnu/lib/libdl.so: undefined reference to `_dl_sym@GLIBC_PRIVATE'
      :-1: error: /usr/aarch64-linux-gnu/lib/libdl.so: undefined reference to `_dl_vsym@GLIBC_PRIVATE'
      

      i understand these errors are related to linker
      i have required Scrt1.o and crt1.o in my /home/traana-dww37v3/brd_rootfs/usr/lib location which i am pointing to so i am not understanding why i am still getting the error
      should i point the compiler to use the libraries from cross compiler toolchain which is there in my host machine at /usr/aarch64-linux-gnu/lib location or it should use the target board rootfs
      please help me understand what i am doing wrong and how do i resolve this issue
      thanks in advance for any help

      VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by VRonin
      #2

      @123newuser said in failed to build simple project using cross compiled qt for aarch64:

      LIBS += -L/home/traana-dww37v3/brd_rootfs/usr/lib

      don't you miss the -l portion? that's the path of the library(es) but shouldn't you specify the name of the library(es) also?
      Like LIBS += -lScrt1 -lcrt1

      Also, are you certain they export the symbols you are referencing?

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      123newuser1 1 Reply Last reply
      0
      • VRoninV VRonin

        @123newuser said in failed to build simple project using cross compiled qt for aarch64:

        LIBS += -L/home/traana-dww37v3/brd_rootfs/usr/lib

        don't you miss the -l portion? that's the path of the library(es) but shouldn't you specify the name of the library(es) also?
        Like LIBS += -lScrt1 -lcrt1

        Also, are you certain they export the symbols you are referencing?

        123newuser1 Offline
        123newuser1 Offline
        123newuser
        wrote on last edited by
        #3

        @VRonin said in failed to build simple project using cross compiled qt for aarch64:

        Also, are you certain they export the symbols you are referencing

        hi thanks for the reply what do you mean by this
        and Scrt1.o and crt1.o are not libraries right so how can i add LIBS += -lScrt1 -lcrt1

        1 Reply Last reply
        0
        • 123newuser1 Offline
          123newuser1 Offline
          123newuser
          wrote on last edited by 123newuser
          #4

          i have checked the build environment and i have set the PATH and LD_LIBRARY_PATH variables still i am getting the errors dpnt know what else i heed to do for the linker to find the files in the correct directory Screenshot from 2024-09-13 12-36-12.png

          1 Reply Last reply
          0
          • 123newuser1 Offline
            123newuser1 Offline
            123newuser
            wrote on last edited by
            #5

            my host machine lists the GLIBC version 2.17 - 2.31 and the g++ -- version is 9.4.0, aarch64-linux-gnu-g++ --version is 9.4.0 and the target board GLIBC versions list from 2.17 -2.36 i was able to cross compile and run my normal c++ projects without any trouble so i don't think the GLIBC versions will be any problem for the qt cross compilation

            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