Plugins crash or do not load when compiled dynamically on MacOS using the provided build files

Bug #1214092 reported by Emmanuel
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Stellarium
New
Medium
treaves

Bug Description

On MacOS, get source code at: https://launchpad.net/stellarium/0.12/0.12.0/+download/stellarium-0.12.0.tar.gz
Uncompress it: tar -xvf stellarium-0.12.0.tar.gz
Compile with dynamic plugins:
 mkdir build
 cd build
 cmake -DBUILD_DYNAMIC_PLUGINS:BOOL=ON -DBUILD_STATIC_PLUGINS:BOOL=OFF ../stellarium-0.12.0
 make
 make install
Install the build/plugins/AngleMeasure/src/libAngleMeasure.dylib in the proper directory (modules/AngleMeasure).

What happens:

1/ The AngleMeasure plugin loads into stellarium but crashes with the following message:
 Loaded plugin "AngleMeasure" .
 QObject::setParent: Cannot set parent, new parent is in a different thread
 AngleMeasure plugin - press control-A to toggle angle measure mode

As it turns out, the Qt libraries referenced by stellarium and the plugin are not the same:

otool -L stellarium
stellarium:
/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 17.0.0)
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
@executable_path/../Frameworks/QtOpenGL.framework/Versions/4/QtOpenGL (compatibility version 4.8.0, current version 4.8.5)
@executable_path/../Frameworks/QtScript.framework/Versions/4/QtScript (compatibility version 4.8.0, current version 4.8.5)
@executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui (compatibility version 4.8.0, current version 4.8.5)
@executable_path/../Frameworks/QtNetwork.framework/Versions/4/QtNetwork (compatibility version 4.8.0, current version 4.8.5)
@executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore (compatibility version 4.8.0, current version 4.8.5)
/System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
@executable_path/../Frameworks/x86_64/libiconv.2.dylib (compatibility version 8.0.0, current version 8.1.0)
@executable_path/../Frameworks/x86_64/libintl.8.dylib (compatibility version 10.0.0, current version 10.2.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)

otool -L libAngleMeasure.dylib
libAngleMeasure.dylib:
QtOpenGL.framework/Versions/4/QtOpenGL (compatibility version 4.8.0, current version 4.8.5)
QtScript.framework/Versions/4/QtScript (compatibility version 4.8.0, current version 4.8.5)
QtGui.framework/Versions/4/QtGui (compatibility version 4.8.0, current version 4.8.5)
QtNetwork.framework/Versions/4/QtNetwork (compatibility version 4.8.0, current version 4.8.5)
QtCore.framework/Versions/4/QtCore (compatibility version 4.8.0, current version 4.8.5)
/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)
/opt/local/lib/libiconv.2.dylib (compatibility version 8.0.0, current version 8.1.0)
/opt/local/lib/libintl.8.dylib (compatibility version 10.0.0, current version 10.2.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)

2/ Fixing the libraries in the plugin with install_name_tool, the plugin now doesn't crash but fails to load with message:
Couldn't load the dynamic library: "/Users/Ricardo/Library/Application Support/Stellarium/modules/AngleMeasure/libAngleMeasure.dylib" : "The file '/Users/Ricardo/Library/Application Support/Stellarium/modules/AngleMeasure/libAngleMeasure.dylib' is not a valid Qt plugin."

otool -L libAngleMeasure.dylib:
@executable_path/../Frameworks/QtOpenGL.framework/Versions/4/QtOpenGL (compatibility version 4.8.0, current version 4.8.5)
@executable_path/../Frameworks/QtScript.framework/Versions/4/QtScript (compatibility version 4.8.0, current version 4.8.5)
@executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui (compatibility version 4.8.0, current version 4.8.5)
@executable_path/../Frameworks/QtNetwork.framework/Versions/4/QtGui (compatibility version 4.8.0, current version 4.8.5)
@executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore (compatibility version 4.8.0, current version 4.8.5)
/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)
@executable_path/../Frameworks/x86_64/libiconv.2.dylib (compatibility version 8.0.0, current version 8.1.0)
@executable_path/../Frameworks/x86_64/libintl.8.dylib (compatibility version 10.0.0, current version 10.2.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)

tags: added: mac-os-x
Changed in stellarium:
importance: Undecided → Medium
tags: added: plugin
Revision history for this message
treaves (treaves) wrote :

Yes, when you make an app bundle, the Qt libraries are copied over into the .app. The correct way to resolve this issue would be to updated the library path on the libraries. IF you've tried that, and are still having issues, it's likely the command you used wasn't correct.

You can also just delete the libraries from the .app; as then both the libraries and the main binary will use the system frameworks.

Your issue isn't Stellarium; it's understanding Qt plugins and Mac library paths. So I'm closing this.

Changed in stellarium:
status: New → Invalid
Revision history for this message
Emmanuel (hacker-emmanuel) wrote :

True, the issue is not the stellarium application, but the issue is that the build files bundled with stellarium source files do not currently implement what you say, namely: "The correct way to resolve this issue would be to updated the library path on the libraries."

Actually I have implemented a work around similar to the one you describe (cf. the final otool -L output in the original bug report). Still it doesn't work. Perhaps because a mistake of mine, or for other reasons.

Anyway, my purpose is to port some dynamic plugin on MacOS, but I do not have access to a Mac, and I do not know MacOS.
In these conditions things are very difficult and the little investigation I did was only with the help of google and of a benevolent MacOS user (unfortunately not knowledgeable about software development/compilation but very patient and cooperative).

In these conditions I would be very grateful if someone could either implement your solution in the official stellarium release (as an example to follow by 3rd party dynamic plugins developpers) or otherwise help me solve these issues.

Changed in stellarium:
status: Invalid → Opinion
Revision history for this message
Emmanuel (hacker-emmanuel) wrote :

Let's reopen this bug for the reason that:
- It has not been denied that "Plugins crash or do not load when compiled dynamically on MacOS using the provided build files" and that "cmake -DBUILD_DYNAMIC_PLUGINS:BOOL=ON -DBUILD_STATIC_PLUGINS:BOOL=OFF ../stellarium-0.12.0; make; make install" produces non-working plugins.
- It has not been decided that support in the official source code repository for building the official plugins as dynamic plugins on MacOS should be dropped altogether.
Please leave this bug open until either of the above conditions is changed or the bug is fixed.

Changed in stellarium:
status: Opinion → New
Changed in stellarium:
assignee: nobody → treaves (treaves)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.