Skip to content

How can I install Coin as part of my application

Volker Enderlein edited this page Dec 25, 2019 · 1 revision

You are here: HomeDocumentationMac information pageCoin3D/Mac FAQBuilding, Installation, Deployment → Coin as private framework

How can I install Coin as part of my application?

Unfortunately, frameworks are not as re-locatable as you might wish or think at first. Since the install_name of the shared library contained in the framework is hard-coded into the binary, it is not enough to move the framework; you also have to change the install name.

If you want to ship the Inventor.framework as part of your application, you need to do the following:

  1. Create a folder called "Frameworks" in the "Contents" folder of your app bundle.
  2. Copy Inventor.framework into that directory.
  3. Change the install_name of your application to point to the new framework location:
    install_name_tool -change Inventor.framework/Versions/B/Inventor \
    @executable_path/../Frameworks/Inventor.framework/Versions/B/Inventor \
    yourapplication.app/Contents/MacOS/yourapplication

You will have to do the same for all other frameworks you put into the local Framework directory, such as Sc21 or SoQt. Note that in some cases, you will need to change not only the install_name in the application but also in dependent frameworks.

For instance to include both Coin and SoQt, you must do all of these steps

#change install_name of Coin in application
install_name_tool -change Inventor.framework/Versions/B/Inventor \
@executable_path/../Frameworks/Inventor.framework/Versions/B/Inventor \
yourapplication.app/Contents/MacOS/yourapplication

#change install_name of SoQt in application
install_name_tool -change SoQt.framework/Versions/A/SoQt \
@executable_path/../Frameworks/SoQt.framework/Versions/A/SoQt \
yourapplication.app/Contents/MacOS/yourapplication

#change install_name of Coin in SoQt
install_name_tool -change Inventor.framework/Versions/B/Inventor \
@executable_path/../Frameworks/Inventor.framework/Versions/B/Inventor \
yourapplication.app/Contents/Frameworks/SoQt.framework/Versions/A/SoQt

You can verify that the install_names where changed correctly by using otool -L. For instance:

otool -L yourapplication.app/Contents/MacOS/yourapplication yourapplication.app/Contents/MacOS/yourapplication:
        @executable_path/../Frameworks/SoQt.framework/Versions/A/SoQt (compatibility version 24.0.0, current version 24.1.0)
        @executable_path/../Frameworks/Inventor.framework/Versions/B/Inventor (compatibility version 45.0.0, current version 45.5.0)

otool -L yourapplication.app/Contents/Frameworks/SoQt.framework/SoQt yourapplication.app/Contents/Frameworks/SoQt.framework/SoQt:
        SoQt.framework/Versions/A/SoQt (compatibility version 24.0.0, current version 24.1.0)
        @executable_path/../Frameworks/Inventor.framework/Versions/B/Inventor (compatibility version 45.0.0, current version 45.5.0)
Clone this wiki locally