[osg-users] Mac bundle distribution can't use plugin

Filip Wänström filip.wanstrom at gmail.com
Wed Nov 25 01:56:53 PST 2009


And finally, I have a founf the fix. These are happy times!

The plugin loader_path should be pointing to the libs from the path of
the plugin. This means that the otool listing should be:
$otool -L osgdb_obj.so
osgdb_obj.so:
        @loader_path/../../MacOS/libOpenThreads.11.dylib
(compatibility version 11.0.0, current version 2.4.0)
        @loader_path/../../MacOS/libosg.61.dylib (compatibility
version 61.0.0, current version 2.9.6)
        @loader_path/../../MacOS/libosgDB.61.dylib (compatibility
version 61.0.0, current version 2.9.6)
        @loader_path/../../MacOS/libosgUtil.61.dylib (compatibility
version 61.0.0, current version 2.9.6)
        /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon
(compatibility version 2.0.0, current version 136.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0,
current version 111.1.4)
        /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)

And then it all works. I will make an example of this so that others
don't have to spend weeks to support mac deployment!
/Filip



On Wed, Nov 25, 2009 at 10:46 AM, Filip Wänström
<filip.wanstrom at gmail.com> wrote:
> I Haven't fixed my issues yet so here comes some more info. This is
> what I get when listing dependencies using otool. I have massaged the
> libs extensivly using install_name_tool...
>
> [filip at MPQ]:[~/Documents/Code/OSGTests/Build/_CPack_Packages/Darwin/DragNDrop/BasicApp-1.0.0-Darwin/BasicApp.app/Contents/MacOS]$
> otool -L BasicApp
> BasicApp:
>        @loader_path/libosgDB.61.dylib (compatibility version 61.0.0,
> current version 2.9.6)
>        @loader_path/libosgUtil.61.dylib (compatibility version
> 61.0.0, current version 2.9.6)
>        @loader_path/libosgGA.61.dylib (compatibility version 61.0.0,
> current version 2.9.6)
>        @loader_path/libosgText.61.dylib (compatibility version
> 61.0.0, current version 2.9.6)
>        @loader_path/libosgViewer.61.dylib (compatibility version
> 61.0.0, current version 2.9.6)
>        @loader_path/libosg.61.dylib (compatibility version 61.0.0,
> current version 2.9.6)
>        @loader_path/libOpenThreads.11.dylib (compatibility version
> 11.0.0, current version 2.4.0)
>        /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0,
> current version 7.9.0)
>        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0,
> current version 123.0.0)
> [filip at MPQ]:[~/Documents/Code/OSGTests/Build/_CPack_Packages/Darwin/DragNDrop/BasicApp-1.0.0-Darwin/BasicApp.app/Contents/MacOS]$
> otool -L libOpenThreads.11.dylib
> libOpenThreads.11.dylib:
>        @loader_path/libOpenThreads.11.dylib (compatibility version
> 11.0.0, current version 2.4.0)
>        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0,
> current version 111.1.4)
>        /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)
> [filip at MPQ]:[~/Documents/Code/OSGTests/
> Build/_CPack_Packages/Darwin/DragNDrop/BasicApp-1.0.0-Darwin/BasicApp.app/Contents/MacOS]$
> otool -L ../PlugIns/osgPlugins-2.9.6/osgdb_obj.so
> ../PlugIns/osgPlugins-2.9.6/osgdb_obj.so:
>        @loader_path/libOpenThreads.11.dylib (compatibility version
> 11.0.0, current version 2.4.0)
>        @loader_path/libosg.61.dylib (compatibility version 61.0.0,
> current version 2.9.6)
>        @loader_path/libosgDB.61.dylib (compatibility version 61.0.0,
> current version 2.9.6)
>        @loader_path/libosgUtil.61.dylib (compatibility version
> 61.0.0, current version 2.9.6)
>        /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon
> (compatibility version 2.0.0, current version 136.0.0)
>        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0,
> current version 111.1.4)
>        /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)
>
>
> And the output from the failing loading of the plugin is a before (in
> first post). Any ideas ?
> /F
>
>
>
> On Mon, Nov 23, 2009 at 9:52 AM, Filip Wänström
> <filip.wanstrom at gmail.com> wrote:
>> Hi, thanks for the answer but I am using CMake/regular makefiles to do
>> all my building and using the "OSX Ingest into bundle" script that
>> comes with osg. I just presumed it did all magic but maybe I should
>> check out the actual paths in the libs. I'll be back with a report.
>> /Filip
>>
>> On Fri, Nov 20, 2009 at 6:21 PM, Stephan Maximilian Huber
>> <ratzfatz at digitalmind.de> wrote:
>>> Hi Filip,
>>>
>>> check your system.log-file -- I am pretty sure the osgdb_obj pluging
>>> refers to the osg-dylibs in /usr/lib or similar.
>>>
>>> You'll have to massage the paths to the libs stored in the plugin via
>>> install_name_tool in a post-build-step.
>>>
>>> Paths to libs are hardcoded in the object-file when linked. You can
>>> change them to something better suited like @loader_path.../pipapo. Try
>>> googling for install_name_tool and @loader_path to get an idea.
>>>
>>> If you are using the deprecated XCode-project and embed the osg
>>> frameworks into your app and the obj-plugin into plugins it should work
>>> out of the box whithout fiddling around with install_name_tool.
>>>
>>> cheers,
>>> Stephan
>>>
>>>
>>>
>>> Filip Wänström schrieb:
>>>> Hi,
>>>>
>>>> I have problems with distributing self-contained applications on the
>>>> mac. I have reduced my issues by building a very simple example that
>>>> basically only opens a window and loads an .obj file.
>>>>
>>>> Using OSG_NOTIFY_LEVEL=INFO (DEBUG is the same + a lot more, but
>>>> unrelated) I get the following output:
>>>>
>>>> [filip at MPQ]:[~/Documents/Code/OSGTests/]$
>>>> ./_CPack_Packages/Darwin/DragNDrop/BasicApp-1.0.0-Darwin/BasicApp.app/Contents/MacOS/BasicApp
>>>> GraphicsContext::setWindowingSystemInterface() 0xc0e930 0xa13c50
>>>> Initiating ....
>>>> Constructing BasicApp 1
>>>> Listing plugins
>>>> plugin: /Users/filip/Documents/Code/OSGTests/_CPack_Packages/Darwin/DragNDrop/BasicApp-1.0.0-Darwin/BasicApp.app/Contents/PlugIns/osgPlugins-2.9.6/osgdb_obj.so
>>>> Found file: "data/models/clogo.obj"
>>>> Opened DynamicLibrary osgPlugins-2.9.6/osgdb_obj.so
>>>> Warning: Could not find plugin to read objects from file
>>>> "data/models/clogo.obj".
>>>> Failed to load model
>>>>
>>>> This seems self contradictory to me...
>>>>
>>>> So as far as I can tell:
>>>> 1) the bundled osglibs are found correctly and the app starts
>>>> 2) the file in the Resources directory in the app bundle is found correctly
>>>> 3) the right plugin is chosen and found in the app bundle
>>>> PlugIns/osgPlugins-2.9.6 directory
>>>> 4) The lib is opened ok
>>>> 5) it fails
>>>>
>>>> All .dylibs/.so are copied from my /usr/local/ osg install into the app bundle
>>>>
>>>> I tried to see if there were some hidden depencies on osgdb_obj.so
>>>> using otool but as far as I could tell there were no extra Non-system
>>>> dependencies
>>>>
>>>> I'm at a loss here and tearing my nonexistent hair. Any help would be
>>>> greatly appreciated.
>>>>
>>>> Best
>>>> /Filip
>>>> _______________________________________________
>>>> osg-users mailing list
>>>> osg-users at lists.openscenegraph.org
>>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>
>>> _______________________________________________
>>> osg-users mailing list
>>> osg-users at lists.openscenegraph.org
>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>
>>
>


More information about the osg-users mailing list