Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qt gui fails on recent OS X homebrew due to outdated pyqt #47

Closed
NikolausDemmel opened this issue Jul 18, 2014 · 17 comments
Closed

qt gui fails on recent OS X homebrew due to outdated pyqt #47

NikolausDemmel opened this issue Jul 18, 2014 · 17 comments

Comments

@NikolausDemmel
Copy link

From here http://answers.ros.org/question/186630/indigo-rqt_image_view-depends-on-build_isolated/?answer=186648#post-id-186648:

rosrun rqt_image_view rqt_image_view                                                                                                                              
    Traceback (most recent call last):
      File "/opt/ros/indigo/lib/rqt_image_view/rqt_image_view", line 8, in <module>
        sys.exit(main.main(sys.argv, standalone='rqt_image_view'))
      File "/opt/ros/indigo/lib/python2.7/site-packages/rqt_gui/main.py", line 59, in main
        return super(Main, self).main(argv, standalone=standalone, plugin_argument_provider=plugin_argument_provider, plugin_manager_settings_prefix=str(hash(os.environ['ROS_PACKAGE_PATH'])))
      File "/opt/ros/indigo/lib/python2.7/site-packages/qt_gui/main.py", line 336, in main
        from python_qt_binding import QT_BINDING
      File "/Users/tatsch/ros_catkin_ws/build_isolated/python_qt_binding/bdist.macosx-10.9-intel/egg/python_qt_binding/__init__.py", line 55, in <module>
      File "/Users/tatsch/ros_catkin_ws/build_isolated/python_qt_binding/bdist.macosx-10.9-intel/egg/python_qt_binding/binding_helper.py", line 262, in <module>
      File "/Users/tatsch/ros_catkin_ws/build_isolated/python_qt_binding/bdist.macosx-10.9-intel/egg/python_qt_binding/binding_helper.py", line 81, in _select_qt_binding
      File "/Users/tatsch/ros_catkin_ws/build_isolated/python_qt_binding/bdist.macosx-10.9-intel/egg/python_qt_binding/binding_helper.py", line 147, in _load_pyqt
      File "/usr/local/lib/python2.7/site-packages/PyQt4/Qwt5/__init__.py", line 32, in <module>
        from Qwt import *
    RuntimeError: the sip module implements API v11.0 to v11.1 but the PyQt4.Qwt5.Qwt module requires API v10.1

It seems like python_qt_binding generates sip modules for API v11.0, but on OSX/Homebrew PyQt is version 10.

My (not yet successful) attempt to update the pyqt formula to 11.0: Homebrew/legacy-homebrew#30881

@NikolausDemmel
Copy link
Author

@wjwwood making you aware of this. I didn't immediately succeed in building PyQt 11.0 (see the linked homebrew issue), but I also didn't look into it deeply.

@NikolausDemmel
Copy link
Author

This is what I get when I run it without PyQt installed:

$ rosrun rqt_image_view rqt_image_view
Could not import "pyside" bindings of qt_gui_cpp library - so C++ plugins will not be available:
Traceback (most recent call last):
  File "/Users/demmeln/work/indigo_test_ws/install/lib/python2.7/site-packages/qt_gui_cpp/cpp_binding_helper.py", line 39, in <module>
    import libqt_gui_cpp_shiboken
ImportError: No module named libqt_gui_cpp_shiboken

qt_gui_main() found no plugin matching "rqt_image_view"

@NikolausDemmel
Copy link
Author

In particular this also means that rqt_gui does not work (crashes with same error).

@DorianScholz
Copy link
Member

Just to clarify, there are 4 ways how rqt plugins run:

when running rqt with PyQt (preferred):

  1. Python only plugins just using PyQt bindings
  2. C++ Plugins using SIP

when running rqt with PySide:
3) Python only plugins just using PySide bindings
4) C++ Plugins using Shiboken

(you can force the binding using the option "-b pyside" or "-b pyqt")

You are trying to run rqt_image_view which is a C++ plugin.
First you tried with PyQt installed and therefore tested case 2), which failed because of the old SIP API in Homebrew.
-> This should be fixed in Homebrew if possible.

Then you tried running it without PyQt (using PySide) therefore testing case 4), which failed because of the missing libqt_gui_cpp_shiboken.
-> Why is this library missing? Should be part of the qt_gui_cpp package, unless the Shiboken bindings are not being compiled for OSX...

Lastly you tried running just rqt_gui (still using PySide?) therefore testing case 3).
This should work, as rqt_gui it self is Python only.
-> If you are getting the same error as for rqt_image_view, this most likely means, that your ~/.config/ros.org/rqt_gui.ini still has an rqt_image_view open in the saved perspective. Try deleting the ini file.

@NikolausDemmel
Copy link
Author

Thanks for the clarification. This helps a lot. Your analysis seems to be spot on.

  1. PyQT should be fixed in python. I just checked by manually compiling pyqt. It seems to compile successfully if just invoking ./configure-ng.py && make. But the homebrew formula does in fact do an additional step to first call ./configure.py. A comment says this is for generating the needed pyqtconfig.py file, which is indeed not generated with ./configure-ng.py. However if I manually do run ./configure.py && ./configure-ng.py && make, I do run into the compilation issue (linking libQtCore failed with duplicate symbols: http://pastebin.com/tQ69f0eq). Would a possible fix maybe involve running the ./configure.py separately to get the pyqtconfig.py file? Maybe in a different folder, or with a make distclean before ./configure-ng.py?
  2. It might be that shiboken bindings are not being built on mac. I will have to look into qt_gui_cpp. pyside and shiboken are installed from homebrew by rosdep, but maybe it is not being picked up by the compilation. Any hints are welcome.
  3. If I run rqt_gui without any plugins and with PyQt uninstalled, it does run, but tells me that no C++ plugins will be working because of missing shiboken. This is what you would expect given your explanation.

@NikolausDemmel
Copy link
Author

So shiboken is not being built because it is version 1.2.2 and the CMakeLists.txt checks for that.

CMake Warning at src/qt_gui_cpp_shiboken/CMakeLists.txt:46 (message):
  Shiboken version 1.2.2 would segfault when trying to process qt_gui_cpp
  (see https://bugreports.qt-project.org/browse/PYSIDE-218).  Therefore
  shiboken bindings are being skipped.

Is this still the state of affairs? Is there a fix? Do we need custom pyside/shiboken 1.2.1 homebrew formulae?

EDIT: last working version without this issue seems ot be 1.1.1

@NikolausDemmel
Copy link
Author

It might be that 1.2.2 is not affected any more; @dirk-thomas any thoughts as the original reporter of this issue over at https://bugreports.qt-project.org/browse/PYSIDE-218?

@dirk-thomas
Copy link
Contributor

Since I don't see any part of it having changed I would expect that the problem still exists. Could someone try it on Ubuntu to confirm that?

@NikolausDemmel
Copy link
Author

@dirk-thomas: Do interpret three green [Ok] when running the test.sh in your shiboken testing repo linked from the issue corretly, when conclude that on my system (with 1.2.2) I do not seem to be affected by this issue?

@dirk-thomas
Copy link
Contributor

Yes, that seems to be working for you then. On Ubuntu Trusty you get 1.2.1 and with that one I still get a segfault.

I guess we should try the Utopic package (which is 1.2.2) and see if it is also fixed for that. If yes we could reenable it for version numbers >= then 1.2.2.

@dirk-thomas
Copy link
Contributor

Sadly the Utopic packages do not resolve the problem on Ubuntu. The test still segfaults for me.

@NikolausDemmel
Copy link
Author

Apart from not being built because of the shiboken version check, there is another issue with shiboken, namely that the code looking for libqt_gui_cpp_shiboken assumes a .so suffix, where as on OS X the suffix is .dylib. For the sip bindings, there is a manual check on APPLE to force it to .so. I assume a similar hack can be done for shiboken, but the better fix would maybe be to fix the discovery code to pick up .dylib libraries on OS X.

With a manual libqt_gui_cpp_shiboken.so symlink I can launch rqt_gui without the shiboken warning, but it immediatly segfaults: http://pastebin.com/B6cf4RP6 I don't know if this is related to the known shiboken issue?

@NikolausDemmel
Copy link
Author

@dirk-thomas: Could the difference for your testing module with 1.2.2 on OS X / Utopic be related to boost / qt version, or the compiler?

@NikolausDemmel
Copy link
Author

I got pyqt 4.11.1 to compile on OS X (see Homebrew/legacy-homebrew#30881), given that, I guess we can ignore the sheboken issues.

@dirk-thomas
Copy link
Contributor

I tried the Ubuntu package from saucy providing the shiboken compiler which segfaults for me. Yes it could also be related to the boost version. But when I tried it last I think an older version of shiboken worked fine on the same system.

@NikolausDemmel
Copy link
Author

PyQt 4.11.1 has been released into homebrew. brew update and brew upgrade pyqt should fix this for people.

I guess we can close this and ignore shiboken, as it seems to be quite broken anyway.

@dirk-thomas
Copy link
Contributor

Thanks for fixing PyQt on OS X.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants