Skip to content
  • 0 Votes
    4 Posts
    883 Views
    jsulmJ

    @ishi Visual Studio is of no interest here as you cannot use it to cross compile to ARM Linux as far as I know. If your app is using OpenCV you will either need to install it on your RPi (including the -dev package) and sync the sysroot, or cross-compile it.

  • 1 Votes
    5 Posts
    3k Views
    EndrII 0E

    I find solution
    Your need to add qt path into CMAKE_FIND_ROOT_PATH variable.

    cmake -DCMAKE_FIND_ROOT_PATH=yuor/qt/path .

    i think that trouble in the android.toolchain.cmake file. This toolchain overwrite the CMAKE_PREFIX_PATH variable.

  • 0 Votes
    26 Posts
    5k Views
    J

    Finally (!...) I was able to fix the problems. I'm showing the whole procedure, not only what relates to the main subject of this thread so that to contribute to the community..

    I was using the following sites as a source information to work out the following solution: LINK1 (for other Qt/Raspberry PI configuration check: link), LINK2, LINK3, LINK4, LINK5, LINK6.

    My hardware/software:

    Host:
    Ubuntu 18.04 (also I’ve check it on Ubuntu 20.04 and it also works)
    Qt ver. 5.12.3 (I also tried 5.12.9, but it didn’t work, probably there was something wrong with the fix that needs to be done on the sources) - you can install the “sources” and all the modules you need from Qt Online Installer (link) because later on you can add/remove modules/versions easily by lauching ~/Qt/MaintenanceTool
    QtCreator will be installed automatically (the newest version) when you use Qt Online Installer

    Target:
    Raspberry PI 3, with Raspbian Stretch

    Procedure:

    [on RPi] Edit sources list in /etc/apt/sources.list and uncomment the deb-src line: sudo nano /etc/apt/sources.list [on RPi] Update your system and install required libraries: sudo apt-get update sudo apt-get build-dep qt4-x11 sudo apt-get build-dep libqt5gui5 sudo apt-get install libudev-dev libinput-dev libts-dev libxcb-xinerama0-dev libxcb-xinerama0

    After installing MySQL itself on RPi install also MySQL libraries/packages to be used by Qt:

    sudo apt install mariadb-client libmariadb-dev-compat libqt5sql5-mysql [on RPi] Prepare our target directory sudo mkdir /usr/local/qt5pi sudo chown pi:pi /usr/local/qt5pi [on RPi] Correct links to EGL and GLES Drivers sudo rm /usr/lib/arm-linux-gnueabihf/libEGL.so.1.0.0 sudo rm /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0 sudo ln -s /opt/vc/lib/libbrcmEGL.so /usr/lib/arm-linux-gnueabihf/libEGL.so.1.0.0 sudo ln -s /opt/vc/lib/libbrcmGLESv2.so /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0 [on host] Create our working directory and get a toolchain: mkdir ~/raspi cd ~/raspi git clone https://github.com/raspberrypi/tools [on host] Create a sysroot. mkdir sysroot sysroot/usr sysroot/opt rsync -avz pi@yourpi:/lib sysroot rsync -avz pi@yourpi:/usr/include sysroot/usr rsync -avz pi@yourpi:/usr/lib sysroot/usr rsync -avz pi@yourpi:/opt/vc sysroot/opt [on host] Adjust symlinks to be relative: wget https://raw.githubusercontent.com/riscv/riscv-poky/master/scripts/sysroot-relativelinks.py chmod +x sysroot-relativelinks.py ./sysroot-relativelinks.py sysroot [on host] Modify the qmake.conf –> mkspecs/devices/linux-rasp-pi3-g++/qmake.conf nano ~/raspi/qtbase/mkspecs/devices/linux-rasp-pi3-g++/qmake.conf

    VC_LIBRARY_PATH = $$[QT_SYSROOT]/opt/vc/lib
    VC_INCLUDE_PATH = $$[QT_SYSROOT]/opt/vc/include

    VC_LINK_LINE = -L$${VC_LIBRARY_PATH}

    QMAKE_LIBDIR_OPENGL_ES2 = $${VC_LIBRARY_PATH}
    QMAKE_LIBDIR_EGL = $$QMAKE_LIBDIR_OPENGL_ES2
    QMAKE_LIBDIR_OPENVG = $$QMAKE_LIBDIR_OPENGL_ES2

    [on host] Protect your “sources” by creating working folder: cd ~/Qt/5.12.3 tar jcvf qt-5.12.3-src.tar.bz2 Src cd ~/raspi tar xvf ~/Qt/5.12.3/qt-5.12.3-src.tar.bz2 mv Src qt-5.12.3-src

    You can remove from qt-5.12.3-src the modules that you don’t want (at least for now) leaving qtbase folder - this will shorten the building process.
    Create also working folder for the building (if building would be unsuccessful all you need to do is to delete the content of this folder and start again):

    mkdir ~/raspi/build_raspi cd ~/raspi/build_raspi [on host] Configure
    From ~/raspi/build_raspi ../qt-5.12.3-src/configure -release -opengl es2 -device linux-rasp-pi3-g++ -device-option CROSS_COMPILE=~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf- -sysroot ~/raspi/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix ~/raspi/qt5pi -hostprefix ~/raspi/qt5 -no-use-gold-linker -v -no-gbm -sql-mysql MYSQL_INCDIR=~/raspi/sysroot/usr/include/mysql MYSQL_LIBDIR=~/raspi/sysroot/usr/lib/arm-linux-gnueabihf

    Notice the above contains also building MySQL driver.

    Notice that the Config summary should contain (if it doesn't, you need to correct something... and do the configure again):
    EGLFS Raspberry Pi ................... yes
    MySql .................................. yes

    Regarding “-release” parameter read here (in other words you don’t need “-debug-and-release” and the warnings you can ignore… at least this is what I can read at the forum).

    [on host] Make
    From ~/raspi/build_raspi make

    You can use make -j 8 instead (much faster), but if there will be problems the all the “jobs” would need to finish and consequently it could be more difficult to find the error messages.

    [on host] Make install
    From ~/raspi/build_raspi: make install [on host] Deploy Qt to the device. We simply sync everything from ~/raspi/qt5pi to the prefix we configured above
    From ~/raspi: rsync -avz qt5pi pi@192.168.1.100:/usr/local [on host] Configuration of QtCreator: Tools > Options > Devices > Add > Generic Linux Device > Start Wizard Write: “Raspberry” (your custom name), “192.168.X.X” (your Raspberry PI address), “pi” (your Raspberry PI user) Don’t write anything at “private key”, click “Next” There will be error window with: “Device test failed” > Cancel Authentication type → choose: “Default” Now test connection (“Test” button) and after you give the password to the RPi it should be successful Kits > Compilers > Add > GCC > C Write: “GCC (Raspberry Pi)” as your custom name and: “~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gcc” as the path to the compiler Kits > Compilers > Add > GCC > C++ Write: “G++ (Raspberry Pi)” as your custom name and: “~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++” as your path to the compiler Regarding the debugger, you should install:
    [On Host]: sudo apt-get install gdb-multiarch

    I’m not sure if this is needed but you can also install on RPi:

    sudo apt-get install gdbserver Kits > Debuggers > Add Write: “GDB (Raspberry Pi)” as your custom name and “/usr/bin/gdb-multiarch” as the path to the debugger Apply Kits > Qt Version > Add Write path: ~/raspi/qt5/bin/qmake Write name: Qt %{Qt:Version} (qt5) Raspberry PI Apply Kits > Kits > Add Name: Raspi Device Type: Generic Linux Device The Device is the one created in the previous step We set the Sysroot to where we have the sysroot image: ~/raspi/sysroot Set compilers: "GCC (Raspberry PI)" and "G++ (Raspberry PI)" Set the Debugger to the one created previously Use the Qt version we created previously We don't need to set mkspec, so leave it empty. OK To enable your running application to have regular window do the following:
    Projects > Raspberry PI > Run > Environment > Batch Edit: DISPLAY=:0.0 QT_QPA_PLATFORMTHEME=qt5ct XAUTHORITY=/home/pi/.Xauthority XDG_SESSION_TYPE=x11

    If you don’t do this your application after starting up will be shown full screen but you will see it only when directly connect a screen to Raspberry PI (VNC desktop sharing will show nothing)
    14) [on host] In your Raspberry PI project, in .pro file, you need to show where the executable file should be placed: (LINK):

    target.path = /home/pi INSTALLS += target

    So comment the previous settings, eg.:

    # qnx: target.path = /tmp/$${TARGET}/bin # else: unix:!android: target.path = /opt/$${TARGET}/bin # !isEmpty(target.path): INSTALLS += target [on host] If you get: “WARNING: The code model could not parse a included file, which might lead to incorrect code completion and highlighting”:
    You need to deselect “ClangCodeModel” in HELP > ABOUT PLUGINS and restart QtCreator (LINK). You should be able to build/run/debug your project on RPi and connect to the MySQL database without "QMYSQL driver not loaded" error.
  • 0 Votes
    8 Posts
    1k Views
    K

    @sierdzio Ok, i see, I'm using open source. Maybe I need to change a deviece or try to use qwidget. Thanks for your patience.

  • 0 Votes
    2 Posts
    1k Views
    pauleddP

    I somehow workaround it.
    On the RaspberryPi I created a bash script in /usr/bin:

    /usr/bin/x5

    #!/bin/bash xhost +local: sudo /home/pi/adas0002 --platform xcb

    I made it executable and then on my Desktop-Pc in Qt-Creator
    I have "/usr/bin/x5" in "Alternate executable on device".

    Now my application starts with root even without invoking any terminal.
    I know this is very bad in security point of view but I dont care on my little offline
    Raspi...

  • 0 Votes
    2 Posts
    2k Views
    K

    @Lior

    Hi and welcome to devnet forum

    Do you have a cross-compiler for cross-compilation on windows for linux? There are certainly cross-compilers available. You would have to cross-compile Qt libs with that cross-compiler. After this you can use the cross-compile toolchain and do a cross-compilation for your applications.

    My personal recommendation is to use virtual machine e.g. VirtualBox and setup the linux environment. Use Qt creator on linux and on windows. You will have the same look and feel in both environments. That is how I do my developments. All is done on windows. However, targeting linux desktop and embedded linux I do the compilation on linux desktop. The reason is lesser pain.

  • 0 Votes
    26 Posts
    6k Views
    jsulmJ

    @vishbynature It's config.log file located in the same directory from which you called configure. It is a text file, nothing special. Look for compile errors in that file related to to what you need.

  • 0 Votes
    5 Posts
    1k Views
    A

    @Pablo-J-Rogina
    I will look into it.

  • 0 Votes
    6 Posts
    1k Views
    IMAN4KI

    Seems to be a bug reported here QTBUG-50244

    Nobody tried to integrate MySQL for a Raspberry Pi project already ?! no workaround?!
    Seems strange :(

  • 0 Votes
    7 Posts
    1k Views
    A

    @sneubert Thanks :)

  • 0 Votes
    5 Posts
    3k Views
    A

    Hi,

    Absolutely, in the same creator session I can toggle between toolchains, Desktop is fine, but Raspberry Pi is giving the aforementioned problem.

    This is my setup.

    Build settings:

    0_1553262032384_d234256c-f6e3-4acc-b861-0d5153f80f23-image.png

    0_1553262575907_7783d3e3-39a4-4a2b-aeb7-1c640598b17a-image.png

    PATH: /home/ubuntuvm/raspi/qt5/bin:/home/ubuntuvm/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/bin

    Kit:

    0_1553262136401_a8f684d0-8005-41d0-bc94-de018e3acb28-image.png

    Device:
    0_1553262784829_a5f27b5f-bf3a-49c7-ac08-492f4ef2294d-image.png

    Qt Versions:
    0_1553262183514_7324f48e-e118-4fbd-b86b-1624dbe84544-image.png

    Compilers:
    0_1553262236958_3e5d5c9f-8dc7-4338-b094-cd6c40d6fcc9-image.png

    0_1553262396408_495b7c91-9b03-4db2-9ec8-2c84ca13b1c3-image.png

    Compiler Path (C & C++):
    /home/ubuntuvm/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/bin/gcc

    Debuggers:
    0_1553262259546_0a0a3f73-c0d0-48b8-990c-8cd188d9f208-image.png

    Qbs:
    0_1553262324062_2ee32585-94a3-4b22-a956-0f44ed63657e-image.png

  • 0 Votes
    4 Posts
    1k Views
    SGaistS

    The thing is, it seems to be looking at the libm.so.6 of your machine and not the one from the sysroot.

  • 0 Votes
    5 Posts
    1k Views
    P

    @SGaist Ahh, okay I see it.

    Clone Build Config -> Delete Build Steps -> add Custom Process Step

    Thanks for the inspiration!

  • 0 Votes
    10 Posts
    23k Views
    J.HilkJ

    @Tranquil
    I don't know how you read your text-file. But if it is for example with QTextStream, you coulc read line by line, call QString QString::simplified() const on it. that removes all leading and trailing whitespaces and reduces al other whitespaces to a simple single space. That should include tab and multiple spaces.

    Than QString::splitRef(QChar::Space); on it and you have a vector of all your entries (in StringRef format) -> convert it to your container.

  • 0 Votes
    3 Posts
    1k Views
    Cleiton BuenoC

    @Saman19 said in Qt on MarsBoard, Cross compile error, Socket can fd:

    Note: QtSerialBus: Newer kernel needed for flexible data-rate frame support (canfd_frame).

    It does not seem to me a problem but an informative note.

    If you do not use CAN, check:

    Is Kernel Network CAN enabled? Something like: Networking support ---> <M> CAN bus subsystem support ---> --- CAN bus subsystem support <M> Raw CAN Protocol (raw access with CAN-ID filtering) <M> Broadcast Manager CAN Protocol (with content filtering) CAN Device Drivers ---> <M> Virtual Local CAN Interface (vcan) <M> Platform CAN drivers with Netlink support

    Mandatory, because under the kernel is the SocketCAN that handles this.

    Install the can-utils package

    It is necessary to include / install QtSerialPort, not for CAN but for ModBus that is part of QtSerialBus.

    Cleiton Bueno

    Blog | Linkedin | B2Open

  • 0 Votes
    6 Posts
    3k Views
    W

    I have found a solution here.
    Looks like Ubuntu couldn't run 32bit binary, but it's working now.

  • 0 Votes
    13 Posts
    9k Views
    V

    I have checked the source code of the qmakeevaluator and the changes are present in version 5.9.1, still it does not recognize the platform. Even if I try to hardcode to the qmake evaluator the following:

    vars[ProKey("QMAKE_TARGET.arch")] = ProString("x86");

    It does not change a thing, still tries to link qmake to x64.

  • 0 Votes
    2 Posts
    2k Views
    W

    Hi ! I have the same problem. The QT included in the last IMG doesn't include a Qmake file. So when I compile like you, it give the same error cause we need to interface with the supplied proprietary libs in /opt I think.
    On the Raspberry Pi, we need to interface with the VC libs in opt/ to correctly initialise with hardware acceleration, but VC libs are only for the Broadcom chipset on the Pi. On my NanoPI, it is a S5P4418, with a Nexell backend. Maybe we have to do the same with the Nexell libs included on the IMG ? I have a Fire2A and a S2, not sure you have the same configuration as me.
    Qt recognize EGL and OpenGLES 2 but can't seem to open a display without these libs.