| 115 | === Relative vs. absolute paths in the used libraries === |
| 116 | If you see something like the following error when starting !VirtualBox you need to change the used libraries to use absolute paths. |
| 117 | {{{ |
| 118 | VirtualBox: supR3HardenedMainGetTrustedMain: dlopen("/Applications/VirtualBox.app/Contents/MacOS/VirtualBox.dylib",) failed: \ |
| 119 | dlopen(/Applications/VirtualBox.app/Contents/MacOS/VirtualBox.dylib, 10): Library not loaded: QtCore.framework/Versions/4/QtCore |
| 120 | Referenced from: /Applications/VirtualBox.app/Contents/MacOS/VirtualBox.dylib |
| 121 | Reason: unsafe use of relative rpath QtCore.framework/Versions/4/QtCore in /Applications/VirtualBox.app/Contents/MacOS/VirtualBox.dylib with restricted binary |
| 122 | }}} |
| 123 | On Mac OS X it isn't allowed to use libraries with relative paths for referencing to other libraries when the executable is setuid. You can display all linked libraries by the following command: |
| 124 | {{{ |
| 125 | otool -L /Applications/VirtualBox.app/Contents/MacOS/VirtualBox.dylib |
| 126 | }}} |
| 127 | Next, assuming Qt is installed in /Applications/VirtualBox.app/Contents/Frameworks/, you can change the path by using this: |
| 128 | {{{ |
| 129 | install_name_tool -id /Applications/VirtualBox.app/Contents/Frameworks/QtGui.framework/Versions/4/QtGui /Applications/VirtualBox.app/Contents/Frameworks/QtGui.framework/Versions/4/QtGui |
| 130 | install_name_tool -change @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore /Applications/VirtualBox.app/Contents/Frameworks/QtCore.framework/Versions/4/QtCore /Applications/VirtualBox.app/Contents/Frameworks/QtGui.framework/Versions/4/QtGui |
| 131 | }}} |
| 132 | The first command changes the identifier of the library itself. The second changes references to other libraries. There, the first path is the old referenced path, the second one is the new path and the last path is the file to change (see man install_name_tool). Note, you need to repeat this with every library involved. |