QLibray load fails : no suitable image found



  • Hello everybody,
    I'm trying to load a dylib library using QLibrary load function

    QString strLibrary = QString("%1/secure.dylib").arg(qApp->applicationDirPath());
    
    myLib = new QLibrary(strLibrary);
    if(QLibrary::isLibrary(strLibrary)) // returs true
            qDebug() << "it's a valid library" ; // this message is shown
    

    but

    myLib->load()
    

    returns the following error :

    Cannot load library /Users/admin/SourceMediintel/build-autonome-Desktop_Qt_5_5_1_clang_64bit-Debug/Autonome.app/Contents/MacOS/secure.dylib: (dlopen(/Users/admin/SourceMediintel/build-autonome-Desktop_Qt_5_5_1_clang_64bit-Debug/Autonome.app/Contents/MacOS/secure.dylib, 5): no suitable image found.  Did find:\n\t/Users/admin/SourceMediintel/build-autonome-Desktop_Qt_5_5_1_clang_64bit-Debug/Autonome.app/Contents/MacOS/secure.dylib: no matching architecture in universal wrapper)
    

    I've verified the the secure.dylib properties with file and I've the following messages :

    /Users/admin/SourceMediintel/build-autonome-Desktop_Qt_5_5_1_clang_64bit-Debug/Autonome.app/Contents/MacOS/secure.dylib: Mach-O universal binary with 2 architectures
    /Users/admin/SourceMediintel/build-autonome-Desktop_Qt_5_5_1_clang_64bit-Debug/Autonome.app/Contents/MacOS/secure.dylib (for architecture ppc):	Mach-O dynamically linked shared library ppc
    /Users/admin/SourceMediintel/build-autonome-Desktop_Qt_5_5_1_clang_64bit-Debug/Autonome.app/Contents/MacOS/secure.dylib (for architecture i386):	Mach-O dynamically linked shared library i386
    

    I'm on Qt 5.5 x64

    Can anyone tell me what's wrong and how to fix it

    thanks in advance
    Best regards



  • @mourad_bilog said in QLibray load fails : no suitable image found:

    Mach-O dynamically linked shared library ppc
    Mach-O dynamically linked shared library i386

    Not very familiar with dylib files, but if you're on x64 architecture, it looks like you're missing the right binary for you, as it's stated here as well:

    no matching architecture in universal wrapper


  • Lifetime Qt Champion

    Hi,

    @Pablo-J-Rogina is right, your framework was built for 32bit processors. You have to rebuild it for x86-64.



  • Thanks for your clarifications.
    It's true that the library was build on another Mac OS and now I'm on a x64 Mac.
    So I'll rebuild it.

    Regards


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.