[CMake] SDL troubles on Mac OS X

Michael Jackson mike.jackson at bluequartz.net
Tue Dec 15 10:23:35 EST 2009


On Dec 15, 2009, at 10:03 AM, Clinton Stimpson wrote:

>
> On Dec 15, 2009, at 2:31 AM, Werner Smekal wrote:
>
>> Hi Michael,
>>
>>
>> On 12/15/09 9:58 AM, Michael Wild wrote:
>>> Hi
>>>
>>> What is the install-name of SDL.framewor/SDL? What does
>>>
>>> otool -L ~/Library/Frameworks/SDL.framework/SDL
>>>
>>> tell you? I suspect it is something like
>>>
>>> /Users/smekal/Library/Frameworks/SDL.framework/SDL:
>>> 	@executable_path/../Frameworks/SDL.framework/Versions/A/SDL  
>>> (compatibility version 1.0.0, current version 1.0.0)
>>>         ....
>>>
>>> right? The second line is the one the linker uses to embed as a  
>>> reference into your executable. The linker doesn't use it's actual  
>>> location, but the library's install name.
>>
>> Yes that's right. It was actually 5 minutes after I wrote my email,  
>> that I remembered somewhere back in my head, that the library  
>> itself has this reference, so this explains, why the executable  
>> also has this reference.
>>
>>>
>>> Not sure what's going wrong in the CMake part, though...
>>
>> I assume BundleUtilties uses this reference to copy the libraries  
>> into the app - if the library itself has a "wrong" reference it's  
>> not able to find the library, or?
>
> BundleUtilities/GetPrerequisites will print a warning message if the  
> framework's id isn't where its really at.
> But a few lines down after printing that warning message, it checks  
> to see if it can find it in ~/Library/Frameworks.
> So I suspect its working, but the messages are misleading.
> Perhaps the SDL installation shouldn't be setting framework ids like  
> that.
>
> Clint

I think the SDL developers are just being a bit "too" slick. They are  
setting up SDL for Xcode development where typically you would link to  
the SDL and then have a "Copy Files Phase" where you copy the  
framework into the Application Bundle that resides in the build  
directory. All the tutorials regarding Xcode and embedding frameworks  
have you do it this way). So the SDL folks made the reasonable  
assumption that one would be using Xcode on OS X and they could do it  
this way.

   This probably explains why OS X developers coming to CMake keep  
wanting to copy the framework into the App bundle at build time and  
not wait for "Install" time like CMake basically has us doing now.  
Just a different way of accomplishing the same thing but it does come  
with caveats.

  The OP will probably have to add a custom_command to copy the SDL  
framework into the .app bundle after building. Then the OP should  
verify that when the .app package gets copied to the install location  
that the entire .app package is copied, which will bring with it the  
SDL framework and so BundleUtilities will just basically skip past the  
SDL fixup/copy because it is already "correct".

  Just my thoughts.
_________________________________________________________
Mike Jackson                  mike.jackson at bluequartz.net
BlueQuartz Software                    www.bluequartz.net
Principal Software Engineer                  Dayton, Ohio


More information about the CMake mailing list