sparcians / map

Modeling Architectural Platform
Apache License 2.0
158 stars 57 forks source link

Argos segfault when running with wxPython 4.1.0 #200

Open criusx opened 4 years ago

criusx commented 4 years ago

Running under Ubuntu 20.04, though not strictly necessary, pip3 install wxPython==4.1.0, run the CoreExample, then argos.py and you will see a segfault when trying to call DrawItem(). This happens at core.pyx:550 when tryint to update the annotation. Workaround is to revert to a lower wxPython (e.g. pip3 install wxPython==4.0.7). Hope this saves somebody trouble since 4.1.0 is the latest and default version now. Nothing in the 4.1.0 release notes seems to indicate this would happen. Ideally argos can work with all versions of wxPython Phoenix(>v4) and will exit with an error message if an unsupported version is loaded. This isn't urgent, but someone else familiar with the code may be able to fix it easily.

`#0 0x0000000000000003 in ()

1 0x00007ffff6009bd5 in wxGCDCImpl::DoDrawBitmap(wxBitmap const&, int, int, bool) () at /usr/local/lib/python3.8/dist-packages/wx/libwx_gtk3u_core-3.1.so.4

2 0x00007fffef5c7d5f in wxDC::DrawText(wxString const&, int, int) (this=0x2271490, y=20, x=421, text=...) at /usr/include/wx-3.0/wx/dc.h:1218

3 __pyx_pf_4core_8Renderer_20drawInfoRectangle

(__pyx_v_short_format=<optimized out>, __pyx_v_schedule_settings=<optimized out>, __pyx_v_clip_x=<optimized out>, __pyx_v_auto_color=<optimized out>, __pyx_v_content_type=<optimized out>, __pyx_v_missing_needed_loc=<optimized out>, __pyx_v_annotation=<optimized out>, __pyx_v_re

ct=, pyx_v_canvas=, pyx_v_dc=, pyx_v_element=, pyx_v_tick=, __pyx_v_self=0x7fffeec27c70) at /home/osboxes/map/helios/pipeViewer/pipe_view/core/src/core.cpp:8219

4 pyx_pw_4core_8Renderer_21drawInfoRectangle(PyObject, PyObject, PyObject*) (pyx_v_self=0x7fffeec27c70, __pyx_args=, __pyx_kwds=) at /home/osboxes/map/helios/pipeViewer/pipe_view/core/src/core.cpp:6604`

bdutro commented 3 years ago

I've reproduced this on my system, and at least for me the problem was that core.so was linking against wxWidgets 3.0.5 (my system-installed version), but wxPython 4.1.0 was linking against its own bundled build of wxWidgets 3.1.4. Forcing core.so to link against wxWidgets 3.1.4 fixed the problem.

Unfortunately, the pip installation of wxPython doesn't include the wx-config utility, so getting this to build cleanly requires doing the following:

  1. Manually build and install wxPython somewhere:

    pip download -d . wxpython
    tar xf wxPython-4.1.0.tar.gz
    cd wxPython-4.1.0.tar.gz
    pip install .
  2. Build map with GTK3 and wxPython 4.1.0 fixes:

    cd map
    git checkout gtk3-fixes
    mkdir release
    cd release
    cmake -DCMAKE_BUILD_TYPE=Release ..
    WX_CONFIG=path/to/wxPython-4.1.0/build/wxbld/gtk3/wx-config make