what is wrong in script of application bundle for IOs application?



  • I am using Qt 5.11.0 in Mac system. I got the build success in QT, I am trying to create the application bundle for the my application.

    we have one script, which is copy the 3rd party library and framework into bundle. I am calling that script from QT creator project setting. But I getting error related to dynamic library. It name is squidstateLibrary,i am using that library inside the main project and another dynamic lib file.

    My project .pro file location
    potentiostat/src/Squidstat/Squidstat.pro

    output directory:
    potentiostat/out/Release/_Squidstat/

    SquidstatLibrary location:
    potentiostat/out/Release/squidstatlibrary/libSquidStateLibrary.1.dylib

    the script, which is create the application bundle

    #!/bin/sh
    QTDIR="$1"
    cp ./../../3rdparty/qtcsv-out/lib-release/libqtcsv.dylib ./../../out/Release/_SquidStat/_SquidStat.app/Contents/MacOS/libqtcsv.1.dylib
    cp ./../../3rdparty/hidapi-out/lib-release/libhidapi.0.dylib ./../../out/Release/_SquidStat/_SquidStat.app/Contents/MacOS/
    
    
    
    mkdir -p ./../../out/Release/_SquidStat/_SquidStat.app/Contents/Frameworks/qwt.framework/
    cp -R ./../../3rdparty/qwt/bin/lib/qwt.framework/ ./../../out/Release/_SquidStat/_SquidStat.app/Contents/Frameworks/qwt.framework/
    mkdir -p ./../../out/Release/_SquidStat/_SquidStat.app/Contents/Frameworks/QtConcurrent.framework/
    cp -R $QTDIR/../lib/QtConcurrent.framework/ ./../../out/Release/_SquidStat/_SquidStat.app/Contents/Frameworks/QtConcurrent.framework/
    mkdir -p ./../../out/Release/_SquidStat/_SquidStat.app/Contents/Frameworks/QtOpenGL.framework/
    cp -R $QTDIR/../lib/QtOpenGL.framework/ ./../../out/Release/_SquidStat/_SquidStat.app/Contents/Frameworks/QtOpenGL.framework/
    
    install_name_tool -change /usr/local/opt/hidapi/lib/libhidapi.0.dylib @executable_path/libhidapi.0.dylib ./../../out/Release/_SquidStat/_SquidStat.app/Contents/MacOS/_SquidStat
    install_name_tool -change libqtcsv.1.dylib @executable_path/libqtcsv.1.dylib ./../../out/Release/_SquidStat/_SquidStat.app/Contents/MacOS/_SquidStat
    install_name_tool -change qwt.framework/Versions/6/qwt @executable_path/../Frameworks/qwt.framework/Versions/6/qwt ./../../out/Release/_SquidStat/_SquidStat.app/Contents/MacOS/_SquidStat
    
    
    mkdir -p ./../../out/Release/_SquidStat/_SquidStat.app/Contents/MacOS/squidstatelibrary/
    cp ./../../out/Release/squidstatelibrary/libSquidStateLibrary.1.dylib ./../../out/Release/_SquidStat/_SquidStat.app/Contents/MacOS/
    
    install_name_tool -change ./../../out/Release/squidstatelibrary/libSquidStateLibrary.1.dylib @executable_path/libSquidStateLibrary.1.dylib ./../../out/Release/_SquidStat/_SquidStat.app/Contents/MacOS/_SquidStat
    
    
    
    mkdir -p ./../../out/Release/_SquidStat/_SquidStat.app/Contents/MacOS/elements/
    cp -R ./../../out/Release/elements/ ./../../out/Release/_SquidStat/_SquidStat.app/Contents/MacOS/elements/
    mkdir -p ./../../out/Release/_SquidStat/_SquidStat.app/Contents/MacOS/prebuilt/
    cp -R ./../../out/Release/prebuilt/ ./../../out/Release/_SquidStat/_SquidStat.app/Contents/MacOS/prebuilt/
    rm -f ./../../out/Release/_SquidStat/_SquidStat.dmg
    $QTDIR/macdeployqt ./../../out/Release/_SquidStat/_SquidStat.app -dmg
    
    

    Output of otool -L Potentiostat/out/Release/_SquidStat/_SquidStat.app/Contents/MacOS/_SquidStat

    _SquidStat:
    	@executable_path/../Frameworks/qwt.framework/Versions/6/qwt (compatibility version 6.1.0, current version 6.1.3)
    	@executable_path/libhidapi.0.dylib (compatibility version 1.0.0, current version 1.0.0)
    	@executable_path/libqtcsv.1.dylib (compatibility version 1.5.0, current version 1.5.0)
    	libSquidStateLibrary.1.dylib (compatibility version 1.0.0, current version 1.0.0)
    	@rpath/QtOpenGL.framework/Versions/5/QtOpenGL (compatibility version 5.11.0, current version 5.11.0)
    	@rpath/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.11.0, current version 5.11.0)
    	@rpath/QtGui.framework/Versions/5/QtGui (compatibility version 5.11.0, current version 5.11.0)
    	@rpath/QtCore.framework/Versions/5/QtCore (compatibility version 5.11.0, current version 5.11.0)
    	/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/QtSerialPort.framework/Versions/5/QtSerialPort (compatibility version 5.11.0, current version 5.11.0)
    	@rpath/QtConcurrent.framework/Versions/5/QtConcurrent (compatibility version 5.11.0, current version 5.11.0)
    	/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.0)
    	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)
    

    output of

     otool -L out/Release/_SquidStat/_SquidStat.app/Contents/MacOS/prebuilt/libChargeDischarge1.dylib
    
    out/Release/_SquidStat/_SquidStat.app/Contents/MacOS/prebuilt/libChargeDischarge1.dylib:
    	libChargeDischarge1.dylib (compatibility version 0.0.0, current version 0.0.0)
    	libSquidStateLibrary.1.dylib (compatibility version 1.0.0, current version 1.0.0)
    	@rpath/QtDesigner.framework/Versions/5/QtDesigner (compatibility version 5.11.0, current version 5.11.0)
    	@rpath/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.11.0, current version 5.11.0)
    	@rpath/QtGui.framework/Versions/5/QtGui (compatibility version 5.11.0, current version 5.11.0)
    	@rpath/QtCore.framework/Versions/5/QtCore (compatibility version 5.11.0, current version 5.11.0)
    	/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/QtXml.framework/Versions/5/QtXml (compatibility version 5.11.0, current version 5.11.0)
    	/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.0)
    	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)
    

    complier Output:

    18:27:10: The process "/usr/bin/make" exited normally.
    18:27:10: Starting: "/bin/bash" macdeploy.sh /Users/admiralinstruments/Qt_New/5.11.0/clang_64/bin
    cp: cannot overwrite directory ./../../out/Release/_SquidStat/_SquidStat.app/Contents/Frameworks/qwt.framework/Headers with non-directory ./../../3rdparty/qwt/bin/lib/qwt.framework//Headers
    cp: cannot overwrite directory ./../../out/Release/_SquidStat/_SquidStat.app/Contents/Frameworks/qwt.framework/Resources with non-directory ./../../3rdparty/qwt/bin/lib/qwt.framework//Resources
    cp: cannot overwrite directory ./../../out/Release/_SquidStat/_SquidStat.app/Contents/Frameworks/qwt.framework/Versions/Current with non-directory ./../../3rdparty/qwt/bin/lib/qwt.framework//Versions/Current
    cp: cannot overwrite directory ./../../out/Release/_SquidStat/_SquidStat.app/Contents/Frameworks/QtConcurrent.framework/Headers with non-directory /Users/admiralinstruments/Qt_New/5.11.0/clang_64/bin/../lib/QtConcurrent.framework//Headers
    cp: cannot overwrite directory ./../../out/Release/_SquidStat/_SquidStat.app/Contents/Frameworks/QtConcurrent.framework/Resources with non-directory /Users/admiralinstruments/Qt_New/5.11.0/clang_64/bin/../lib/QtConcurrent.framework//Resources
    cp: cannot overwrite directory ./../../out/Release/_SquidStat/_SquidStat.app/Contents/Frameworks/QtConcurrent.framework/Versions/Current with non-directory /Users/admiralinstruments/Qt_New/5.11.0/clang_64/bin/../lib/QtConcurrent.framework//Versions/Current
    cp: cannot overwrite directory ./../../out/Release/_SquidStat/_SquidStat.app/Contents/Frameworks/QtOpenGL.framework/Headers with non-directory /Users/admiralinstruments/Qt_New/5.11.0/clang_64/bin/../lib/QtOpenGL.framework//Headers
    cp: cannot overwrite directory ./../../out/Release/_SquidStat/_SquidStat.app/Contents/Frameworks/QtOpenGL.framework/Resources with non-directory /Users/admiralinstruments/Qt_New/5.11.0/clang_64/bin/../lib/QtOpenGL.framework//Resources
    cp: cannot overwrite directory ./../../out/Release/_SquidStat/_SquidStat.app/Contents/Frameworks/QtOpenGL.framework/Versions/Current with non-directory /Users/admiralinstruments/Qt_New/5.11.0/clang_64/bin/../lib/QtOpenGL.framework//Versions/Current
    ERROR: no file at "/usr/lib/libSquidStateLibrary.1.dylib"
    File exists, skip copy: "../../out/Release/_SquidStat/_SquidStat.app/Contents/PlugIns/platforms/libqcocoa.dylib"
    File exists, skip copy: "../../out/Release/_SquidStat/_SquidStat.app/Contents/PlugIns/printsupport/libcocoaprintersupport.dylib"
    File exists, skip copy: "../../out/Release/_SquidStat/_SquidStat.app/Contents/PlugIns/styles/libqmacstyle.dylib"
    File exists, skip copy: "../../out/Release/_SquidStat/_SquidStat.app/Contents/PlugIns/imageformats/libqgif.dylib"
    File exists, skip copy: "../../out/Release/_SquidStat/_SquidStat.app/Contents/PlugIns/imageformats/libqicns.dylib"
    File exists, skip copy: "../../out/Release/_SquidStat/_SquidStat.app/Contents/PlugIns/imageformats/libqico.dylib"
    File exists, skip copy: "../../out/Release/_SquidStat/_SquidStat.app/Contents/PlugIns/imageformats/libqjpeg.dylib"
    File exists, skip copy: "../../out/Release/_SquidStat/_SquidStat.app/Contents/PlugIns/imageformats/libqmacheif.dylib"
    File exists, skip copy: "../../out/Release/_SquidStat/_SquidStat.app/Contents/PlugIns/imageformats/libqmacjp2.dylib"
    File exists, skip copy: "../../out/Release/_SquidStat/_SquidStat.app/Contents/PlugIns/imageformats/libqsvg.dylib"
    File exists, skip copy: "../../out/Release/_SquidStat/_SquidStat.app/Contents/PlugIns/imageformats/libqtga.dylib"
    File exists, skip copy: "../../out/Release/_SquidStat/_SquidStat.app/Contents/PlugIns/imageformats/libqtiff.dylib"
    File exists, skip copy: "../../out/Release/_SquidStat/_SquidStat.app/Contents/PlugIns/imageformats/libqwbmp.dylib"
    File exists, skip copy: "../../out/Release/_SquidStat/_SquidStat.app/Contents/PlugIns/imageformats/libqwebp.dylib"
    File exists, skip copy: "../../out/Release/_SquidStat/_SquidStat.app/Contents/PlugIns/iconengines/libqsvgicon.dylib"
    WARNING:
    WARNING: "../../out/Release/_SquidStat/_SquidStat.app/Contents/Resources/qt.conf" already exists, will not overwrite.
    WARNING: To make sure the plugins are loaded from the correct location,
    WARNING: please make sure qt.conf contains the following lines:
    WARNING: [Paths]
    WARNING:   Plugins = PlugIns
    18:27:39: The process "/bin/bash" exited normally.
    18:27:39: Elapsed time: 00:39.
    

    I am getting error like

    ERROR: no file at "/usr/lib/libSquidStateLibrary.1.dylib"
    

    what is wrong, I am doing while writing intall_tool_change command in script.
    so that it is show the message like no squidstatlibrary file found.


  • Lifetime Qt Champion

    Hi,

    What does libSquidStateLibrary.1.dylib do ?



  • @SGaist libSquidStateLibrary is dynamic library file, and I created with help of another project in Qt creator.

    On Windows system I created SquidStateLibrary.dll file in visual studio.

    libSquidStateLibrary contain various function for calculation.


  • Lifetime Qt Champion

    Can you show the otool -L output on libSquidStateLibrary ?
    Where is it located exactly ?



  • @SGaist
    SquidStateLibrary project generated library file at location:
    Potentiostat/out/Release/squidstatelibrary/libSquidStateLibrary.1.dylib
    Potentiostat/out/Release/squidstatelibrary/libSquidStateLibrary.1.0.dylib
    Potentiostat/out/Release/squidstatelibrary/libSquidStateLibrary.1.0.0.dylib
    Potentiostat/out/Release/squidstatelibrary/libSquidStateLibrary.dylib

    After libSquidStateLibrary.1.dylib copy into the application bundle it is located at:
    Potentiostat/out/Release/_SquidStat/_SquidStat.app/Contents/MacOS/libSquidStateLibrary.1.dylib

    Here the output of the otool -L on libSquidStateLibrary:

    otool -L Potentiostat/out/Release/squidstatelibrary/libSquidStateLibrary.1.dylib 
    
    //**************output******************// 
    Potentiostat/out/Release/squidstatelibrary/libSquidStateLibrary.1.dylib:
    	libSquidStateLibrary.1.dylib (compatibility version 1.0.0, current version 1.0.0)
    	@rpath/QtGui.framework/Versions/5/QtGui (compatibility version 5.11.0, current version 5.11.0)
    	@rpath/QtCore.framework/Versions/5/QtCore (compatibility version 5.11.0, current version 5.11.0)
    	/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)
    	/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.0)
    	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)
    Admirals-MacBook-Pro:Documents admiralinstruments$ 
    


  • @SGaist Do I need to add any other contain in script?


  • Lifetime Qt Champion

    Something I would try first is to use the -libpath option of macdeployqt to help it find your dependencies.

    Otherwise, you need to also fix the id attribute using install_name_tool`



  • Hi,

    With help of our senior Engineer. I am able to solve this issue. He change the binary path of libSquidStateLibrary.1.dylib into libChargeDischarge1.dylib and .app file.

    Inside the bundle my library location at _Squidstate.app/squidstatelibrary/libSquidStateLibrary.1.dylib

    //change Binary path in Plugin

    install_name_tool -change  libSquidStateLibrary.1.dylib  @executable_path/squidstatelibrary/libSquidStateLibrary.1.dylib ./../../out/Release/_SquidStat/_SquidStat.app/Contents/MacOS/prebuilt/libChargeDischarge1.dylib
    

    // change binary path in app

    install_name_tool -change  libSquidStateLibrary.1.dylib  @executable_path/squidstatelibrary/libSquidStateLibrary.1.dylib ./../../out/Release/_SquidStat/_SquidStat.app/Contents/MacOS/_SquidStat
    

    solution may be helpful to novice programmer like me.
    Thank you.