Opened 7 years ago

Closed 6 years ago

#2034 closed defect (fixed)

GUI crashes on launch for newly compiled binary for Mac OS X

Reported by: cmbarton Owned by: grass-dev@…
Priority: critical Milestone: 7.0.0
Component: Compiling Version: svn-trunk
Keywords: wxGUI, Python, toolboxes, ctypes Cc:
CPU: OSX/Intel Platform: MacOSX

Description

Beginning several months ago, with the introduction of the new toolbox, GRASS 7 GUI crashes on launch--after selecting a working location/mapset and after the splash screen. the immediate cause of the crash is that ..xml/menudata.xml is empty.

The reason that menudata.xml is empty is that make xml/menudata.xml fails during compilation. It fails with a bogus error of "No module named wxversion".

Here is the error:

make /Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/etc/gui/wxpython/xml/module_items.xml
Generating interface description for all modules...
GISRC=/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/demolocation/.grassrc70 GISBASE=/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0 PATH="/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/bin:/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/bin:$PATH" PYTHONPATH="/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/etc/python:/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/etc/python:$PYTHONPATH" DYLD_LIBRARY_PATH="/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/bin:/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/lib:/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/lib:" LC_ALL=C python tools/build_modules_xml.py > /Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/etc/gui/wxpython/xml/module_items.xml
make xml/menudata.xml
GISRC=/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/demolocation/.grassrc70 GISBASE=/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0 PATH="/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/bin:/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/bin:$PATH" PYTHONPATH="/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/etc/python:/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/etc/python:$PYTHONPATH" DYLD_LIBRARY_PATH="/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/bin:/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/lib:/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/lib:" LC_ALL=C python core/toolboxes.py > xml/menudata.xml
ERROR: wxGUI requires wxPython. No module named wxversion
make[4]: *** [xml/menudata.xml] Error 1
make[3]: [default] Error 2 (ignored)

A little background:

  1. I am compiling on OS X 10.8 (Mt. Lion) with some special hacks so that the binary works with OS X 10.6 (Snow Leopard). All Mac binaries are compiled with wxPython bundled in the binary so that there is no conflict between the version use for compiling and the version on a user's computer. This has worked fine for over a year.
  1. Beginning in the fall of 2012, I started getting errors during compilation from a series of new modules that share some new gui classes, including mapswipe, cartographic composer, etc. BUT, these modules work fine in spite of the compiler errors. I mention these because the cause of these errors may be related to the problem in this report.

The crash reported here seems to be associated with the new toolbox module. Glynn thinks that it may be a ctypes problem. He notes:

"It seems to start going wrong with lib/python/ctypes, specifically:

GISRC=/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/demolocation/.grassrc70 GISBASE=/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0 PATH="/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/bin:/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/bin:$PATH" PYTHONPATH="/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/etc/python:/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/etc/python:$PYTHONPATH" DYLD_LIBRARY_PATH="/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/bin:/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/lib:/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/lib:" LC_ALL=C ./ctypesgen.py --cpp "gcc -E       -I/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/include -I/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/include -D__GLIBC_HAVE_LONG_LONG" -lgrass_gis.7.0.svn   /Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/include/grass/gis.h /Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/include/grass/defs/gis.h -o OBJ.x86_64-apple-darwin12.4.0/gis.py
Status: Preprocessing /var/folders/dm/x_m7msz48xj_9c0059b59rf00000gn/T/tmpH5wFMB.h
Status: gcc -E       -I/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/include -I/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/include -D__GLIBC_HAVE_LONG_LONG -U __BLOCKS__ -U __GNUC__ -dD "-Dinline=" "-D__inline__=" "-D__extension__=" "-D_Bool=uint8_t" "-D__const=const" "-D__asm__(x)=" "-D__asm(x)=" "-DCTYPESGEN=1" "-D__uint16_t=uint16_t" "-D__uint32_t=uint32_t" "-D__uint64_t=uint64_t" /var/folders/dm/x_m7msz48xj_9c0059b59rf00000gn/T/tmpH5wFMB.h
Error: gcc -E       -I/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/include -I/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/include -D__GLIBC_HAVE_LONG_LONG: In file included from /usr/include/stdio.h:64,
Error: gcc -E       -I/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/include -I/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/include -D__GLIBC_HAVE_LONG_LONG:                  from /Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/include/grass/gis.h:24,
Error: gcc -E       -I/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/include -I/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/include -D__GLIBC_HAVE_LONG_LONG:                  from /var/folders/dm/x_m7msz48xj_9c0059b59rf00000gn/T/tmpH5wFMB.h:1:
Error: gcc -E       -I/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/include -I/Users/Shared/grass_dev/grass7_dev/dist.x86_64-apple-darwin12.4.0/include -D__GLIBC_HAVE_LONG_LONG: /usr/include/sys/cdefs.h:81:2: warning: #warning "Unsupported compiler detected"
Status: Parsing /var/folders/dm/x_m7msz48xj_9c0059b59rf00000gn/T/tmpH5wFMB.h
Error: /usr/include/stdio.h:252: Syntax error at '__attribute__'
Error: /usr/include/stdio.h:252: Syntax error at 'i2'

I'm wondering if it's trying to use headers written for gcc with clang, or vice versa.

In any case, if lib/python/ctypes fails, any Python modules which import modules from grass.lib will fail."

This is where we are right now.

There is a workaround, found by Anna.

  1. start GRASS 7
  2. in the terminal, cd to ../gui/wxpython
  3. run: python core/toolboxes.py > xml/menudata.xml
  4. then you can start the GUI with g.gui

William Kyngesburye reports that he has no problem if he compiles with wxPython 2.9 and Python 2.7. I'm using wxPython 2.8.12 and Python 2.6 for backward compatibility, but there should not be any code specific to wxPython 2.9 or Python 2.7 in the relevant modules. Also, I tried compiling with new Python and wxPython and still got errors.

Anna, Glynn--and I--think this is a deeper problem (maybe in ctypes code or implementation) that probably affects other things but that is not causing a crash.

Change History (8)

comment:1 Changed 7 years ago by mlennert

What is the status of this bug ?

Moritz

comment:2 Changed 7 years ago by cmbarton

This was still the case for me when I last compiled GRASS 7 a couple weeks ago. There have been some changes since which may or may not make a difference. I'm traveling this week and tied up the first half of next week. I might be able to do a test tomorrow, but would not count on it. Otherwise, I can compile and test again when I have a more time in a couple weeks..

Michael

comment:3 Changed 7 years ago by annakrat

I don't think any recent changes are related.

A few days ago I compiled GRASS 7 on Mac 10.8 with wxPython 2.8 and I had problems only with the 32/64 architecture (which I expected and solved by setting VERSIONER_PYTHON_PREFER_32_BIT=yes) and other problems (r57536, r57537). None of these problems is related to the issue described here.

So it could be related to the 'special hacks' you do to make the binary work with Mac 10.6, or there is some mess in your python/wxPython installation (I had similar problems myself when I upgraded to newer Ubuntu version) and another possible reason is some hidden problem in GRASS. Probably it's a combination of these problems.

comment:4 Changed 7 years ago by wenzeslaus

To summarize:

The discussion GRASS 7 crashes on startup on Mac (nabble) contains a workaround to get rid of the menudata.xml error which is mentioned in the ticket.

The discussion no more GRASS 7 for Mac (nabble) extends the workaround because now there is a more than one file of that type (generated menudata.xml from toolboxes files).

The discussion Mac OS 10.8: g.gui and DISPLAY (nabble, originally named as "Max OS 10.8: g.gui and DISPLAY") mentioned before and revisions r57536 and r57537 are important but unrelated to this ticket.

The unrelated discussion Resources about compiling on Mac OS X (nabble) contains a detailed description of the workaround. cmbarton on ML:

Seem like this needs to be done in the GRASS-7.0.app. So you have to run bindist first.
Then launch GRASS 7. The GUI will crash.
From the GRASS command line, cd to the ../gui/wxpython directory inside the GRASS-7.0.app and run... 
python core/toolboxes.py > xml/menudata.xml
python core/toolboxes.py "module_tree" > xml/module_tree_menudata.xml
Next, copy the newly created menudata.xml and module_tree_menudata.xml files back into the binary distribution (in ../dist.x86_64-apple-darwin12.4.0) and rerun bindist to make a new GRASS-7.0.app and *.pkg.

The reasons for and connections between the menudata.xml error (not compiled XML file) and ctypes __attribute__ error are still unclear. We only know that you can get the __attribute__ error and not get menudata.xml error (tested on Mac OS 10.8) at the same time.

comment:5 Changed 7 years ago by cmbarton

Just tested. Still broken. Workaround still works.

comment:6 Changed 6 years ago by wenzeslaus

Component: wxGUICompiling
Keywords: wxGUI Python toolboxes ctypes added

The creation of toolboxes files can be made less vulnerable by implementing enhancement #2142. However, the error toolboxes error with two step compilation workaround is not caused by creation of toolboxes itself but probably by compilation (or environment during compilation).

Note that it happens not only for Mac OS X but sometimes for some Ubuntus too (but the circumstances are unclear, it can happen when preparing package for PPA in Launchpad). See G7-gui and G64 add-on problems on Xubuntu (installation from grass/ubuntugis ppa) (nabble, gmane).

comment:7 Changed 6 years ago by annakrat

I haven't had problems recently with compilation on Mac, perhaps this r60007 fixed that? It is already backported. Can we close this ticket?

comment:8 Changed 6 years ago by cmbarton

Resolution: fixed
Status: newclosed

AFAICT, this has been fixed in the current versions of both 7.1 and 7.0 svn. So I can think we can close. Thanks much.

Closing.

Michael

Note: See TracTickets for help on using tickets.