error while loading shared libraries: libQt5Mqtt.so.5: cannot open shared object file: No such file or directory



  • Hi.
    I am using Qt 5.9.1,i am trying to connect MS Azure IoT Hub using QMqtt Protocol through the Boot2Qt device , while running this application to device, i am getting this error like

    error while loading shared libraries: libQt5Mqtt.so.5: cannot open shared object file: No such file or directory
    

    i have already installed Mqtt library and i am following this link to connect Ms Azure IoT Hub.

    Please help me..

    Thanks



  • @Naveen-T
    From the error message, it may be that it cannot locate libQt5Mqtt.so.5 (where is that file on your system, and how are programs supposed to find it?). However, I have also seen this kind of message if one of the library's dependencies cannot be found. So run an ldd <path-to>/libQt5Mqtt.so.5 and verify it does not report any as missing?



  • @JonB
    When i am trying to run ldd <path-to>/libQt5Mqtt.so.5 this it replying as

    not a dynamic executable
    

    Thanks



  • @Naveen-T
    Well that doesn't look good, does it?! What does file <path-to>/libQt5Mqtt.so.5 report?



  • @JonB
    The file libQt5Mqtt.so.5 is present in system (inside Boot2Qt lib folder) but my program is unable to find it.

    Thanks


  • Lifetime Qt Champion

    Hi,

    But it doesn't mean that the file is valid hence the suggestion of @JonB to check it with the file command.



  • Hi @SGaist
    Thanks for reply,
    I checked that file command , it replying as

    /home/local/Qt/5.9.1/Boot2Qt/nitrogen6x/toolchain/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib/libQt5Mqtt.so.5: symbolic link to libQt5Mqtt.so.5.15.0
    
    

    I am not getting how to resolve. please help me out.
    Thanks



  • @Naveen-T

    I am not getting how to resolve. please help me out.

    Why don't you help yourself out? If it's a symbolic link, the first thing is to verify the file it points to. file even gives you a -L to save you work. So what does

    file -L /home/local/Qt/5.9.1/Boot2Qt/nitrogen6x/toolchain/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib/libQt5Mqtt.so.5
    

    report?

    My guess? 50%, the file pointed to by the symbolic link does not exist, after all the original message was No such file or directory....



  • @JonB As you told to check

    "file -L  <path-to>/libQt5Mqtt.so.5"
    

    this file reporting like this

     <path-to>/libQt5Mqtt.so.5 : ELF 32-bit LSB shared object, ARM, EABI5 version 1 (GNU/Linux), dynamically linked, BuildID[sha1]=c48b16491d020bdc39946b012c7f0ae9038652e9, stripped
    

    Thank you



  • @Naveen-T
    OK, so we go back to the original message you reported (that's still the case, isn't it?):

    error while loading shared libraries: libQt5Mqtt.so.5: cannot open shared object file: No such file or directory
    

    together with

    When i am trying to run ldd <path-to>/libQt5Mqtt.so.5 this it replying as

    not a dynamic executable

    According to me, ldd does follow symbolic links, so I don't understand how your ldd can return "not a dynamic executable" when file says "dynamically linked".

    I have to say i am still concerned as to what paths you are testing. I would try exactly (please use copy & paste) the following two commands one more time:

    file /home/local/Qt/5.9.1/Boot2Qt/nitrogen6x/toolchain/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib/libQt5Mqtt.so.5.15.0
    
    ldd /home/local/Qt/5.9.1/Boot2Qt/nitrogen6x/toolchain/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib/libQt5Mqtt.so.5.15.0
    


  • @JonB

    Same result am getting like ldd returns " not a dynamic executable " and file returns "dynamically linked, " .
    This is the complete error i m getting

    /opt/<myProjectName>/bin/<myProjectName>: error while loading shared libraries: libQt5Mqtt.so.5: cannot open shared object file: No such file or directory
    

    do I need to create same structure in my project??



  • @Naveen-T
    No, I think you need to resolve this error!

    Look, I know nothing about your "target devices" etc. I don't even know where you are running the ldd/file commands, I'm thinking you have cross-compilation involved. Is it possible that, on whatever machine you run those from, the "ELF, ARM, EABI5" is not a "dynamic executable" because it is for a different architecture??

    Apart from that, I think I will bow out, because I have no idea what situation you are in....



  • @Naveen-T said in error while loading shared libraries: libQt5Mqtt.so.5: cannot open shared object file: No such file or directory:

    i have already installed Mqtt library

    Please tell us how you installed that library, and where in the device it got installed.

    In addtion, could you describe what device it is?



  • @Pablo-J-Rogina @JonB

    I installed the "QMqtt" using this link and it worked fine for desktop. Now m trying to cross compile it for development kit (Variscite Devlopment kit) and wanted to deploy to it. So for that i have installed QMqtt in device platform folder as explained in above link. I found the issue when m going to create an object of QMqttClient and try to call any function of MqttClient class.

    QMqttClient *client;
    client->setPort(8883);
    

    Thank You



  • @Naveen-T from that topic you referred, it's not clear for me if the OP is cross-compiling (I guess not in that case).

    Since you didn't mention yet, are you cross-compiling Qt for this Variscite device? (I guess yes due to .../toolchain/sysroots/... in your previous post)



  • @Pablo-J-Rogina Yes i am cross compiling Qt for Variscite device. So i need to add or install those all files inside device?


  • Qt Champions 2018

    @Naveen-T said in error while loading shared libraries: libQt5Mqtt.so.5: cannot open shared object file: No such file or directory:

    install those all files inside device?

    Yes, and your sysroot if you want to cross compile.



  • @Naveen-T said in error while loading shared libraries: libQt5Mqtt.so.5: cannot open shared object file: No such file or directory:

    So i need to add or install those all files inside device?

    For cross-compilation you need your libraries + headers installed properly in target device, then copy (synchronize) some folders from your target device into the sysroot folder in your host PC and only then attempt to build (cross-compile) any component (Qt framework, MQTT modules, your application).

    Once you have the components created in your host PC (but prepared to be run in your target device) then you need to make them available (copy or syncronize) them into the target!

    Please take a look at this guide for cross-compiling Qt for RPi; I know it's not your actual device but it may shade some light about the whole cross-compilation process


Log in to reply