Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

dyld: Library not loaded: @executable_path/libfbxsdk.dylib



  • Hello:
    I developed a project in Mac Qt which transplanted from windows qt,now I and build project without errors,my project is Mac App project,when I finished build it,it nothing display for me,so I doubleclick the project's exec in Terminal,it shows:

    dyld: Library not loaded: @executable_path/libfbxsdk.dylib
    Referenced from: /Users/lee/Desktop/VisualStudio/FUEditor/build-FUEditor-Desktop_Qt_5_11_3_clang_64bit-Debug/FUEditor
    Reason: image not found
    [1] 7676 abort

    in my .pro,the information about fbxsdk is here:

    fbxsdk

    macx: LIBS += -L/Applications/Autodesk/FBXSDK/2019.2/lib/clang/debug/ -lfbxsdk
    INCLUDEPATH += /Applications/Autodesk/FBXSDK/2019.2/include
    DEPENDPATH += /Applications/Autodesk/FBXSDK/2019.2/include
    macx: PRE_TARGETDEPS += /Applications/Autodesk/FBXSDK/2019.2/lib/clang/debug/libfbxsdk.a

    how to fix it,thanks a lot!


  • Qt Champions 2017

    macx: LIBS += -L/Applications/Autodesk/FBXSDK/2019.2/lib/clang/debug/ -lfbxsdk

    This solves only your compilation & linking issue. Error here indicates that fbxsdk is not in the path. Either copy the lib where executable exist or set the runtime path so that lib is available.



  • Thanks for help,now add the libfbxsdk.dylib to the 'build-FUEditor-Desktop_Qt_5_11_3_clang_64bit-Debug' folder,and I doubleclick the project's exec in Terminal,it shows no errors,but I can't see anything in my screen.it's so sad,because my the project is a Mac app,the infomation about my project is here:

    the .pro file

    TEMPLATE = app
    TARGET = FUEditor
    QT += core opengl widgets gui network
    DEFINES += QT_DLL QT_OPENGL_LIB QT_WIDGETS_LIB

    SUBDIRS += FUEditor
    include(FUEditor.pri)
    OBJECTS_DIR += release
    UI_DIR += ./GeneratedFiles
    RCC_DIR += ./GeneratedFiles

    TRANSLATIONS+=cn.ts
    CONFIG += c++11
    CONFIG -=app_bundle
    CONFIG += link_pkgconfig
    PKGCONFIG += opencv

    INCLUDEPATH += $$PWD/GeneratedFiles
    $$PWD/algorithm/FreeImage/
    $$PWD/algorithm/Renderable/
    $$PWD/algorithm/
    $$PWD/
    ./GeneratedFiles/Release\

    the Application output :

    14:38:00: Starting /Users/lee/Desktop/VisualStudio/FUEditor/build-FUEditor-Desktop_Qt_5_11_3_clang_64bit-Debug/FUEditor...
    14:38:00: /Users/lee/Desktop/VisualStudio/FUEditor/build-FUEditor-Desktop_Qt_5_11_3_clang_64bit-Debug/FUEditor exited with code 0

    and there is nothing in '../build-FUEditor-Desktop_Qt_5_11_3_clang_64bit-Debug/FUEditor.app/content/MacOS/' folder,thanks a lot!


  • Qt Champions 2017

    @Princein said in dyld: Library not loaded: @executable_path/libfbxsdk.dylib:

    ./build-FUEditor-Desktop_Qt_5_11_3_clang_64bit-Debug/FUEditor.app/content/MacOS/' f

    Your CONFIG = -app_bundle. So nothing will exist on that folder. You can change the DESTDIR = /Users/princein/dbins

    Compile the program. Also copy your library to this directory. Try to run the app from the directory. Try to put some debug statements in side the main.cpp. Check it.



  • @dheerendra
    Thanks for help,

    'Try to put some debug statements in side the main.cpp',I have no idea put what debug statements in the main.cpp,I can't see any information about why the app dose not start


  • Lifetime Qt Champion

    Hi,

    What does your main.cpp look like ?



  • if you call macdeployqt, it will fix your paths for you, otherwise you have to fix your own paths with something like this:

    install_name_tool -change fbxsdk.dylib @loader_path/../**SharedSupport**/fbxsdk.dylib "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}";
    

    note that SharedSupport is a guess, it may be in Frameworks, it may not have been copied yet?



  • @davecotter
    Thanks for your help!

    I use otool -L with my execute file of my FUEditor App in the terminal,it shows :

    āžœ ~ otool -L /Users/lee/Desktop/VisualStudio/FUEditor/Build/FUEditor.app/Contents/MacOS/FUEditor
    /Users/lee/Desktop/VisualStudio/FUEditor/Build/FUEditor.app/Contents/MacOS/FUEditor:
    /usr/local/opt/boost/lib/libboost_system.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/local/opt/boost/lib/libboost_filesystem-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
    /System/Library/Frameworks/AVFoundation.framework/Versions/A/AVFoundation (compatibility version 1.0.0, current version 2.0.0)
    /System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate (compatibility version 1.0.0, current version 4.0.0)
    /System/Library/Frameworks/CoreMedia.framework/Versions/A/CoreMedia (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1560.12.0)
    /System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo (compatibility version 1.2.0, current version 1.5.0)
    /usr/local/opt/freeimage/lib/libfreeimage.dylib (compatibility version 3.0.0, current version 3.18.0)
    @executable_path/libfbxsdk.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/local/opt/glew/lib/libGLEW.2.1.dylib (compatibility version 2.1.0, current version 2.1.0)
    /usr/local/opt/opencv/lib/libopencv_stitching.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_superres.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_videostab.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_aruco.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_bgsegm.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_bioinspired.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_ccalib.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_dnn_objdetect.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_dpm.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_face.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_photo.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_fuzzy.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_hfs.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_img_hash.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_line_descriptor.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_optflow.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_reg.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_rgbd.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_saliency.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_stereo.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_structured_light.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_phase_unwrapping.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_surface_matching.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_tracking.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_datasets.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_dnn.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_plot.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_xfeatures2d.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_shape.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_video.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_ml.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_ximgproc.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_calib3d.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_features2d.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_highgui.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_videoio.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_flann.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_xobjdetect.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_imgcodecs.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_objdetect.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_xphoto.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_imgproc.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    /usr/local/opt/opencv/lib/libopencv_core.3.4.dylib (compatibility version 3.4.0, current version 3.4.3)
    @rpath/QtQuick.framework/Versions/5/QtQuick (compatibility version 5.11.0, current version 5.11.3)
    @rpath/QtQml.framework/Versions/5/QtQml (compatibility version 5.11.0, current version 5.11.3)
    @rpath/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.11.0, current version 5.11.3)
    @rpath/QtCore.framework/Versions/5/QtCore (compatibility version 5.11.0, current version 5.11.3)
    /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
    @rpath/QtGui.framework/Versions/5/QtGui (compatibility version 5.11.0, current version 5.11.3)
    @rpath/QtOpenGL.framework/Versions/5/QtOpenGL (compatibility version 5.11.0, current version 5.11.3)
    @rpath/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.11.0, current version 5.11.3)
    /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.4)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.200.5)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1560.12.0)
    /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
    āžœ ~

    I have two questions:
    1.in the terminal message we can find the libfbxsdk.dylib load path is '@executable_path/libfbxsdk.dylib',What determines the libfbxsdk.dylib is '@executable_path/libfbxsdk.dylib'? I had not set the libfbxsdk.dylib,just set the -lfbxsdk in my .pro file, in my project everything about fbxsdk is Here:

    in my .pro :

    macx: LIBS += -L/Applications/Autodesk/FBXSDK/2019.2/lib/clang/debug/ -lfbxsdk
    INCLUDEPATH += /Applications/Autodesk/FBXSDK/2019.2/include
    DEPENDPATH += /Applications/Autodesk/FBXSDK/2019.2/include
    macx: PRE_TARGETDEPS += /Applications/Autodesk/FBXSDK/2019.2/lib/clang/debug/libfbxsdk.a

    2.can I change the libfbxsdk.dylib load path '@executable_path/libfbxsdk.dylib' to '@executable_path/Framework/libfbxsdk.dylib',and how?

    Thanks a lot!


  • Lifetime Qt Champion

    1. How it was deployed
    2. Yes, that's what install_name_tool is for and what is used by macdeployqt


  • @SGaist Thanks for your help, now I have a another question:
    in my Mac ,both libfbxsdk.a and libfbxsdk.dylib are in the '/Applications/Autodesk/FBXSDK/2019.2/lib/clang/debug/' directory, when I want use the 'fbxsdk', which should I use? libfbxsdk.a, libfbxsdk.dylib or both,why the '/Applications/Autodesk/FBXSDK/2019.2/lib/clang/debug/' directory has both libfbxsdk.a and libfbxsdk.dylib, is it because libfbxsdk.a and libfbxsdk.dylib have different function, or libfbxsdk.a depend on libfbxsdk.dylib,that must have both in the '/Applications/Autodesk/FBXSDK/2019.2/lib/clang/debug/' directory, here is my .pro about fbxsdk:

    macx: LIBS += -L/Applications/Autodesk/FBXSDK/2019.2/lib/clang/debug/ -lfbxsdk
    INCLUDEPATH += /Applications/Autodesk/FBXSDK/2019.2/include
    DEPENDPATH += /Applications/Autodesk/FBXSDK/2019.2/include
    macx: PRE_TARGETDEPS += /Applications/Autodesk/FBXSDK/2019.2/lib/clang/debug/libfbxsdk.a

    thanks a lot!



  • @SGaist Thanks for your help, now I have a another question:
    in my Mac ,both libfbxsdk.a and libfbxsdk.dylib are in the '/Applications/Autodesk/FBXSDK/2019.2/lib/clang/debug/' directory, when I want use the 'fbxsdk', which should I use? libfbxsdk.a, libfbxsdk.dylib or both,why the '/Applications/Autodesk/FBXSDK/2019.2/lib/clang/debug/' directory has both libfbxsdk.a and libfbxsdk.dylib? is it because libfbxsdk.a and libfbxsdk.dylib have different function or libfbxsdk.a depend on libfbxsdk.dylib? that must have both in the '/Applications/Autodesk/FBXSDK/2019.2/lib/clang/debug/' directory? here is my .pro about fbxsdk:

    macx: LIBS += -L/Applications/Autodesk/FBXSDK/2019.2/lib/clang/debug/ -lfbxsdk
    INCLUDEPATH += /Applications/Autodesk/FBXSDK/2019.2/include
    DEPENDPATH += /Applications/Autodesk/FBXSDK/2019.2/include
    macx: PRE_TARGETDEPS += /Applications/Autodesk/FBXSDK/2019.2/lib/clang/debug/libfbxsdk.a

    thanks a lot!


  • Lifetime Qt Champion

    The .a is a static library while the .dylib is a dynamic library.

    Which one to use depends on how you want to release your application. Using the static library means that if there's a bug fix on this library you have to rebuild your application. Using the dynamic library, you might be able to only switch the library depending on how it changed.


Log in to reply