I have Lion 10.7.4 on my laptop and I do have an OpenCL.framework in "/System/Library/Frameworks/OpenCL.framework/"<br><br><div>So the real question is: why doesn't it just work for you? Because it should work without you having to copy the OpenCL framework into your bundle.</div>
<div><br></div><div>Especially if the OpenCL.framework is part of the root OS installation. If that's the case, it may not even be legal to copy that framework into your bundle and then redistribute it.</div><div><br>
</div><div><br><div class="gmail_quote">On Tue, May 22, 2012 at 11:18 AM, Joe Ping-Lin Hsiao <span dir="ltr"><<a href="mailto:phsiao@cs.unc.edu" target="_blank">phsiao@cs.unc.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Sorry I forgot to mention what the framework is. I believe the OpenCL<br>
framework is from MacOS since I checked two Snow Leopard machines and<br>
both have the framework.<br>
<br>
I am building my program in Snow Leopard. The program uses a library<br>
called 'ImageMagick', which uses the OpenCL framework. In Snow<br>
Leopard, I don't have to do anything special to OpenCL. It is just<br>
like any other system library, and my bundle and installer work fine<br>
in Snow Leopard.<br>
<br>
The problem is the OpenCL framework is not included in Lion (MacOS<br>
10.7). I don't know why Apple changed that. So my program would crash<br>
if running in Lion.<br>
My work around was to copy 'libclparser.dylib' into my bundle and<br>
manually change it's install_name, and also the one used by<br>
ImageMagick. Luckily it works. Now I am trying to make CMake to do it.<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
On Tue, May 22, 2012 at 10:48 AM, David Cole <<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>> wrote:<br>
> My previous email was your first hint that this might not be a good idea.<br>
><br>
> This error message is the second hint that this might not be a good idea.<br>
><br>
> You can try setting "BU_COPY_FULL_FRAMEWORK_CONTENTS" to ON before calling<br>
> fixup_bundle. That will recursively copy the framework into the bundle<br>
> rather than selectively copying just the framework library and its<br>
> "Resources" folder.<br>
><br>
> I am very hesitant to recommend copying a "/System" framework into a bundle<br>
> without knowing more details about where that framework came from.<br>
><br>
><br>
> On Tue, May 22, 2012 at 10:33 AM, Joe Ping-Lin Hsiao <<a href="mailto:phsiao@cs.unc.edu">phsiao@cs.unc.edu</a>><br>
> wrote:<br>
>><br>
>> After setting the framework type to 'other', the framework structure<br>
>> is copied into my bundle, including the file OpenCL, but missing<br>
>> libclparser.dylib.<br>
>><br>
>> And I got the following errors:<br>
>><br>
>> CPack: Create package using DragNDrop<br>
>> CPack: Install projects<br>
>> CPack: - Run preinstall target for: CISMM_VIDEO<br>
>> CPack: - Install project: CISMM_VIDEO<br>
>> resolving<br>
>> /System/Library/Frameworks/OpenCL.framework/Versions/A/Libraries/libclparser.dylib<br>
>> // print out by me<br>
>> resolving /System/Library/Frameworks/OpenCL.framework/Versions/A/OpenCL<br>
>> // print out by me<br>
>> resolving<br>
>> /System/Library/Frameworks/OpenCL.framework/Versions/A/Libraries/libclparser.dylib<br>
>> // print out by me<br>
>> resolving<br>
>> /System/Library/Frameworks/OpenCL.framework/Versions/A/Libraries/libclparser.dylib<br>
>> // print out by me<br>
>> resolving /System/Library/Frameworks/OpenCL.framework/Versions/A/OpenCL<br>
>> // print out by me<br>
>> exe_dotapp_dir/='/Users/phsiao/dev/video/video_spot_tracker.app/'<br>
>> item_substring='/System/Library/Frameworks/OpenCL.framework/Ver'<br>
>><br>
>> resolved_embedded_item='/System/Library/Frameworks/OpenCL.framework/Versions/A/Libraries/libclparser.dylib'<br>
>><br>
>> Install or copy the item into the bundle before calling fixup_bundle.<br>
>> Or maybe there's a typo or incorrect path in one of the args to<br>
>> fixup_bundle?<br>
>><br>
>> CMake Error at /Applications/CMake<br>
>> 2.8-7.app/Contents/share/cmake-2.8/Modules/BundleUtilities.cmake:568<br>
>> (message):<br>
>> cannot fixup an item that is not in the bundle...<br>
>> Call Stack (most recent call first):<br>
>> /Applications/CMake<br>
>> 2.8-7.app/Contents/share/cmake-2.8/Modules/BundleUtilities.cmake:656<br>
>> (fixup_bundle_item)<br>
>> /Users/phsiao/dev/video/video_spot_tracker_install.cmake:17<br>
>> (fixup_bundle)<br>
>> /Users/phsiao/dev/video/cmake_install.cmake:127 (INCLUDE)<br>
>><br>
>><br>
>> CPack Error: Error when generating package: CISMM_VIDEO<br>
>> make: *** [package] Error 1<br>
>><br>
>><br>
>><br>
>> On Tue, May 22, 2012 at 6:53 AM, David Cole <<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>><br>
>> wrote:<br>
>> > Yes, it's possible. But I would only advise it if you do it on a<br>
>> > per-framework basis, you built & installed it yourself, and you know for<br>
>> > certain that the framework in question works fine when moved from its<br>
>> > "/System/Library" location.<br>
>> ><br>
>> > Is this an OpenCL that you built yourself, or did it come from some<br>
>> > package<br>
>> > manager?<br>
>> ><br>
>> > The set of "type" values that GetPrerequisites assigns to files are:<br>
>> > set(type "system")<br>
>> > set(type "embedded")<br>
>> > set(type "local")<br>
>> > set(type "other")<br>
>> ><br>
>> > "system" means never copy, never fixup<br>
>> > "embedded" means it will be inside the app bundle, and may be addressed<br>
>> > relative to @executable_path after fixup_bundle is done<br>
>> > "local" means it is in exactly the same directory as the executable<br>
>> > "other" is everything else<br>
>> ><br>
>> > So, in your case, you'd want to match on the file path beginning and set<br>
>> > the<br>
>> > type to "other". Just add another chunk inside your override function<br>
>> > that<br>
>> > looks like this:<br>
>> ><br>
>> > if(resolved_file MATCHES<br>
>> > "^/System/Library/Frameworks/OpenCL.framework")<br>
>> > message("resolving ${resolved_file} as other")<br>
>> > set(${type_var} other PARENT_SCOPE)<br>
>> > endif()<br>
>> ><br>
>> ><br>
>> > HTH,<br>
>> > David<br>
>> ><br>
>> ><br>
>> > On Mon, May 21, 2012 at 4:01 PM, Joe Ping-Lin Hsiao <<a href="mailto:phsiao@cs.unc.edu">phsiao@cs.unc.edu</a>><br>
>> > wrote:<br>
>> >><br>
>> >> Thanks, David. It works!<br>
>> >><br>
>> >> Is it possible to do the other way around?<br>
>> >> I want fixup_bundle() to treat<br>
>> >><br>
>> >><br>
>> >> /System/Library/Frameworks/OpenCL.framework/Versions/A/Libraries/libclparser.dylib<br>
>> >> as an external library instead of a system lib. I looked at functions<br>
>> >> in BundleUtilities.cmake and GetPrerequisites.cmake but didn't get any<br>
>> >> clue how to do that.<br>
>> >><br>
>> >> Thanks,<br>
>> >> Joe<br>
>> >><br>
>> >> On Mon, May 14, 2012 at 8:47 PM, David Cole <<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>><br>
>> >> wrote:<br>
>> >> > Rather than just doing a "fixup_bundle" as an INSTALL(CODE snippet,<br>
>> >> > put<br>
>> >> > it<br>
>> >> > in a separate CMake script, and use install(SCRIPT to execute it. You<br>
>> >> > can<br>
>> >> > configure the script with configure_file if you need to put stuff in<br>
>> >> > it<br>
>> >> > that<br>
>> >> > depends on CMake variables.<br>
>> >> ><br>
>> >> > Then, in your script:<br>
>> >> ><br>
>> >> > # Define the function before including BundleUtilities:<br>
>> >> > function(gp_resolved_file_type_override resolved_file type_var)<br>
>> >> > if(resolved_file MATCHES "^/usr/X11/lib")<br>
>> >> > message("resolving ${resolved_file} as system")<br>
>> >> > set(${type_var} system PARENT_SCOPE)<br>
>> >> > endif()<br>
>> >> > endfunction()<br>
>> >> ><br>
>> >> > include(BundleUtilities)<br>
>> >> ><br>
>> >> > fixup_bundle( ... )<br>
>> >> ><br>
>> >> > ParaView's install rules on the Mac do something like this, if you<br>
>> >> > want<br>
>> >> > to<br>
>> >> > look at some example code.<br>
>> >> ><br>
>> >> ><br>
>> >> > HTH,<br>
>> >> > David<br>
>> >> ><br>
>> >> ><br>
>> >> > On Mon, May 14, 2012 at 5:27 PM, Joe Ping-Lin Hsiao<br>
>> >> > <<a href="mailto:phsiao@cs.unc.edu">phsiao@cs.unc.edu</a>><br>
>> >> > wrote:<br>
>> >> >><br>
>> >> >> Thanks, this is exactly what I need.<br>
>> >> >><br>
>> >> >> Just one question. Why the function<br>
>> >> >> gp_resolved_file_type_override()<br>
>> >> >> cannot be seen if it is implemented in my project's CMakeLists.txt?<br>
>> >> >> I<br>
>> >> >> have to add it in GetPrerequisite.cmake module, but that's not good.<br>
>> >> >><br>
>> >> >> Thanks,<br>
>> >> >> Joe<br>
>> >> >><br>
>> >> >> On Mon, May 7, 2012 at 11:04 AM, David Cole <<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>><br>
>> >> >> wrote:<br>
>> >> >> > /usr/X11/lib/libglut.dylib should probably be considered a "system<br>
>> >> >> > library" that is not included in your final bundle.<br>
>> >> >> ><br>
>> >> >> > Therefore, all users of your application will have to have the Mac<br>
>> >> >> > OS<br>
>> >> >> > X version of X installed and available in order to run your<br>
>> >> >> > program.<br>
>> >> >> > (Is that all Macs nowadays anyway...?)<br>
>> >> >> ><br>
>> >> >> > In order to classify it as a system library, you can provide a<br>
>> >> >> > CMake<br>
>> >> >> > function named gp_resolved_file_type_override to look for that<br>
>> >> >> > library<br>
>> >> >> > (probably anything starting with "/usr/X11/lib") and set its type<br>
>> >> >> > to<br>
>> >> >> > "system" -- that will cause fixup_bundle to ignore it for copying<br>
>> >> >> > and<br>
>> >> >> > fixup purposes.<br>
>> >> >> ><br>
>> >> >> ><br>
>> >> >> > HTH,<br>
>> >> >> > David<br>
>> >> >> ><br>
>> >> >> ><br>
>> >> >> > On Mon, May 7, 2012 at 10:57 AM, Joe Ping-Lin Hsiao<br>
>> >> >> > <<a href="mailto:phsiao@cs.unc.edu">phsiao@cs.unc.edu</a>><br>
>> >> >> > wrote:<br>
>> >> >> >> Hi,<br>
>> >> >> >><br>
>> >> >> >> I use CMake to create an installer for a Mac program which uses<br>
>> >> >> >> GLUT.<br>
>> >> >> >> The GLUT library that the program links against with is<br>
>> >> >> >> /usr/X11/lib/libglut.dylib.<br>
>> >> >> >><br>
>> >> >> >> When I use fixup_bundle() to create an installer, I get the<br>
>> >> >> >> following<br>
>> >> >> >> error message:<br>
>> >> >> >><br>
>> >> >> >> install_name_tool: changing install names or rpaths can't be<br>
>> >> >> >> redone<br>
>> >> >> >> for:<br>
>> >> >> >><br>
>> >> >> >><br>
>> >> >> >> /Users/phsiao/dev/video/video_spot_tracker.app/Contents/MacOS/libglut.3.dylib<br>
>> >> >> >> (for architecture ppc7400) because larger updated load commands<br>
>> >> >> >> do<br>
>> >> >> >> not<br>
>> >> >> >> fit (the program must be relinked, and you may need to use<br>
>> >> >> >> -headerpad<br>
>> >> >> >> or -headerpad_max_install_names)<br>
>> >> >> >><br>
>> >> >> >> The first thing I tried was to add -headerpad_max_install_names<br>
>> >> >> >> and<br>
>> >> >> >> -headerpad to the linker flags, but no success. (Actually<br>
>> >> >> >> -headerpad_max_install_names already exists in CMakeFies/link.txt<br>
>> >> >> >> before I put it in.)<br>
>> >> >> >><br>
>> >> >> >> The next thing I tried was to add '-arch x86_64' to both<br>
>> >> >> >> CXX_FLAGS<br>
>> >> >> >> and<br>
>> >> >> >> LINKER_FLAGS to avoid fixup_bundle() to fix dependencies for<br>
>> >> >> >> architecture ppc7400, but the error remains.<br>
>> >> >> >><br>
>> >> >> >> Any idea how to get around this?<br>
>> >> >> >><br>
>> >> >> >> Thanks,<br>
>> >> >> >> Joe<br>
>> >> >> >> --<br>
>> >> >> >><br>
>> >> >> >> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>> >> >> >><br>
>> >> >> >> Visit other Kitware open-source projects at<br>
>> >> >> >> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>> >> >> >><br>
>> >> >> >> Please keep messages on-topic and check the CMake FAQ at:<br>
>> >> >> >> <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
>> >> >> >><br>
>> >> >> >> Follow this link to subscribe/unsubscribe:<br>
>> >> >> >> <a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
>> >> ><br>
>> >> ><br>
>> ><br>
>> ><br>
><br>
><br>
</div></div></blockquote></div><br></div>