Werner Smekal
2009-12-15 07:51:45 UTC
Hi,
I'm building an application on Mac OS X and link the SDL libraries into
the app. Basically it all works fine (app runs, etc.), but if I want to
use the BundleUtilities to fix/include the SDL framework into the app
bundle I encounter errors. Problem is, that the references to the SDL
libraries in the executable already point to
"@executable_path/../Frameworks/...." although the SDL Frameworks are
not there (see below). BundleUtilities is then not able to find the SDL
Frameworks. In my opinion the references should point to
~/Library/Frameworks. I wonder why this app runs, but maybe Mac OS X
looks for other standard locations if it doesn't find the library. I
googled around but could only find one other post:
http://avidemux.org/admForum/viewtopic.php?id=5802
where it is mentioned that: "However, cmake "thinks" that the
SDL.framework is already inside the bundle (and therefore doesn't copy
it), but cmake can't find it in the next step."
Is this a cmake bug, a FindSDL.cmake bug or is it just me :)
Thanks for any help,
Werner
More information. Here is what I do:
1) Download the SDL and SDL-Mixer Frameworks and copy them to
~/Library/Frameworks
2) Try to find them with
find_package(SDL REQUIRED)
include_directories(${SDL_INCLUDE_DIR})
find_package(SDL_mixer REQUIRED)
include_directories(${SDLMIXER_INCLUDE_DIR})
which also works ok:
SDL_INCLUDE_DIR = /Users/smekal/Library/Frameworks/SDL.framework/Headers
SDL_LIBRARY =
/Users/smekal/Library/Frameworks/SDL.framework;-framework Cocoa
SDLMIXER_INCLUDE_DIR =
/Users/smekal/Library/Frameworks/SDL_mixer.framework/Headers
SDLMIXER_LIBRARY = /Users/smekal/Library/Frameworks/SDL_mixer.framework
3) Link them to my target:
target_link_libraries(
zct
${SDL_LIBRARY}
${SDLMIXER_LIBRARY}
${OPENGL_LIBRARIES}
)
4) Verbose compile (example):
[ 7%] Building CXX object CMakeFiles/zct.dir/src/game/app.cpp.o
/usr/bin/c++ -mmacosx-version-min=10.5
-I/Users/smekal/Library/Frameworks/SDL.framework/Headers
-I/Users/smekal/Library/Frameworks/SDL_mixer.framework/Headers -Wall
-F/Users/smekal/Library/Frameworks -o
CMakeFiles/zct.dir/src/game/app.cpp.o -c
/Users/smekal/Development/zct/src/game/app.cpp
"/Users/smekal/Applications/CMake 2.8-0.app/Contents/bin/cmake" -E
cmake_progress_report /Users/smekal/Development/zct/build/CMakeFiles 2
5) Verbose Link:
Linking CXX executable zct.app/Contents/MacOS/zct
"/Users/smekal/Applications/CMake 2.8-0.app/Contents/bin/cmake" -E
cmake_link_script CMakeFiles/zct.dir/link.txt --verbose=1
/usr/bin/c++ -mmacosx-version-min=10.5 -Wl,-search_paths_first
-headerpad_max_install_names CMakeFiles/zct.dir/src/game/app.cpp.o
CMakeFiles/zct.dir/src/game/being.cpp.o
CMakeFiles/zct.dir/src/game/controller.cpp.o
CMakeFiles/zct.dir/src/game/display.cpp.o
CMakeFiles/zct.dir/src/game/main.cpp.o
CMakeFiles/zct.dir/src/game/map.cpp.o
CMakeFiles/zct.dir/src/game/organizer.cpp.o
CMakeFiles/zct.dir/src/game/error.cpp.o
CMakeFiles/zct.dir/src/game/location.cpp.o
CMakeFiles/zct.dir/src/game/pathnode.cpp.o
CMakeFiles/zct.dir/src/game/point.cpp.o
CMakeFiles/zct.dir/src/game/tile.cpp.o
CMakeFiles/zct.dir/src/game/SDLMain.m.o -o zct.app/Contents/MacOS/zct
-F/Users/smekal/Library/Frameworks -framework SDL -framework Cocoa
-framework SDL_mixer -framework AGL -framework OpenGL
6) and if I look at the references with otool:
pico:build smekal$ otool -L zct.app/Contents/MacOS/zct
zct.app/Contents/MacOS/zct:
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL
(compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa
(compatibility version 1.0.0, current version 12.0.0)
@executable_path/../Frameworks/SDL_mixer.framework/Versions/A/SDL_mixer
(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)
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL
(compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0,
current version 7.4.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current
version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0,
current version 111.1.4)
/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility
version 1.0.0, current version 32.0.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current
version 227.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
(compatibility version 150.0.0, current version 476.19.0)
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
(compatibility version 45.0.0, current version 949.54.0)
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices
(compatibility version 1.0.0, current version 34.0.0)
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
(compatibility version 300.0.0, current version 677.26.0)
I'm building an application on Mac OS X and link the SDL libraries into
the app. Basically it all works fine (app runs, etc.), but if I want to
use the BundleUtilities to fix/include the SDL framework into the app
bundle I encounter errors. Problem is, that the references to the SDL
libraries in the executable already point to
"@executable_path/../Frameworks/...." although the SDL Frameworks are
not there (see below). BundleUtilities is then not able to find the SDL
Frameworks. In my opinion the references should point to
~/Library/Frameworks. I wonder why this app runs, but maybe Mac OS X
looks for other standard locations if it doesn't find the library. I
googled around but could only find one other post:
http://avidemux.org/admForum/viewtopic.php?id=5802
where it is mentioned that: "However, cmake "thinks" that the
SDL.framework is already inside the bundle (and therefore doesn't copy
it), but cmake can't find it in the next step."
Is this a cmake bug, a FindSDL.cmake bug or is it just me :)
Thanks for any help,
Werner
More information. Here is what I do:
1) Download the SDL and SDL-Mixer Frameworks and copy them to
~/Library/Frameworks
2) Try to find them with
find_package(SDL REQUIRED)
include_directories(${SDL_INCLUDE_DIR})
find_package(SDL_mixer REQUIRED)
include_directories(${SDLMIXER_INCLUDE_DIR})
which also works ok:
SDL_INCLUDE_DIR = /Users/smekal/Library/Frameworks/SDL.framework/Headers
SDL_LIBRARY =
/Users/smekal/Library/Frameworks/SDL.framework;-framework Cocoa
SDLMIXER_INCLUDE_DIR =
/Users/smekal/Library/Frameworks/SDL_mixer.framework/Headers
SDLMIXER_LIBRARY = /Users/smekal/Library/Frameworks/SDL_mixer.framework
3) Link them to my target:
target_link_libraries(
zct
${SDL_LIBRARY}
${SDLMIXER_LIBRARY}
${OPENGL_LIBRARIES}
)
4) Verbose compile (example):
[ 7%] Building CXX object CMakeFiles/zct.dir/src/game/app.cpp.o
/usr/bin/c++ -mmacosx-version-min=10.5
-I/Users/smekal/Library/Frameworks/SDL.framework/Headers
-I/Users/smekal/Library/Frameworks/SDL_mixer.framework/Headers -Wall
-F/Users/smekal/Library/Frameworks -o
CMakeFiles/zct.dir/src/game/app.cpp.o -c
/Users/smekal/Development/zct/src/game/app.cpp
"/Users/smekal/Applications/CMake 2.8-0.app/Contents/bin/cmake" -E
cmake_progress_report /Users/smekal/Development/zct/build/CMakeFiles 2
5) Verbose Link:
Linking CXX executable zct.app/Contents/MacOS/zct
"/Users/smekal/Applications/CMake 2.8-0.app/Contents/bin/cmake" -E
cmake_link_script CMakeFiles/zct.dir/link.txt --verbose=1
/usr/bin/c++ -mmacosx-version-min=10.5 -Wl,-search_paths_first
-headerpad_max_install_names CMakeFiles/zct.dir/src/game/app.cpp.o
CMakeFiles/zct.dir/src/game/being.cpp.o
CMakeFiles/zct.dir/src/game/controller.cpp.o
CMakeFiles/zct.dir/src/game/display.cpp.o
CMakeFiles/zct.dir/src/game/main.cpp.o
CMakeFiles/zct.dir/src/game/map.cpp.o
CMakeFiles/zct.dir/src/game/organizer.cpp.o
CMakeFiles/zct.dir/src/game/error.cpp.o
CMakeFiles/zct.dir/src/game/location.cpp.o
CMakeFiles/zct.dir/src/game/pathnode.cpp.o
CMakeFiles/zct.dir/src/game/point.cpp.o
CMakeFiles/zct.dir/src/game/tile.cpp.o
CMakeFiles/zct.dir/src/game/SDLMain.m.o -o zct.app/Contents/MacOS/zct
-F/Users/smekal/Library/Frameworks -framework SDL -framework Cocoa
-framework SDL_mixer -framework AGL -framework OpenGL
6) and if I look at the references with otool:
pico:build smekal$ otool -L zct.app/Contents/MacOS/zct
zct.app/Contents/MacOS/zct:
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL
(compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa
(compatibility version 1.0.0, current version 12.0.0)
@executable_path/../Frameworks/SDL_mixer.framework/Versions/A/SDL_mixer
(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)
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL
(compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0,
current version 7.4.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current
version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0,
current version 111.1.4)
/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility
version 1.0.0, current version 32.0.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current
version 227.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
(compatibility version 150.0.0, current version 476.19.0)
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
(compatibility version 45.0.0, current version 949.54.0)
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices
(compatibility version 1.0.0, current version 34.0.0)
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
(compatibility version 300.0.0, current version 677.26.0)