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. Menus from QMainWindow MenuBar not showing on Qt 6.4.0
Forum Updated to NodeBB v4.3 + New Features

Menus from QMainWindow MenuBar not showing on Qt 6.4.0

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
33 Posts 3 Posters 4.0k 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.
  • D davethomaspilot

    I have an application that's been running on Qt 5.12 for years , with no issues. Cross-compiled from an Ubuntu machine, targeting Raspberry Pi 3b+ with Debian Stretch (and Jessie before that). (32 bit)

    I just cross compiled Qt 6.4 for Debian bookworm and my application. Now running on Raspberry Pi, Bookworm, 64 bit.

    The application starts fine and displays the expected QMainWindow. But, nothing happens when I click on the Menubar Menus.

    But they DO display as expected when I use the "Preview" and "Preview In" tool in QtCreator.

    I saw a post with a similar issue which suggested adding this line:

    menuBar()->setNativeMenuBar(false);

    I tried that, but it didn't help.

    Any suggestions?

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

    @davethomaspilot Are there any errors in terminal if you start your app in a terminal?

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

    1 Reply Last reply
    0
    • D davethomaspilot

      I have an application that's been running on Qt 5.12 for years , with no issues. Cross-compiled from an Ubuntu machine, targeting Raspberry Pi 3b+ with Debian Stretch (and Jessie before that). (32 bit)

      I just cross compiled Qt 6.4 for Debian bookworm and my application. Now running on Raspberry Pi, Bookworm, 64 bit.

      The application starts fine and displays the expected QMainWindow. But, nothing happens when I click on the Menubar Menus.

      But they DO display as expected when I use the "Preview" and "Preview In" tool in QtCreator.

      I saw a post with a similar issue which suggested adding this line:

      menuBar()->setNativeMenuBar(false);

      I tried that, but it didn't help.

      Any suggestions?

      D Offline
      D Offline
      davethomaspilot
      wrote on last edited by
      #3

      @davethomaspilot No

      1 Reply Last reply
      0
      • D davethomaspilot

        I have an application that's been running on Qt 5.12 for years , with no issues. Cross-compiled from an Ubuntu machine, targeting Raspberry Pi 3b+ with Debian Stretch (and Jessie before that). (32 bit)

        I just cross compiled Qt 6.4 for Debian bookworm and my application. Now running on Raspberry Pi, Bookworm, 64 bit.

        The application starts fine and displays the expected QMainWindow. But, nothing happens when I click on the Menubar Menus.

        But they DO display as expected when I use the "Preview" and "Preview In" tool in QtCreator.

        I saw a post with a similar issue which suggested adding this line:

        menuBar()->setNativeMenuBar(false);

        I tried that, but it didn't help.

        Any suggestions?

        D Offline
        D Offline
        davethomaspilot
        wrote on last edited by
        #4

        @davethomaspilot Also, hover help not displaying.

        I reduced the application so that it only has this:

        MainWindow::MainWindow(QWidget *parent) :
        QMainWindow(parent),
        ui(new Ui::MainWindow)
        //xe(&Xemics::getInstance()),
        //xregs(&XemicRegs::getInstance()),
        ///serial(&Serial::getInstance()),
        //timingEvent(new TimingEvents),
        //eventThread(new QThread()),
        //eventNum(0),
        //treeEvent(new TreeEvent()),
        //ledB(new LedBrightness),
        //analogParms(new ReadAnalogParms(this,xe)),
        //readyLed(new LedControl(250,250,READY_LED,PI_LOW)),
        //bands(new Bands),
        //cadenceColors(new CadenceColors),
        //powerChangeTimer(new QElapsedTimer),
        //dissipatedEnergy(0),
        //colorDialog(0),
        //demos(0),
        //ps(NULL)

        {
        ui->setupUi(this);
        return;
        }

        Still same issue. MainWindow is displayed as expected, but nothing happens when clicking on Menubar. (But it works in QtCreator preview and preview in)

        My Qt build only include the analogclock example. I'll dig up an example with a QMainWindow and see if it works.

        D 1 Reply Last reply
        0
        • D davethomaspilot

          @davethomaspilot Also, hover help not displaying.

          I reduced the application so that it only has this:

          MainWindow::MainWindow(QWidget *parent) :
          QMainWindow(parent),
          ui(new Ui::MainWindow)
          //xe(&Xemics::getInstance()),
          //xregs(&XemicRegs::getInstance()),
          ///serial(&Serial::getInstance()),
          //timingEvent(new TimingEvents),
          //eventThread(new QThread()),
          //eventNum(0),
          //treeEvent(new TreeEvent()),
          //ledB(new LedBrightness),
          //analogParms(new ReadAnalogParms(this,xe)),
          //readyLed(new LedControl(250,250,READY_LED,PI_LOW)),
          //bands(new Bands),
          //cadenceColors(new CadenceColors),
          //powerChangeTimer(new QElapsedTimer),
          //dissipatedEnergy(0),
          //colorDialog(0),
          //demos(0),
          //ps(NULL)

          {
          ui->setupUi(this);
          return;
          }

          Still same issue. MainWindow is displayed as expected, but nothing happens when clicking on Menubar. (But it works in QtCreator preview and preview in)

          My Qt build only include the analogclock example. I'll dig up an example with a QMainWindow and see if it works.

          D Offline
          D Offline
          davethomaspilot
          wrote on last edited by
          #5

          @davethomaspilot

          I get same thing when I build and run this example:

          https://doc.qt.io/qt-5.15/qtwidgets-mainwindows-application-example.html

          Nothing happens when I click on items in the menubar.

          I guess this means the cross-compiled Qt 6.4 is messed up? Short of starting over and trying again (that's about two days of compile time, what can I do?

          jsulmJ 1 Reply Last reply
          0
          • D davethomaspilot

            @davethomaspilot

            I get same thing when I build and run this example:

            https://doc.qt.io/qt-5.15/qtwidgets-mainwindows-application-example.html

            Nothing happens when I click on items in the menubar.

            I guess this means the cross-compiled Qt 6.4 is messed up? Short of starting over and trying again (that's about two days of compile time, what can I do?

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

            @davethomaspilot Are you using X11 or Wayland on the device? If Wayland try to switch to X11 to see whether it makes a difference. You can also test with some preinstalled Qt application like VLC.

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

            D 2 Replies Last reply
            0
            • jsulmJ jsulm

              @davethomaspilot Are you using X11 or Wayland on the device? If Wayland try to switch to X11 to see whether it makes a difference. You can also test with some preinstalled Qt application like VLC.

              D Offline
              D Offline
              davethomaspilot
              wrote on last edited by
              #7

              @jsulm I hvae QT_QPA_PLATFORM=xcb. Does that mean X11? If not, how do I switch to X11?

              I'm connecting to headless rpi using x11vnc.

              Menubar works fine when using vlc. But, it's not using the cross compiled qt6 libraries.

              1 Reply Last reply
              0
              • jsulmJ jsulm

                @davethomaspilot Are you using X11 or Wayland on the device? If Wayland try to switch to X11 to see whether it makes a difference. You can also test with some preinstalled Qt application like VLC.

                D Offline
                D Offline
                davethomaspilot
                wrote on last edited by
                #8

                @jsulm Thanks for your help!

                I configured the build for FEATURE_xcb=ON. Here are the other configuration options I used:

                -release
                -opengl
                es2
                -nomake
                examples
                -nomake
                tests
                -qt-host-path
                /home/davethomaspilot/qt-host
                -extprefix
                /home/davethomaspilot/qt-raspi
                -prefix
                /usr/local/qt6
                -device
                linux-rasp-pi4-aarch64
                -device-option
                CROSS_COMPILE=aarch64-linux-gnu-

                -DCMAKE_TOOLCHAIN_FILE=/home/davethomaspilot/toolchain.cmake
                -DQT_FEATURE_xcb=ON
                -DFEATURE_xcb_xlib=ON
                -DQT_FEATURE_xlib=ON

                D 1 Reply Last reply
                0
                • D davethomaspilot

                  @jsulm Thanks for your help!

                  I configured the build for FEATURE_xcb=ON. Here are the other configuration options I used:

                  -release
                  -opengl
                  es2
                  -nomake
                  examples
                  -nomake
                  tests
                  -qt-host-path
                  /home/davethomaspilot/qt-host
                  -extprefix
                  /home/davethomaspilot/qt-raspi
                  -prefix
                  /usr/local/qt6
                  -device
                  linux-rasp-pi4-aarch64
                  -device-option
                  CROSS_COMPILE=aarch64-linux-gnu-

                  -DCMAKE_TOOLCHAIN_FILE=/home/davethomaspilot/toolchain.cmake
                  -DQT_FEATURE_xcb=ON
                  -DFEATURE_xcb_xlib=ON
                  -DQT_FEATURE_xlib=ON

                  D Offline
                  D Offline
                  davethomaspilot
                  wrote on last edited by
                  #9

                  @davethomaspilot And, I have X11 configured using raspi-config on the rpi4.

                  jsulmJ 1 Reply Last reply
                  0
                  • D davethomaspilot

                    @davethomaspilot And, I have X11 configured using raspi-config on the rpi4.

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

                    @davethomaspilot Yes, looks like you're using X11.
                    Could be that there is an issues with Qt6 and that OS version.

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

                    D 1 Reply Last reply
                    0
                    • jsulmJ jsulm

                      @davethomaspilot Yes, looks like you're using X11.
                      Could be that there is an issues with Qt6 and that OS version.

                      D Offline
                      D Offline
                      davethomaspilot
                      wrote on last edited by
                      #11

                      @jsulm Any suggestions on how to proceed?

                      • ls there a way to tell if Qt 6.4.0 has been tested on Bookworm?
                      • I configured to use OpenGL. Could that be a factor?
                      • There is a link to install qt6 on bookworm simply, by installing qt6-base-dev. I haven't tried that. I don't know if it will replace the libraries I created with the cross-compile, or create a new set in a different folder. Should I pursue this route? It would be great to only have to cross-compile my Qt6 app, not Qt itself!
                      SGaistS 1 Reply Last reply
                      0
                      • D davethomaspilot

                        @jsulm Any suggestions on how to proceed?

                        • ls there a way to tell if Qt 6.4.0 has been tested on Bookworm?
                        • I configured to use OpenGL. Could that be a factor?
                        • There is a link to install qt6 on bookworm simply, by installing qt6-base-dev. I haven't tried that. I don't know if it will replace the libraries I created with the cross-compile, or create a new set in a different folder. Should I pursue this route? It would be great to only have to cross-compile my Qt6 app, not Qt itself!
                        SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #12

                        @davethomaspilot hi,

                        Unless you installed your cross-compiled Qt in system folders (which you should not), installing the distribution packages should not interfere with them.

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

                        D 1 Reply Last reply
                        0
                        • SGaistS SGaist

                          @davethomaspilot hi,

                          Unless you installed your cross-compiled Qt in system folders (which you should not), installing the distribution packages should not interfere with them.

                          D Offline
                          D Offline
                          davethomaspilot
                          wrote on last edited by
                          #13

                          @SGaist Following this:

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

                          It said to do this:

                          $ cd $HOME/rpi-sysroot
                          $ rsync -avzS --rsync-path="rsync" --delete <pi_username>@<pi_ip_address>:/lib* rpi-sysroot/lib
                          $ mkdir usr
                          $ rsync -avzS --rsync-path="rsync" --delete <pi_username>@<pi_ip_address>:/usr/include/* rpi-sysroot/usr/include
                          $ rsync -avzS --rsync-path="rsync" --delete <pi_username>@<pi_ip_address>:/usr/lib/* rpi-sysroot/usr/lib
                          $ mkdir opt
                          $ rsync -avzS --rsync-path="rsync" --delete <pi_username>@<pi_ip_address>:/opt/vc rpi-sysroot/opt/vc

                          which installs the libraries in /usr/lib. I think of those as "system folders". No?

                          Anway, that's where they are now.

                          Is there really a qt6 for rpi that can be installed simply rather than having to do the cross-compile?

                          SGaistS 1 Reply Last reply
                          0
                          • D davethomaspilot

                            @SGaist Following this:

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

                            It said to do this:

                            $ cd $HOME/rpi-sysroot
                            $ rsync -avzS --rsync-path="rsync" --delete <pi_username>@<pi_ip_address>:/lib* rpi-sysroot/lib
                            $ mkdir usr
                            $ rsync -avzS --rsync-path="rsync" --delete <pi_username>@<pi_ip_address>:/usr/include/* rpi-sysroot/usr/include
                            $ rsync -avzS --rsync-path="rsync" --delete <pi_username>@<pi_ip_address>:/usr/lib/* rpi-sysroot/usr/lib
                            $ mkdir opt
                            $ rsync -avzS --rsync-path="rsync" --delete <pi_username>@<pi_ip_address>:/opt/vc rpi-sysroot/opt/vc

                            which installs the libraries in /usr/lib. I think of those as "system folders". No?

                            Anway, that's where they are now.

                            Is there really a qt6 for rpi that can be installed simply rather than having to do the cross-compile?

                            SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #14

                            @davethomaspilot the instructions you show are to copy the dependencies from the RPi back to the host to create a sysroot for the cross-compilation process. The transfert of Qt to the RPi indicates to use /usr/local/qt6. So you should be good.

                            You can install Qt 6 using your RPi distribution packages.

                            Note that while the wiki shows 6.4.0, you should update Qt to 6.6. It might contain fixed for your issue.

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

                            D 1 Reply Last reply
                            1
                            • SGaistS SGaist

                              @davethomaspilot the instructions you show are to copy the dependencies from the RPi back to the host to create a sysroot for the cross-compilation process. The transfert of Qt to the RPi indicates to use /usr/local/qt6. So you should be good.

                              You can install Qt 6 using your RPi distribution packages.

                              Note that while the wiki shows 6.4.0, you should update Qt to 6.6. It might contain fixed for your issue.

                              D Offline
                              D Offline
                              davethomaspilot
                              wrote on last edited by
                              #15

                              @SGaist Thanks for the reply...

                              But, if there's an RPI distribution package, shouldn't I just use that?

                              I really don't even need Qt6 I just needed to update a hacked version of the pigpio library I did back in 2018 to work with RPI4. I figured I'd move up to the latest Debian and qt6 while I was at it, since the product will be used at least another 10 years (or until I can't get RPI4 anymore).

                              jsulmJ 1 Reply Last reply
                              0
                              • D davethomaspilot

                                @SGaist Thanks for the reply...

                                But, if there's an RPI distribution package, shouldn't I just use that?

                                I really don't even need Qt6 I just needed to update a hacked version of the pigpio library I did back in 2018 to work with RPI4. I figured I'd move up to the latest Debian and qt6 while I was at it, since the product will be used at least another 10 years (or until I can't get RPI4 anymore).

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

                                @davethomaspilot said in Menus from QMainWindow MenuBar not showing on Qt 6.4.0:

                                But, if there's an RPI distribution package, shouldn't I just use that?

                                Yes. But if you do cross compilation you need to update the sysroot after Qt6 installation on RPi.

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

                                D 1 Reply Last reply
                                0
                                • jsulmJ jsulm

                                  @davethomaspilot said in Menus from QMainWindow MenuBar not showing on Qt 6.4.0:

                                  But, if there's an RPI distribution package, shouldn't I just use that?

                                  Yes. But if you do cross compilation you need to update the sysroot after Qt6 installation on RPi.

                                  D Offline
                                  D Offline
                                  davethomaspilot
                                  wrote on last edited by
                                  #17

                                  @jsulm Ok, I'll give it a try...

                                  Things get confusing with cross-compilation, at least for me. Here's what I think I need to do. Sorry for the long post...

                                  I'll install qt6 from the repos on the RPI. Then, when I do these commands:

                                  $ cd $HOME/rpi-sysroot
                                  $ rsync -avzS --rsync-path="rsync" --delete <pi_username>@<pi_ip_address>:/lib* rpi-sysroot/lib
                                  $ mkdir usr
                                  $ rsync -avzS --rsync-path="rsync" --delete <pi_username>@<pi_ip_address>:/usr/include/* rpi-sysroot/usr/include
                                  $ rsync -avzS --rsync-path="rsync" --delete <pi_username>@<pi_ip_address>:/usr/lib/* rpi-sysroot/usr/lib
                                  $ mkdir opt
                                  $ rsync -avzS --rsync-path="rsync" --delete <pi_username>@<pi_ip_address>:/opt/vc rpi-sysroot/opt/vc
                                  

                                  A copy of the newly installed qt6 libraries will be copied to the build machine along with the other "system" libraries But, I will use a different sysroot folder, say repo-rpi-sysroot insted of rpi-sysroot-lib. Is this correct?

                                  Then do the symlink thing (on the build machine) using this:

                                  $ sudo apt install symlinks
                                  $ cd ~
                                  $ symlinks -rc repo-rpi-sysroot
                                  

                                  I think I will need to rebuild my app (not QT6!) to link with the repo libraries. But, looking at myapplication's .pro file, I can't figure out how the sysroot libraries are being found:

                                  #-------------------------------------------------
                                  #
                                  # Project created by QtCreator 2018-11-02T09:42:04
                                  #
                                  #-------------------------------------------------
                                  
                                  QT       += core gui xml
                                  QT       += serialport sql opengl
                                  
                                  greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
                                  greaterThan(QT_MAJOR_VERSION, 4): CONFIG += c++11
                                  lessThan(QT_MAJOR_VERSION, 5): QMAKE_CXXFLAGS += -std=c++11
                                  TARGET = LightTree
                                  TEMPLATE = app
                                  
                                  CONFIG += debug
                                  
                                  #QMAKE_CXXFLAGS_RELEASE -= -O2
                                  #QMAKE_CXXFLAGS_RELEASE += -Os
                                  
                                  
                                  # The following define makes your compiler emit warnings if you use
                                  # any feature of Qt which has been marked as deprecated (the exact warnings
                                  # depend on your compiler). Please consult the documentation of the
                                  # deprecated API in order to know how to port your code away from it.
                                  DEFINES += QT_DEPRECATED_WARNINGS
                                  //DEFINES += -Wno-switch
                                  
                                  # You can also make your code fail to compile if you use deprecated APIs.
                                  # In order to do so, uncomment the following line.
                                  # You can also select to disable deprecated APIs only up to a certain version of Qt.
                                  #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
                                  
                                  #DEFINES += FIRST_PROTO
                                  DEFINES += QCUSTOMPLOT_USE_OPENGL
                                  SOURCES += \
                                          main.cpp \
                                          mainwindow.cpp \
                                      xemics.cpp \
                                      pigspi.cpp \
                                      xemicregs.cpp \
                                      pigpioread.cpp \
                                      timingevents.cpp \
                                      lightbar.cpp \
                                      treeevent.cpp \
                                      powercontrol.cpp \
                                      logger.cpp \
                                      ledbrightness.cpp \
                                      serial.cpp \
                                      readanalogparms.cpp \
                                      ledcontrol.cpp \
                                      bands.cpp \
                                      cadencecolors.cpp \
                                      stagedefs.cpp \
                                      demos.cpp \
                                      passsimulator.cpp \
                                      qcustomplot.cpp \
                                      leaderboard.cpp
                                  
                                  HEADERS += \
                                          mainwindow.h \
                                      qcustomplot.h \
                                      xemics.h \
                                      pigspi.h \
                                      xemicregs.h \
                                      serial.h \
                                      pigpioread.h \
                                      timingevents.h \
                                      tree_events.h \
                                      ws2811.h \
                                      lightbar.h \
                                      treeevent.h \
                                      powercontrol.h \
                                      gpiodefs.h \
                                      logger.h \
                                      ledbrightness.h \
                                      readanalogparms.h \
                                      ledcontrol.h \
                                      bands.h \
                                      atmel_commands.h \
                                      cadencecolors.h \
                                      rpihw.h \
                                      pwm.h \
                                      stagedefs.h \
                                      demos.h \
                                      passsimulator.h \
                                      powercontrol.h \
                                      leaderboard.h
                                  
                                  
                                  FORMS += \
                                          mainwindow.ui \
                                      xemicregs.ui \
                                      treeevent.ui \
                                      ledbrightness.ui \
                                      batteryvoltage.ui \
                                      bands.ui \
                                      cadencecolors.ui \
                                      demos.ui \
                                      passsimulator.ui \
                                      leaderboard.ui
                                  
                                  ROOTFS = /home/davethomaspilot/rpi-sysroot
                                  INCLUDEPATH += $${ROOTFS}/usr/include
                                  #LIBS += -lwiringPi
                                  
                                  DEFINES += SVN_REVISION=\\\"$$system("svn info --show-item revision")\\\"
                                  DEFINES += BUILDDATE=\\\"$$system(date '+%m/%d/%y')\\\"
                                  DEFINES += BUILDTIME=\\\"$$system(date '+%H:%M')\\\"
                                  
                                  contains ( DEFINES, USE_PIGPIO_DAEMON ){
                                      LIBS += -lpigpiod_if2 -lrt
                                  } else {
                                      LIBS += -lpigpio -lrt -lws2811
                                  }
                                  #-lsqlite
                                  target.path = /home/pi/LightTree
                                  INSTALLS += target
                                  
                                  DISTFILES +=
                                  
                                  RESOURCES += \
                                      myresource.qrc
                                  
                                  unix:!macx: LIBS += -L$$PWD/../../../build-rpi_ws281x-LightTree-Debug/ -lws2811
                                  
                                  INCLUDEPATH += $$PWD/../../../build-rpi_ws281x-LightTree-Debug
                                  DEPENDPATH += $$PWD/../../../build-rpi_ws281x-LightTree-Debug
                                  
                                  unix:!macx: PRE_TARGETDEPS += $$PWD/../../../build-rpi_ws281x-LightTree-Debug/libws2811.a
                                  

                                  There is "ROOTFS", but it seems to only used for setting INCLUDEPATH. The -L flag doesn't use it--it just specifies the build directory:

                                  unix:!macx: LIBS += -L$$PWD/../../../build-rpi_ws281x-LightTree-Debug/ -lws2811
                                  

                                  Yet, I see from the compile output, the libraries from the sysroot are being found (/home/davethomaspilot/qt-raspi)

                                  arch64-linux-gnu-g++ -c -pipe -pipe -march=armv8-a --sysroot=/home/davethomaspilot/rpi-sysroot -g -Wall -Wextra -D_REENTRANT -DQT_DEPRECATED_WARNINGS -DQCUSTOMPLOT_USE_OPENGL -DSVN_REVISION=\"1814\" -DBUILDDATE=\"11/05/23\" -DBUILDTIME=\"17:50\" -DQT_QML_DEBUG -DQT_OPENGL_LIB -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_XML_LIB -DQT_SERIALPORT_LIB -DQT_SQL_LIB -DQT_CORE_LIB -I../HJJ -I. -I../../../rpi-sysroot/usr/include -I../../../build-rpi_ws281x-LightTree-Debug -I../../../qt-raspi/include -I../../../qt-raspi/include/QtOpenGL -I../../../qt-raspi/include/QtPrintSupport -I../../../qt-raspi/include/QtWidgets -I../../../qt-raspi/include/QtGui -I../../../qt-raspi/include/QtXml -I../../../qt-raspi/include/QtSerialPort -I../../../qt-raspi/include/QtSql -I../../../qt-raspi/include/QtCore -I. -I. -I../../../qt-raspi/mkspecs/devices/linux-rasp-pi4-aarch64 -o logger.o ../HJJ/logger.cpp
                                  aarch64-linux-gnu-g++ -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed --sysroot=/home/davethomaspilot/rpi-sysroot -Wl,-rpath,/usr/local/qt6/lib -Wl,-rpath-link,/home/davethomaspilot/rpi-sysroot/usr/lib/aarch64-linux-gnu -Wl,-rpath-link,/home/davethomaspilot/rpi-sysroot/lib/aarch64-linux-gnu -o LightTree  main.o mainwindow.o xemics.o pigspi.o xemicregs.o pigpioread.o timingevents.o lightbar.o treeevent.o powercontrol.o logger.o ledbrightness.o serial.o readanalogparms.o ledcontrol.o bands.o cadencecolors.o stagedefs.o demos.o passsimulator.o qcustomplot.o leaderboard.o qrc_myresource.o moc_mainwindow.o moc_qcustomplot.o moc_xemics.o moc_pigspi.o moc_xemicregs.o moc_serial.o moc_pigpioread.o moc_timingevents.o moc_lightbar.o moc_treeevent.o moc_powercontrol.o moc_logger.o moc_ledbrightness.o moc_readanalogparms.o moc_ledcontrol.o moc_bands.o moc_cadencecolors.o moc_demos.o moc_passsimulator.o moc_leaderboard.o   -lpigpio -lrt -L/home/davethomaspilot/StartLights/branches/HJJ/../../../build-rpi_ws281x-LightTree-Debug/ -lws2811 /home/davethomaspilot/qt-raspi/lib/libQt6OpenGL.so /home/davethomaspilot/qt-raspi/lib/libQt6PrintSupport.so /home/davethomaspilot/qt-raspi/lib/libQt6Widgets.so /home/davethomaspilot/qt-raspi/lib/libQt6Gui.so -lEGL /home/davethomaspilot/qt-raspi/lib/libQt6Xml.so /home/davethomaspilot/qt-raspi/lib/libQt6SerialPort.so /home/davethomaspilot/qt-raspi/lib/libQt6Sql.so /home/davethomaspilot/qt-raspi/lib/libQt6Core.so -lpthread -lGLESv2
                                  

                                  I think they must be found using "cmake magic", from this:

                                  -DCMAKE_TOOLCHAIN_FILE:UNINITIALIZED=/path/to/qt-raspi/lib/cmake/Qt6/qt.toolchain.cmake
                                  

                                  But, that toolchain.cmake came from the QT6 build, I think?

                                  I think I need to understand the mechanism that provided the fully qualified library "qt-raspi" names so the link on the build machine won't pick up the libraries from the QT build, but will instead link against those in repo-raspi-sysroot.

                                  jsulmJ 1 Reply Last reply
                                  0
                                  • D davethomaspilot

                                    @jsulm Ok, I'll give it a try...

                                    Things get confusing with cross-compilation, at least for me. Here's what I think I need to do. Sorry for the long post...

                                    I'll install qt6 from the repos on the RPI. Then, when I do these commands:

                                    $ cd $HOME/rpi-sysroot
                                    $ rsync -avzS --rsync-path="rsync" --delete <pi_username>@<pi_ip_address>:/lib* rpi-sysroot/lib
                                    $ mkdir usr
                                    $ rsync -avzS --rsync-path="rsync" --delete <pi_username>@<pi_ip_address>:/usr/include/* rpi-sysroot/usr/include
                                    $ rsync -avzS --rsync-path="rsync" --delete <pi_username>@<pi_ip_address>:/usr/lib/* rpi-sysroot/usr/lib
                                    $ mkdir opt
                                    $ rsync -avzS --rsync-path="rsync" --delete <pi_username>@<pi_ip_address>:/opt/vc rpi-sysroot/opt/vc
                                    

                                    A copy of the newly installed qt6 libraries will be copied to the build machine along with the other "system" libraries But, I will use a different sysroot folder, say repo-rpi-sysroot insted of rpi-sysroot-lib. Is this correct?

                                    Then do the symlink thing (on the build machine) using this:

                                    $ sudo apt install symlinks
                                    $ cd ~
                                    $ symlinks -rc repo-rpi-sysroot
                                    

                                    I think I will need to rebuild my app (not QT6!) to link with the repo libraries. But, looking at myapplication's .pro file, I can't figure out how the sysroot libraries are being found:

                                    #-------------------------------------------------
                                    #
                                    # Project created by QtCreator 2018-11-02T09:42:04
                                    #
                                    #-------------------------------------------------
                                    
                                    QT       += core gui xml
                                    QT       += serialport sql opengl
                                    
                                    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
                                    greaterThan(QT_MAJOR_VERSION, 4): CONFIG += c++11
                                    lessThan(QT_MAJOR_VERSION, 5): QMAKE_CXXFLAGS += -std=c++11
                                    TARGET = LightTree
                                    TEMPLATE = app
                                    
                                    CONFIG += debug
                                    
                                    #QMAKE_CXXFLAGS_RELEASE -= -O2
                                    #QMAKE_CXXFLAGS_RELEASE += -Os
                                    
                                    
                                    # The following define makes your compiler emit warnings if you use
                                    # any feature of Qt which has been marked as deprecated (the exact warnings
                                    # depend on your compiler). Please consult the documentation of the
                                    # deprecated API in order to know how to port your code away from it.
                                    DEFINES += QT_DEPRECATED_WARNINGS
                                    //DEFINES += -Wno-switch
                                    
                                    # You can also make your code fail to compile if you use deprecated APIs.
                                    # In order to do so, uncomment the following line.
                                    # You can also select to disable deprecated APIs only up to a certain version of Qt.
                                    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
                                    
                                    #DEFINES += FIRST_PROTO
                                    DEFINES += QCUSTOMPLOT_USE_OPENGL
                                    SOURCES += \
                                            main.cpp \
                                            mainwindow.cpp \
                                        xemics.cpp \
                                        pigspi.cpp \
                                        xemicregs.cpp \
                                        pigpioread.cpp \
                                        timingevents.cpp \
                                        lightbar.cpp \
                                        treeevent.cpp \
                                        powercontrol.cpp \
                                        logger.cpp \
                                        ledbrightness.cpp \
                                        serial.cpp \
                                        readanalogparms.cpp \
                                        ledcontrol.cpp \
                                        bands.cpp \
                                        cadencecolors.cpp \
                                        stagedefs.cpp \
                                        demos.cpp \
                                        passsimulator.cpp \
                                        qcustomplot.cpp \
                                        leaderboard.cpp
                                    
                                    HEADERS += \
                                            mainwindow.h \
                                        qcustomplot.h \
                                        xemics.h \
                                        pigspi.h \
                                        xemicregs.h \
                                        serial.h \
                                        pigpioread.h \
                                        timingevents.h \
                                        tree_events.h \
                                        ws2811.h \
                                        lightbar.h \
                                        treeevent.h \
                                        powercontrol.h \
                                        gpiodefs.h \
                                        logger.h \
                                        ledbrightness.h \
                                        readanalogparms.h \
                                        ledcontrol.h \
                                        bands.h \
                                        atmel_commands.h \
                                        cadencecolors.h \
                                        rpihw.h \
                                        pwm.h \
                                        stagedefs.h \
                                        demos.h \
                                        passsimulator.h \
                                        powercontrol.h \
                                        leaderboard.h
                                    
                                    
                                    FORMS += \
                                            mainwindow.ui \
                                        xemicregs.ui \
                                        treeevent.ui \
                                        ledbrightness.ui \
                                        batteryvoltage.ui \
                                        bands.ui \
                                        cadencecolors.ui \
                                        demos.ui \
                                        passsimulator.ui \
                                        leaderboard.ui
                                    
                                    ROOTFS = /home/davethomaspilot/rpi-sysroot
                                    INCLUDEPATH += $${ROOTFS}/usr/include
                                    #LIBS += -lwiringPi
                                    
                                    DEFINES += SVN_REVISION=\\\"$$system("svn info --show-item revision")\\\"
                                    DEFINES += BUILDDATE=\\\"$$system(date '+%m/%d/%y')\\\"
                                    DEFINES += BUILDTIME=\\\"$$system(date '+%H:%M')\\\"
                                    
                                    contains ( DEFINES, USE_PIGPIO_DAEMON ){
                                        LIBS += -lpigpiod_if2 -lrt
                                    } else {
                                        LIBS += -lpigpio -lrt -lws2811
                                    }
                                    #-lsqlite
                                    target.path = /home/pi/LightTree
                                    INSTALLS += target
                                    
                                    DISTFILES +=
                                    
                                    RESOURCES += \
                                        myresource.qrc
                                    
                                    unix:!macx: LIBS += -L$$PWD/../../../build-rpi_ws281x-LightTree-Debug/ -lws2811
                                    
                                    INCLUDEPATH += $$PWD/../../../build-rpi_ws281x-LightTree-Debug
                                    DEPENDPATH += $$PWD/../../../build-rpi_ws281x-LightTree-Debug
                                    
                                    unix:!macx: PRE_TARGETDEPS += $$PWD/../../../build-rpi_ws281x-LightTree-Debug/libws2811.a
                                    

                                    There is "ROOTFS", but it seems to only used for setting INCLUDEPATH. The -L flag doesn't use it--it just specifies the build directory:

                                    unix:!macx: LIBS += -L$$PWD/../../../build-rpi_ws281x-LightTree-Debug/ -lws2811
                                    

                                    Yet, I see from the compile output, the libraries from the sysroot are being found (/home/davethomaspilot/qt-raspi)

                                    arch64-linux-gnu-g++ -c -pipe -pipe -march=armv8-a --sysroot=/home/davethomaspilot/rpi-sysroot -g -Wall -Wextra -D_REENTRANT -DQT_DEPRECATED_WARNINGS -DQCUSTOMPLOT_USE_OPENGL -DSVN_REVISION=\"1814\" -DBUILDDATE=\"11/05/23\" -DBUILDTIME=\"17:50\" -DQT_QML_DEBUG -DQT_OPENGL_LIB -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_XML_LIB -DQT_SERIALPORT_LIB -DQT_SQL_LIB -DQT_CORE_LIB -I../HJJ -I. -I../../../rpi-sysroot/usr/include -I../../../build-rpi_ws281x-LightTree-Debug -I../../../qt-raspi/include -I../../../qt-raspi/include/QtOpenGL -I../../../qt-raspi/include/QtPrintSupport -I../../../qt-raspi/include/QtWidgets -I../../../qt-raspi/include/QtGui -I../../../qt-raspi/include/QtXml -I../../../qt-raspi/include/QtSerialPort -I../../../qt-raspi/include/QtSql -I../../../qt-raspi/include/QtCore -I. -I. -I../../../qt-raspi/mkspecs/devices/linux-rasp-pi4-aarch64 -o logger.o ../HJJ/logger.cpp
                                    aarch64-linux-gnu-g++ -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed --sysroot=/home/davethomaspilot/rpi-sysroot -Wl,-rpath,/usr/local/qt6/lib -Wl,-rpath-link,/home/davethomaspilot/rpi-sysroot/usr/lib/aarch64-linux-gnu -Wl,-rpath-link,/home/davethomaspilot/rpi-sysroot/lib/aarch64-linux-gnu -o LightTree  main.o mainwindow.o xemics.o pigspi.o xemicregs.o pigpioread.o timingevents.o lightbar.o treeevent.o powercontrol.o logger.o ledbrightness.o serial.o readanalogparms.o ledcontrol.o bands.o cadencecolors.o stagedefs.o demos.o passsimulator.o qcustomplot.o leaderboard.o qrc_myresource.o moc_mainwindow.o moc_qcustomplot.o moc_xemics.o moc_pigspi.o moc_xemicregs.o moc_serial.o moc_pigpioread.o moc_timingevents.o moc_lightbar.o moc_treeevent.o moc_powercontrol.o moc_logger.o moc_ledbrightness.o moc_readanalogparms.o moc_ledcontrol.o moc_bands.o moc_cadencecolors.o moc_demos.o moc_passsimulator.o moc_leaderboard.o   -lpigpio -lrt -L/home/davethomaspilot/StartLights/branches/HJJ/../../../build-rpi_ws281x-LightTree-Debug/ -lws2811 /home/davethomaspilot/qt-raspi/lib/libQt6OpenGL.so /home/davethomaspilot/qt-raspi/lib/libQt6PrintSupport.so /home/davethomaspilot/qt-raspi/lib/libQt6Widgets.so /home/davethomaspilot/qt-raspi/lib/libQt6Gui.so -lEGL /home/davethomaspilot/qt-raspi/lib/libQt6Xml.so /home/davethomaspilot/qt-raspi/lib/libQt6SerialPort.so /home/davethomaspilot/qt-raspi/lib/libQt6Sql.so /home/davethomaspilot/qt-raspi/lib/libQt6Core.so -lpthread -lGLESv2
                                    

                                    I think they must be found using "cmake magic", from this:

                                    -DCMAKE_TOOLCHAIN_FILE:UNINITIALIZED=/path/to/qt-raspi/lib/cmake/Qt6/qt.toolchain.cmake
                                    

                                    But, that toolchain.cmake came from the QT6 build, I think?

                                    I think I need to understand the mechanism that provided the fully qualified library "qt-raspi" names so the link on the build machine won't pick up the libraries from the QT build, but will instead link against those in repo-raspi-sysroot.

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

                                    @davethomaspilot said in Menus from QMainWindow MenuBar not showing on Qt 6.4.0:

                                    But, I will use a different sysroot folder, say repo-rpi-sysroot insted of rpi-sysroot-lib.

                                    Why? I mean, you can of course have as many sysroots as you like. But there is no need to create a new one just because of Qt.

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

                                    D 1 Reply Last reply
                                    0
                                    • jsulmJ jsulm

                                      @davethomaspilot said in Menus from QMainWindow MenuBar not showing on Qt 6.4.0:

                                      But, I will use a different sysroot folder, say repo-rpi-sysroot insted of rpi-sysroot-lib.

                                      Why? I mean, you can of course have as many sysroots as you like. But there is no need to create a new one just because of Qt.

                                      D Offline
                                      D Offline
                                      davethomaspilot
                                      wrote on last edited by
                                      #19

                                      @jsulm So as not to clobber the Qt libs I built. Compile time is measured in days.

                                      1 Reply Last reply
                                      0
                                      • D Offline
                                        D Offline
                                        davethomaspilot
                                        wrote on last edited by
                                        #20

                                        @davethomaspilot I guess I don't really need new sysroot, but I DO need to link against the QT libraries that will have been copied from the RPI to the build machines sysroot. Versus those in qt-raspi (the ones I built from Qt 6.4 source).

                                        D 1 Reply Last reply
                                        0
                                        • D davethomaspilot

                                          @davethomaspilot I guess I don't really need new sysroot, but I DO need to link against the QT libraries that will have been copied from the RPI to the build machines sysroot. Versus those in qt-raspi (the ones I built from Qt 6.4 source).

                                          D Offline
                                          D Offline
                                          davethomaspilot
                                          wrote on last edited by
                                          #21

                                          @davethomaspilot The makefile for my app has the fully qualified QT library names in it:

                                          LIBS          = $(SUBLIBS) -lpigpio -lrt -L/home/davethomaspilot/StartLights/branches/HJJ/../../../build-rpi_ws281x-LightTree-Debug/ -lws2811 /home/davethomaspilot/qt-raspi/lib/libQt6OpenGL.so /home/davethomaspilot/qt-raspi/lib/libQt6PrintSupport.so /home/davethomaspilot/qt-raspi/lib/libQt6Widgets.so /home/davethomaspilot/qt-raspi/lib/libQt6Gui.so -lEGL /home/davethomaspilot/qt-raspi/lib/libQt6Xml.so /home/davethomaspilot/qt-raspi/lib/libQt6SerialPort.so /home/davethomaspilot/qt-raspi/lib/libQt6Sql.so /home/davethomaspilot/qt-raspi/lib/libQt6Core.so -lpthread -lGLESv2   
                                          AR            = aarch64-linux-gnu-ar cqs
                                          

                                          I guess I can edit that file to link against the libs from the rpi repo install?

                                          But, I don't understand how the file names got into the Makefile. There is nothing I can find in the .pro file that references anything in qt-raspi.

                                          D 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