Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R fails after installing GTK and RGtk2

Tags:

r

gtk

rgtk2

I've installed R3.0 on my Mountain Lion Mac and after some trial and error the version of GTK suggested by http://r.research.att.com/ for R3.0: GTK+ 2.24.17 framework.

I load the package into R3.0 and run one of the demo. I see (for an instant) that a graph is generated, but immediately R crashes. Typically the crash takes place when I run the line "win$showAll()" (CairoDevice work no problem). This is the beginning of the error log generated (with the details of my configuration). Thanks!


Process:         R [2307]
Path:            /Applications/R.app/Contents/MacOS/R
Identifier:      org.R-project.R
Version:         R 3.0.0 GUI 1.60 Snow Leopard build (6476)
Code Type:       X86-64 (Native)
Parent Process:  launchd [231]
User ID:         501

Date/Time:       2013-04-07 23:54:11.976 +0100
OS Version:      Mac OS X 10.8.3 (12D78)
Report Version:  10

Interval Since Last Report:          11186 sec
Per-App Interval Since Last Report:  1133 sec
Per-App Crashes Since Last Report:   11
Anonymous UUID:                      2C9EB7F4-E0B7-FDC4-7300-075C23CD86BB

Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000

Application Specific Information:
Assertion failed: (_cairo_status_is_error (status)), function _cairo_error, file cairo-error.c, line 68.


Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib          0x00007fff8afbd212 __pthread_kill + 10
1   libsystem_c.dylib               0x00007fff867ccb54 pthread_kill + 90
2   libsystem_c.dylib               0x00007fff86810dce abort + 143
3   libsystem_c.dylib               0x00007fff86811e2a __assert_rtn + 146
4   libcairo.2.dylib                0x000000010d383cdc _cairo_error + 48
5   libcairo.2.dylib                0x000000010d37c6f7 _cairo_set_error + 19
6   libgtk-x11-2.0.0.dylib          0x000000010eca326a gtk_default_draw_focus + 554
7   libgtk-x11-2.0.0.dylib          0x000000010ec63dfc gtk_range_expose + 1644
8   libgtk-x11-2.0.0.dylib          0x000000010ec7e2b8 gtk_scale_expose + 120
9   libgtk-x11-2.0.0.dylib          0x000000010ec22e79 _gtk_marshal_BOOLEAN__BOXED + 169
10  libgobject-2.0.0.dylib          0x0000000109642455 g_closure_invoke + 245
11  libgobject-2.0.0.dylib          0x00000001096524c8 signal_emit_unlocked_R + 2216
12  libgobject-2.0.0.dylib          0x0000000109653528 g_signal_emit_valist + 3336
13  libgobject-2.0.0.dylib          0x0000000109653a64 g_signal_emit + 116
14  libgtk-x11-2.0.0.dylib          0x000000010ed38bd8 gtk_widget_event_internal + 664
15  libgtk-x11-2.0.0.dylib          0x000000010eba0fc1 gtk_container_propagate_expose + 369
16  libgtk-x11-2.0.0.dylib          0x000000010eb72e06 gtk_box_forall + 54
17  libgtk-x11-2.0.0.dylib          0x000000010eba3936 gtk_container_expose + 150
18  libgtk-x11-2.0.0.dylib          0x000000010ec22e79 _gtk_marshal_BOOLEAN__BOXED + 169
19  libgobject-2.0.0.dylib          0x0000000109642455 g_closure_invoke + 245
20  libgobject-2.0.0.dylib          0x00000001096524c8 signal_emit_unlocked_R + 2216
21  libgobject-2.0.0.dylib          0x0000000109653528 g_signal_emit_valist + 3336
22  libgobject-2.0.0.dylib          0x0000000109653a64 g_signal_emit + 116
23  libgtk-x11-2.0.0.dylib          0x000000010ed38bd8 gtk_widget_event_internal + 664
24  libgtk-x11-2.0.0.dylib          0x000000010eba0fc1 gtk_container_propagate_expose 
like image 880
Enzo Avatar asked Apr 07 '13 22:04

Enzo


2 Answers

I too had this problem. Here is how I worked around it using macports gtk2 -- not the http://r.research.att.com/ version. This was with R version 3.0.1 (2013-05-16) -- "Good Sport", also compiled from source.

install gtk2

sudo port install gtk2 ## (X11 -- not aqua)

configure

export PATH=/opt/local/bin:/opt/local/sbin:$PATH

then install

I downloaded RGtk2 and cairoDevice from CRAN and did source install:

R CMD INSTALL RGtk2
R CMD INSTALL cairoDevice
like image 82
jverzani Avatar answered Oct 04 '22 08:10

jverzani


In addition to jverzani's answer, if you want to use Homebrew:

brew install gtk+
export PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig:$PKG_CONFIG_PATH

and then install RGtk2 and cairoDevice from source.

like image 25
masaha03 Avatar answered Oct 04 '22 06:10

masaha03