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. Qt CrossCompile on raspberry pi shared library not found
Qt 6.11 is out! See what's new in the release blog

Qt CrossCompile on raspberry pi shared library not found

Scheduled Pinned Locked Moved Solved Mobile and Embedded
14 Posts 5 Posters 4.9k Views 5 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.
  • A arsinte_andrei

    I'm doing a project on my PC that is using a subdir project where I have the main program and few librarys.
    I've tried to run the program without any link to the library (run it from PC to pi) and is fine everything is working as it should. any way when I'm linking the libraryes then is telling me that it can not vint and load the library. the library are in the same folder as the program witch is /home/pi/myApp/

    in my pro I have

    target.path = /home/pi/myApp/
    INSTALLS += target
    
    LIBS += -L/home/pi/myApp/
    
    INCLUDEPATH += \
            $$PWD/mainApp \
            $$PWD/firstPlugIn \
            $$PWD/secondPlugIn \
            $$PWD/thirdPlugIn
    

    now only in the pro of the mainApp I have the following to load the librarys

    #LIBS +=
    #        -L/home/pi/myApp/ -lfirstPlugIn \
    #        -L/home/pi/myApp/ -lsecondPlugIn \
    
    
    unix:LIBS += -L/home/pi/myApp/ -lfirstPlugIn
    
    unix:{
      QMAKE_LFLAGS += -Wl,--rpath=/home/pi/myApp/
    #  QMAKE_LFLAGS_RPATH =
    }
    
    

    On run config in Qt I've even added the

    LD_LIBRARY_PATH  /home/pi/myApp
    

    but nothing seams to be working.
    I want my library to be in the folder with my main program or in a subfolder of it.
    What I have to do in this case???

    K Offline
    K Offline
    koahnig
    wrote on last edited by
    #2

    @arsinte_andrei

    Not really sure what does not work.

    Anyhow one thing strikes

    #LIBS +=
    #        -L/home/pi/myApp/ -lfirstPlugIn \
    #        -L/home/pi/myApp/ -lsecondPlugIn \
    

    First the statements are commented out with the hash tag.
    Second, if you remove the hash tag it is not correct. The "LIBS +=" statement is standing alone. The next two lines are connected, but only with each other by the continuation mark (backslash) at the end of line.
    Possibly all an error due your attempts to get it work. However, if you want to make those statements work, you need to write it as

    LIBS += \
            -L/home/pi/myApp/ -lfirstPlugIn \
            -L/home/pi/myApp/ -lsecondPlugIn
    

    the last backslash continued into an empty line, which should not cause problems, but it is not required.

    Vote the answer(s) that helped you to solve your issue(s)

    A 1 Reply Last reply
    2
    • K koahnig

      @arsinte_andrei

      Not really sure what does not work.

      Anyhow one thing strikes

      #LIBS +=
      #        -L/home/pi/myApp/ -lfirstPlugIn \
      #        -L/home/pi/myApp/ -lsecondPlugIn \
      

      First the statements are commented out with the hash tag.
      Second, if you remove the hash tag it is not correct. The "LIBS +=" statement is standing alone. The next two lines are connected, but only with each other by the continuation mark (backslash) at the end of line.
      Possibly all an error due your attempts to get it work. However, if you want to make those statements work, you need to write it as

      LIBS += \
              -L/home/pi/myApp/ -lfirstPlugIn \
              -L/home/pi/myApp/ -lsecondPlugIn
      

      the last backslash continued into an empty line, which should not cause problems, but it is not required.

      A Offline
      A Offline
      arsinte_andrei
      wrote on last edited by
      #3

      @koahnig

      I've tried that and is not working.. is commented out because now I'm using

      unix:LIBS += -L/home/pi/myApp/ -lfirstPlugIn
      

      witch is doing the same thing. instead of all 3 library I'm trying to figure out at least one. thel all other will be the same. but at the moment none of them seams to work (only if I'll put my libs in the lib folder witch I do not want. I want my libs in my own lib folder not the linux one)

      It was commented out because I'm using the second bit..
      any way at the moment nothing is working same error can not find teh lib firstPlugIn.

      any help highly apreciated

      K 1 Reply Last reply
      0
      • A arsinte_andrei

        @koahnig

        I've tried that and is not working.. is commented out because now I'm using

        unix:LIBS += -L/home/pi/myApp/ -lfirstPlugIn
        

        witch is doing the same thing. instead of all 3 library I'm trying to figure out at least one. thel all other will be the same. but at the moment none of them seams to work (only if I'll put my libs in the lib folder witch I do not want. I want my libs in my own lib folder not the linux one)

        It was commented out because I'm using the second bit..
        any way at the moment nothing is working same error can not find teh lib firstPlugIn.

        any help highly apreciated

        K Offline
        K Offline
        koahnig
        wrote on last edited by
        #4

        @arsinte_andrei

        If you are not working with different OS' I would not use too many switches. Just a personal advice.

        I am typically working on windows. However, as far as I remember is home some sort of a short cut which is being expended by the OS repectively the terminal you are using.

        If I am not completely wrong, you should try to use the complete name of the folder.

        Vote the answer(s) that helped you to solve your issue(s)

        A 1 Reply Last reply
        2
        • K koahnig

          @arsinte_andrei

          If you are not working with different OS' I would not use too many switches. Just a personal advice.

          I am typically working on windows. However, as far as I remember is home some sort of a short cut which is being expended by the OS repectively the terminal you are using.

          If I am not completely wrong, you should try to use the complete name of the folder.

          A Offline
          A Offline
          arsinte_andrei
          wrote on last edited by
          #5

          @koahnig
          thte error I'm getting is

          /home/andrei/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lfirstPlugIn
          

          Tried everithing I could think of including

          unix:QMAKE_RPATHDIR += /home/pi/myApp
          

          nothing is working

          K 1 Reply Last reply
          0
          • A arsinte_andrei

            @koahnig
            thte error I'm getting is

            /home/andrei/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lfirstPlugIn
            

            Tried everithing I could think of including

            unix:QMAKE_RPATHDIR += /home/pi/myApp
            

            nothing is working

            K Offline
            K Offline
            koahnig
            wrote on last edited by
            #6

            @arsinte_andrei

            Sorry, just saw that my memory failed on home. Again I am working on Windows and linux is scarcely used by me.

            According to the qmake manual the -L part, resepctively teh actual path does not have a slash at the end. Not sure if that could be the problem.
            Another issue are typically the names used. In that respect windows is less strict.

            Vote the answer(s) that helped you to solve your issue(s)

            A 1 Reply Last reply
            1
            • K koahnig

              @arsinte_andrei

              Sorry, just saw that my memory failed on home. Again I am working on Windows and linux is scarcely used by me.

              According to the qmake manual the -L part, resepctively teh actual path does not have a slash at the end. Not sure if that could be the problem.
              Another issue are typically the names used. In that respect windows is less strict.

              A Offline
              A Offline
              arsinte_andrei
              wrote on last edited by
              #7

              @koahnig
              the problem that I have is that on my PC I'm using a different pathe compared to RPI. maybe this is the problem .. but my program is intended to run on RPI.. so it has to be there.. and it has to be cross compiled and not native compiled... any sugestions??

              K 1 Reply Last reply
              0
              • A arsinte_andrei

                @koahnig
                the problem that I have is that on my PC I'm using a different pathe compared to RPI. maybe this is the problem .. but my program is intended to run on RPI.. so it has to be there.. and it has to be cross compiled and not native compiled... any sugestions??

                K Offline
                K Offline
                koahnig
                wrote on last edited by
                #8

                @arsinte_andrei
                I have posted a link to this post for someone else from the moderators. I have not enough knowledge to be of help, I fear.

                Vote the answer(s) that helped you to solve your issue(s)

                A 1 Reply Last reply
                1
                • K koahnig

                  @arsinte_andrei
                  I have posted a link to this post for someone else from the moderators. I have not enough knowledge to be of help, I fear.

                  A Offline
                  A Offline
                  arsinte_andrei
                  wrote on last edited by
                  #9

                  @koahnig
                  It create:

                  firstPlugIn.so
                  firstPlugIn.so.1
                  firstPlugIn.so.1.0
                  firstPlugIn.so.1.0.0
                  

                  but only the last one is the actual file, all other are just the links to it made by compiler (Qt Creator - qmake)
                  and also it put this files in the corect folder where they should be
                  remote pi: /home/pi/myApp/

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    arsinte_andrei
                    wrote on last edited by arsinte_andrei
                    #10

                    After a long and long search and searching others code I've found out how to make it work...

                    
                    CONFIG(debug, debug|release) {
                            ROUTDIR = debug
                    } else {
                            ROUTDIR = release
                    }
                    
                    CONFIG(plugin, plugin) {
                            build_pass:CONFIG(debug, debug|release) {
                                    TARGET = $$join(TARGET,,,_debug)
                    
                                    # Qt uses '_debug' for unix and 'd' for Windows
                                    # which is not reliably detectable (e.g.: abcd.dll)
                                    # unix: TARGET = $$join(TARGET,,,_debug)
                                    # else: TARGET = $$join(TARGET,,,d)
                            }
                    }
                    
                    CONFIG -= warn_off
                    CONFIG += warn_on
                    CONFIG += debug_and_release ordered embed_manifest_dll embed_manifest_exe
                    
                    target.path = /home/pi/myApp
                    INSTALLS += target
                    
                    DESTDIR = $$PWD/$$ROUTDIR
                    LIBS += -L$$PWD/$$ROUTDIR
                    
                    INCLUDEPATH += \
                            $$PWD/myApp\
                            $$PWD/firstPlugIn\
                            $$PWD/secondPlugIn\
                            $$PWD/thirdPlugIn
                    
                    LIBS += \
                            -lfirstPlugIn \
                            -lsecondPlugIn
                             -lthirdPlugIn
                    
                    

                    now is working on both... PC and raspberry pi
                    Many thanks for all hep

                    K 1 Reply Last reply
                    4
                    • mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #11

                      Thank you for updating so others can learn from it.

                      1 Reply Last reply
                      2
                      • A arsinte_andrei

                        After a long and long search and searching others code I've found out how to make it work...

                        
                        CONFIG(debug, debug|release) {
                                ROUTDIR = debug
                        } else {
                                ROUTDIR = release
                        }
                        
                        CONFIG(plugin, plugin) {
                                build_pass:CONFIG(debug, debug|release) {
                                        TARGET = $$join(TARGET,,,_debug)
                        
                                        # Qt uses '_debug' for unix and 'd' for Windows
                                        # which is not reliably detectable (e.g.: abcd.dll)
                                        # unix: TARGET = $$join(TARGET,,,_debug)
                                        # else: TARGET = $$join(TARGET,,,d)
                                }
                        }
                        
                        CONFIG -= warn_off
                        CONFIG += warn_on
                        CONFIG += debug_and_release ordered embed_manifest_dll embed_manifest_exe
                        
                        target.path = /home/pi/myApp
                        INSTALLS += target
                        
                        DESTDIR = $$PWD/$$ROUTDIR
                        LIBS += -L$$PWD/$$ROUTDIR
                        
                        INCLUDEPATH += \
                                $$PWD/myApp\
                                $$PWD/firstPlugIn\
                                $$PWD/secondPlugIn\
                                $$PWD/thirdPlugIn
                        
                        LIBS += \
                                -lfirstPlugIn \
                                -lsecondPlugIn
                                 -lthirdPlugIn
                        
                        

                        now is working on both... PC and raspberry pi
                        Many thanks for all hep

                        K Offline
                        K Offline
                        koahnig
                        wrote on last edited by
                        #12

                        @arsinte_andrei

                        I can follow only @mrjj and thank you for updating your post.

                        Well done.

                        Vote the answer(s) that helped you to solve your issue(s)

                        1 Reply Last reply
                        1
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #13

                          Hi,

                          IIRC, you can use $$qtLibraryTarget(name_of_the_library) to get the name of the library with the correct extension.

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

                          1 Reply Last reply
                          1
                          • B Offline
                            B Offline
                            Bremenpl
                            wrote on last edited by Bremenpl
                            #14

                            Hi, I am having simmilar problem to yours: https://forum.qt.io/topic/72844/could-not-load-shared-library-symbols
                            When I debug it still cannot find the symbols. I tried to set the LD_LIBRARY_PATH to /home/pi/ (this is where my executable is on the Raspberry Pi) but nothing changes. Could I please ask for help?

                            EDIT: I have partially solved the problem in the linked topic, maybe someone will find it usefull.

                            lprzenioslo.zut.edu.pl

                            1 Reply Last reply
                            1

                            • Login

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