我使用通过 brew 安装的 SDL2 开发了一个应用程序。它在我的开发环境中运行良好,但是当尝试在另一台机器上启动它时,我有以下错误:
Drivers count: 2
Driver name: opengl
Driver name: software
Initialize all SDL subsystems
Set up the window
exists true
failed to load "/Users/joker/Desktop/SDLTest.app/Contents/MacOS/look.png"
Failed loading libpng.dylib: dlopen(libpng.dylib, 6): image not found
输入otool -L SDLTest.app/Contents/MacOS/SDLTest
时的输出结果如下:
SDLTest.app/Contents/MacOS/SDLTest:
@executable_path/../Frameworks/libSDL2-2.0.0.dylib (compatibility version 3.0.0, current version 3.1.0)
@executable_path/../Frameworks/libSDL2_image-2.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
@executable_path/../Frameworks/libSDL2_ttf-2.0.0.dylib (compatibility version 11.0.0, current version 11.2.0)
@executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.3.0, current version 5.3.1)
@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui (compatibility version 5.3.0, current version 5.3.1)
@executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore (compatibility version 5.3.0, current version 5.3.1)
/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 120.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
输入otool -L SDLTest.app/Frameworks/libSDL2_image-2.0.0.dylib
时的输出结果如下:
SDLTest.app/Contents/Frameworks/libSDL2_image-2.0.0.dylib:
@executable_path/../Frameworks/libSDL2_image-2.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
@executable_path/../Frameworks/libSDL2-2.0.0.dylib (compatibility version 3.0.0, current version 3.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
以下是我的SDLTest.app/Contents/Frameworks
文件夹的内容:
total 3064
drwxr-xr-x 14 martin staff 476B 27 oct 15:11 .
drwxr-xr-x 7 martin staff 238B 27 oct 15:11 ..
drwxr-xr-x 4 martin staff 136B 27 oct 15:11 QtCore.framework
drwxr-xr-x 4 martin staff 136B 27 oct 15:11 QtGui.framework
drwxr-xr-x 4 martin staff 136B 27 oct 15:11 QtPrintSupport.framework
drwxr-xr-x 4 martin staff 136B 27 oct 15:11 QtWidgets.framework
drwxr-xr-x 6 martin staff 204B 27 oct 15:11 SDL2.framework
drwxr-xr-x 7 martin staff 238B 27 oct 15:11 SDL2_image.framework
drwxr-xr-x 7 martin staff 238B 27 oct 15:11 SDL2_ttf.framework
-rw-r--r-- 1 martin staff 755K 27 oct 15:11 libSDL2-2.0.0.dylib
-rw-r--r-- 1 martin staff 78K 27 oct 15:11 libSDL2_image-2.0.0.dylib
-rw-r--r-- 1 martin staff 33K 27 oct 15:11 libSDL2_ttf-2.0.0.dylib
-rw-r--r-- 1 martin staff 491K 27 oct 15:11 libfreetype.6.dylib
-rw-r--r-- 1 martin staff 164K 27 oct 15:11 libpng16.16.dylib