怎么进网站后台管理系统,c2c网站是什么,263邮箱,html网站分页怎么做的概述
初次在Mac上使用qt的macdeployqt来打包生成的可执行程序#xff0c;这里记录下。由于我的程序是调用之前生成的qt动态库#xff0c;而动态库又依赖于第三方库#xff0c;相对于没有库文件依赖的程序#xff0c;这里有一些需要注意的点#xff0c;下面是打包的步骤。…概述
初次在Mac上使用qt的macdeployqt来打包生成的可执行程序这里记录下。由于我的程序是调用之前生成的qt动态库而动态库又依赖于第三方库相对于没有库文件依赖的程序这里有一些需要注意的点下面是打包的步骤。
打包步骤
使用macdeployqt打包qt程序 1.项目设置为release模式编译并运行生成release下的可执行程序 2.将1中生成的可执行程序存入一个空的文件夹下 3.在终端zsh中进入到qt安装目录下找到macdeployqt并cd到macdeployqt所在的目录下 我的macdeployqt所在的目录是/Users/admin/Qt/6.2.2/macos/bin/macdeployqt 4.执行指令./macdeployqt xxx.app; 这里所在的目录是macdeployqt所在目录所以需要可执行程序的绝对路径即完整路径,此处输入指令 ./macdeployqt /Users/admin/Documents/qt-program/dll-testDll/testDll.app 可执行程序中要是使用了qml模块则相应的打包指令变为macdeployqt xxx.app -qmldirxxx/xxx/xxx/xxx/, 其中xxx.app使用的绝对路径-qmldir的赋值是qml文件所在的路径这里指出qml文件所在的文件夹路径即可, 如我的程序里使用了qml则输入的指令为./macdeployqt /Users/admin/Documents/qt-program/dll-testDll/testDll.app -qmldir/Users/admin/Documents/qt-program/dll-testDll/testDll.app/Contents/MacOS/controls/我的电脑是m1芯片在使用macdeployqt打包程序的时候会出现下面的输出
ERROR: Could not parse otool output line: /Users/admin/Qt/6.2.2/macos/lib/QtWidgets.framework/Versions/A/QtWidgets (architecture arm64):
ERROR: Could not parse otool output line: /Users/admin/Qt/6.2.2/macos/lib/QtGui.framework/Versions/A/QtGui (architecture arm64):
ERROR: Could not parse otool output line: /Users/admin/Qt/6.2.2/macos/lib/QtCore.framework/Versions/A/QtCore (architecture arm64):
ERROR: Could not parse otool output line: /Users/admin/Qt/6.2.2/macos/lib/QtQuickWidgets.framework/Versions/A/QtQuickWidgets (architecture arm64):
ERROR: Could not parse otool output line: /Users/admin/Qt/6.2.2/macos/lib/QtQuick.framework/Versions/A/QtQuick (architecture arm64):
ERROR: Could not parse otool output line: /Users/admin/Qt/6.2.2/macos/lib/QtOpenGL.framework/Versions/A/QtOpenGL (architecture arm64):
ERROR: Could not parse otool output line: /Users/admin/Qt/6.2.2/macos/lib/QtWidgets.framework/Versions/A/QtWidgets (architecture arm64):
ERROR: Could not parse otool output line: /Users/admin/Qt/6.2.2/macos/lib/QtGui.framework/Versions/A/QtGui (architecture arm64):
ERROR: Could not parse otool output line: /Users/admin/Qt/6.2.2/macos/lib/QtQmlModels.framework/Versions/A/QtQmlModels (architecture arm64):
ERROR: Could not parse otool output line: /Users/admin/Qt/6.2.2/macos/lib/QtQml.framework/Versions/A/QtQml (architecture arm64):
ERROR: Could not parse otool output line: /Users/admin/Qt/6.2.2/macos/lib/QtNetwork.framework/Versions/A/QtNetwork (architecture arm64):
ERROR: Could not parse otool output line: /Users/admin/Qt/6.2.2/macos/lib/QtCore.framework/Versions/A/QtCore (architecture arm64):
ERROR: Could not parse otool output line: /Users/admin/Documents/qt-program/dll-testDll/testDll.app/Contents/PlugIns/platforms/libqcocoa.dylib (architecture arm64):
ERROR: Could not parse otool output line: /Users/admin/Qt/6.2.2/macos/lib/QtGui.framework/Versions/A/QtGui (architecture arm64):
ERROR: Could not parse otool output line: /Users/admin/Qt/6.2.2/macos/lib/QtCore.framework/Versions/A/QtCore (architecture arm64):
ERROR: Could not parse otool output line: /Users/admin/Qt/6.2.2/macos/lib/QtGui.framework/Versions/A/QtGui (architecture arm64):
ERROR: Could not parse otool output line: /Users/admin/Qt/6.2.2/macos/lib/QtCore.framework/Versions/A/QtCore (architecture arm64):
ERROR: Could not parse otool output line: /Users/admin/Documents/qt-program/dll-testDll/testDll.app/Contents/PlugIns/styles/libqmacstyle.dylib (architecture arm64):
以上只是拷贝了其输出的一部分第一次看到这个的时候一直在纠结如何解决这个问题后面发现即使看上去这个输出是有错误的但是可执行程序依旧可以实现打包此时可以双击打开对于只是简单的可执行程序没有依赖第三方库的程序此时可以尝试双击打开可执行程序也就是说这个显示有错误的输出不影响最终生成的可执行程序。 备注若生成的可执行程序没有调用第三方库则按照上面123步骤便可以打包完成双击运行若是生成的可执行程序调用了动态库则在123的基础上还需要再将库文件做相应的配置 5.查看生成的可执行程序需要依赖的动态库。 终端zsh下使用指令otool -L xxx.app;这里使用可执行程序的完整的路径 如我生成的可执行程序所在的路径为/Users/admin/Documents/qt-program/dll-testDll/testDll.app右键在testDll.app上出现右键菜单选择查看文件内容会出现文件夹Contents,进入后可以看到MacOS文件夹在MacOS文件夹下是可执行程序testDll 。查看testDll 所依赖的动态库指令为 otool -L /Users/admin/Documents/qt-program/dll-testDll/testDll.app/Contents/MacOS/testDll 可以看到 otool -L /Users/admin/Documents/qt-program/dll-testDll/testDll.app/Contents/MacOS/testDll
/Users/admin/Documents/qt-program/dll-testDll/testDll.app/Contents/MacOS/testDll:libtestAgoraVideoDll.1.dylib (compatibility version 1.0.0, current version 1.0.0)rpath/QtWidgets.framework/Versions/A/QtWidgets (compatibility version 6.0.0, current version 6.2.2)rpath/QtGui.framework/Versions/A/QtGui (compatibility version 6.0.0, current version 6.2.2)/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 2113.20.111)/System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO (compatibility version 1.0.0, current version 1.0.0)/System/Library/Frameworks/Metal.framework/Versions/A/Metal (compatibility version 1.0.0, current version 258.17.0)rpath/QtCore.framework/Versions/A/QtCore (compatibility version 6.0.0, current version 6.2.2)/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/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)/usr/lib/libc.1.dylib (compatibility version 1.0.0, current version 1200.3.0)/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.0.0)以上是testDll所依赖的库文件其中有些文件指明了路径像/System/开头/usr/开头的一般是系统路径会自动在这些路径下查找相应的库文件无需考虑rpath为运行路径因为我的可执行程序下的testDll.app在右键打开进入Contents文件夹下后可以看到如下 其中Frameworks文件夹和Plugins文件夹是打包后生成的。Frameworks文件夹下存放的是可执行程序依赖于qt的一些库Plugins指明了一些插件。由于之前通过otool -L查看了可执行程序testDll的依赖库接下来将可执行程序调用的库文件libtestAgoraVideoDll.1.dylib进行一些配置和放置。 6.修改libtestAgoraVideoDll.1.dylib的查找路径使可执行程序在可执行程序所在的同级目录下查找ibtestAgoraVideoDll.1.dylib。 使用指令 install_name_tool -change “libtestAgoraVideoDll.1.dylib” “executable_path/libtestAgoraVideoDll.1.dylib” /Users/admin/Documents/qt-program/dll-testDll/testDll.app/Contents/MacOS/testDll 7.拷贝ibtestAgoraVideoDll.1.dylib库文件到可执行程序testDll所在的目录下 8.由于程序调用了生成的库ibtestAgoraVideoDll.1.dylib而ibtestAgoraVideoDll.1.dylib又依赖于第三方库所以放置好ibtestAgoraVideoDll.1.dylib后还需要设置ibtestAgoraVideoDll.1.dylib依赖的第三方库的路径。 这里将ibtestAgoraVideoDll.1.dylib所依赖的第三方库文件拷贝到文件夹/Users/admin/Documents/qt-program/dll-testDll/testDll.app/Contents/Frameworks下 9.程序调用生成的qt动态库该动态库使用了qml文件来实现界面。 所以还需将qml文件做一些放置和配置 该实现指令同上述的第4条提到的./macdeployqt /Users/admin/Documents/qt-program/dll-testDll/testDll.app -qmldir/Users/admin/Documents/qt-program/dll-testDll/testDll.app/Contents/MacOS/controls/最好在第4条执行该语句执行该语句前将生成动态库所需要的qml文件拷贝到路径/Users/admin/Documents/qt-program/dll-testDll/testDll.app/Contents/MacOS/controls/文件夹下。如果没有将用到的qml文件做配置和放置会出现运行程序后只有一个白色的窗口。 9.以上打包一个调用依赖于第三方库生成的qt动态库的程序生成了。但是双击可执行程序不一定能正常运行取决于有没有使用一些mac认为的比较敏感的数据比如照相机麦克风通讯录之类需要根据程序运行时出现的奔溃报告在info.plist文件中添加相应的key和value。我的程序添加的是照相机和麦克风。之后便能正常运行了。 info.plist中新加的内容如下 以上是关于mac下使用qt打包程序的一点记录。