Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Executable library permission?
Forum Updated to NodeBB v4.3 + New Features

Executable library permission?

Scheduled Pinned Locked Moved Unsolved General and Desktop
13 Posts 5 Posters 1.3k 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.
  • I Offline
    I Offline
    IknowQT
    wrote on last edited by
    #1
    BASE_DIR=$(dirname "$(readlink -f "$0")")
    export LD_LIBRARY_PATH="$BASE_DIR"/lib/:"$BASE_DIR":$LD_LIBRARY_PATH
    export QML_IMPORT_PATH="$BASE_DIR"/qml/:$QML_IMPORT_PATH
    export QML2_IMPORT_PATH="$BASE_DIR"/qml/:$QML2_IMPORT_PATH
    export QT_PLUGIN_PATH="$BASE_DIR"/plugins/:$QT_PLUGIN_PATH
    export QTWEBENGINEPROCESS_PATH="$BASE_DIR"/bin//QtWebEngineProcess
    export QTDIR="$BASE_DIR"
    export CQT_PKG_ROOT="$BASE_DIR"
    export CQT_RUN_FILE="$BASE_DIR/PCR_.sh"
    
    export QT_QPA_PLATFORM_PLUGIN_PATH="$BASE_DIR"/plugins//platforms:$QT_QPA_PLATFORM_PLUGIN_PATH
    
    "$BASE_DIR/bin/PCR_" "$@"
    

    4bf39831-3c27-427f-9bae-776801423f77-image.png

    9314e79f-2c0e-40ab-b9dd-4577f6e2b11d-image.png

    I developed and built qt in Ubuntu and completed the distribution file. After copying this distribution file to USB, I installed Raspberry Pi Ubuntu OS on the Raspberry Pi board, and the USB executable file was pasted into Raspberry Pi Ubuntu. I did not have permission to sh, so I gave permission, and when I run the following, PCR_.sh: 34 /home/ubuntu/Desktop/PCR_E/bin/PCR_: Permission denied

    "$BASE_DIR/bin/PCR_" "$@" 
    

    The contents of line 34 are the path is correct and I need to give it permission, but it's a library file, so I don't know how to give permission.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      The file "PCR_" is not a library file, it is your program executable. It should have at least the u=rx attributes (but typically ugo=rx). You set the permissions the same way as you did for the shell script.

      I 1 Reply Last reply
      1
      • I Offline
        I Offline
        IknowQT
        wrote on last edited by
        #3
        This post is deleted!
        1 Reply Last reply
        0
        • C ChrisW67

          The file "PCR_" is not a library file, it is your program executable. It should have at least the u=rx attributes (but typically ugo=rx). You set the permissions the same way as you did for the shell script.

          I Offline
          I Offline
          IknowQT
          wrote on last edited by
          #4

          @ChrisW67
          If you give the executable file permission, an Exec format error occurs as an error message.

          JonBJ 1 Reply Last reply
          0
          • I IknowQT

            @ChrisW67
            If you give the executable file permission, an Exec format error occurs as an error message.

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by
            #5

            @IknowQT
            If that is really true, then either you are not setting execute permission on an executable file but rather something else, or you have compiled the executable for a different architecture. Also you cannot execute a library.

            You might want run file /path/to/the/executable on the target system to see what it says.

            I developed and built qt in Ubuntu and completed the distribution file. After copying this distribution file to USB, I installed Raspberry Pi Ubuntu OS on the Raspberry Pi board, and the USB executable file was pasted into Raspberry Pi Ubuntu.

            I don't know what "Raspberry Pi Ubuntu OS" is. But there is no guarantee that something compiled under Ubuntu will run on another Ubuntu machine if the architectures are different.

            I 1 Reply Last reply
            0
            • JonBJ JonB

              @IknowQT
              If that is really true, then either you are not setting execute permission on an executable file but rather something else, or you have compiled the executable for a different architecture. Also you cannot execute a library.

              You might want run file /path/to/the/executable on the target system to see what it says.

              I developed and built qt in Ubuntu and completed the distribution file. After copying this distribution file to USB, I installed Raspberry Pi Ubuntu OS on the Raspberry Pi board, and the USB executable file was pasted into Raspberry Pi Ubuntu.

              I don't know what "Raspberry Pi Ubuntu OS" is. But there is no guarantee that something compiled under Ubuntu will run on another Ubuntu machine if the architectures are different.

              I Offline
              I Offline
              IknowQT
              wrote on last edited by
              #6

              @JonB

              I think the architecture is different.
              ubuntu architecture is amd64 and ubuntu uploaded to raspberry pi is arm64
              Can you build from amd64 to arm64? not compatible?
              Or do I have to make a cross-compile?

              JonBJ 1 Reply Last reply
              0
              • I IknowQT

                @JonB

                I think the architecture is different.
                ubuntu architecture is amd64 and ubuntu uploaded to raspberry pi is arm64
                Can you build from amd64 to arm64? not compatible?
                Or do I have to make a cross-compile?

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by
                #7

                @IknowQT said in Executable library permission?:

                ubuntu architecture is amd64 and ubuntu uploaded to raspberry pi is arm64

                That would indeed explain "Exec format error"! :)
                Then you do indeed need to cross-compile on the original Ubuntu for the target ARM architecture.

                I 1 Reply Last reply
                0
                • JonBJ JonB

                  @IknowQT said in Executable library permission?:

                  ubuntu architecture is amd64 and ubuntu uploaded to raspberry pi is arm64

                  That would indeed explain "Exec format error"! :)
                  Then you do indeed need to cross-compile on the original Ubuntu for the target ARM architecture.

                  I Offline
                  I Offline
                  IknowQT
                  wrote on last edited by
                  #8

                  @JonB

                  Thanks for the reply, I'll talk about it here!
                  How do I cross-compile? Is it possible in qt creator?

                  JonBJ 1 Reply Last reply
                  0
                  • I IknowQT

                    @JonB

                    Thanks for the reply, I'll talk about it here!
                    How do I cross-compile? Is it possible in qt creator?

                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by
                    #9

                    @IknowQT
                    I don't know because I have never done it, but, yes, it is certainly possible in Qt Creator. Until somebody answers specifically here, you might start by Googling qt gcc cross compile arm, or more specifically cross compile qt for raspberry pi seems to lead to various hits.

                    1 Reply Last reply
                    0
                    • sierdzioS Offline
                      sierdzioS Offline
                      sierdzio
                      Moderators
                      wrote on last edited by
                      #10

                      Wow we're thread-jumping a lot in here :D

                      Here's something to start with: https://wiki.qt.io/RaspberryPi2EGLFS in your case, large parts of this guide will be different (it's a different OS, different toolchain (take Linaro instead of Raspberry Pi OS toolchain which is super outdated) etc.), libs might be different) but with some tweaking it should work.

                      (Z(:^

                      I 1 Reply Last reply
                      1
                      • sierdzioS sierdzio

                        Wow we're thread-jumping a lot in here :D

                        Here's something to start with: https://wiki.qt.io/RaspberryPi2EGLFS in your case, large parts of this guide will be different (it's a different OS, different toolchain (take Linaro instead of Raspberry Pi OS toolchain which is super outdated) etc.), libs might be different) but with some tweaking it should work.

                        I Offline
                        I Offline
                        IknowQT
                        wrote on last edited by
                        #11

                        @sierdzio

                        I'm not using Raspbian OS, I just installed Ubuntu on a Raspberry board. I have two Ubuntus, they are different architectures.
                        Can you tell me how to cross-compile in this case?

                        sierdzioS 1 Reply Last reply
                        0
                        • I IknowQT

                          @sierdzio

                          I'm not using Raspbian OS, I just installed Ubuntu on a Raspberry board. I have two Ubuntus, they are different architectures.
                          Can you tell me how to cross-compile in this case?

                          sierdzioS Offline
                          sierdzioS Offline
                          sierdzio
                          Moderators
                          wrote on last edited by
                          #12

                          @IknowQT said in Executable library permission?:

                          @sierdzio

                          I'm not using Raspbian OS, I just installed Ubuntu on a Raspberry board. I have two Ubuntus, they are different architectures.

                          I know, that's why I said those instructions won't work exactly as provided.

                          Can you tell me how to cross-compile in this case?

                          No, sorry, it's too much effort. I would have to do it all myself, too, to verify the information, and I don't have time for it now.

                          A high level summary is:

                          • update your RPi Ubuntu with dev packages (sudo apt build-dep qt5-default)
                          • get a toolchain from Linaro, for ARMHF or ARM64 architecture (depending on what your Ubuntu on RPi is using)
                          • get a sysroot (rsync the whole OS from your Raspberry to your desktop)
                          • get Qt (single tarball from archives, for example https://download.qt.io/archive/qt/5.15/5.15.2/single/qt-everywhere-src-5.15.2.tar.xz)
                          • extract Qt
                          • run configure with correct flags (take ones from the EGLFS guide, but it probably won't work out of the box. Lots of trial and error and frustration will surely follow!)
                          • run make -j numberOfCpuCores
                          • run make install
                          • rsync your Qt installation back to RPi (you need to copy contents of folder you specified as -extprefix to folder on RPi you specified in -prefix)

                          Now you will have a working, cross-compiled Qt. You can add it to Qt Creator:

                          • add compiler (Linaro)
                          • add Qt version (your qmake is in folder you specified as -hostprefix)
                          • add kit

                          With that, you will have a working cross-compilation environment on your desktop Ubuntu. Each compiled binary you will have to send to RPi to run (this can be automated in Qt Creator, too).

                          Good luck!

                          (Z(:^

                          1 Reply Last reply
                          3
                          • artwawA Offline
                            artwawA Offline
                            artwaw
                            wrote on last edited by
                            #13

                            you might find it easier to install Qt on your raspi, together with the creator, then just use Remote Desktop session for developing directly on the raspi.

                            For more information please re-read.

                            Kind Regards,
                            Artur

                            1 Reply Last reply
                            4

                            • Login

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