Ruby 1.8.7 fails to build on Mountain Lion #193

Closed
lloeki opened this Issue Aug 2, 2012 · 20 comments

Projects

None yet
@lloeki
Contributor
lloeki commented Aug 2, 2012

Build fails, complaining about tk. Examining log shows that it's actually related to missing X11 headers.

To build:

  1. install XQuartz
  2. export CPPFLAGS=-I/opt/X11/include
  3. rbenv install 1.8.7-p358

Source

@noniq
noniq commented Aug 5, 2012

I can confirm the problem – installing XQuartz and setting CPPFLAGS helps indeed, thank you!

For the record, here is (part of) the output of the failed build:

Last 10 log lines:
tcltklib.c:9862: error: expected ‘;’ before ‘event’
tcltklib.c:9892: error: ‘struct dummy_TkMenu’ has no member named ‘menuType’
tcltklib.c:9897: error: ‘struct dummy_TkMenu’ has no member named ‘menuType’
tcltklib.c:9915: error: ‘event’ undeclared (first use in this function)
tcltklib.c:9916: error: ‘ConfigureNotify’ undeclared (first use in this function)
tcltklib.c:9917: error: ‘Tk_FakeWin’ has no member named ‘display’
tcltklib.c:9919: error: ‘Tk_FakeWin’ has no member named ‘window’
tcltklib.c:9920: error: ‘Tk_FakeWin’ has no member named ‘display’
make[1]: *** [tcltklib.o] Error 1
make: *** [all] Error 1
@wingrunr21

You shouldn't need to set CPPFLAGS. The XQuartz installer should symlink /usr/X11 to /opt/X11.

@lloeki
Contributor
lloeki commented Aug 14, 2012

The XQuartz installer should symlink /usr/X11 to /opt/X11.

Do you mean it should do this but currently does not, or that it should have done it but for some reason failed to?

@wingrunr21

It should have done so. If it did not, you can try reinstalling XQuartz or just symlink it yourself.

@cpence
cpence commented Aug 14, 2012

I just ran into exactly this issue. I have the latest XQuartz, and I do have symlinks both from /usr/X11/ and /usr/X11R6/ to /opt/X11/. (EDIT: I think those symlinks are created by Homebrew when it notices you have XQuartz.)

@lloeki
Contributor
lloeki commented Aug 14, 2012

I checked, and I have them too, on both of my machines.
On 14 Aug 2012, at 21:10, Charles Pence notifications@github.com wrote:

I just ran into exactly this issue. I have the latest XQuartz, and I do have symlinks both from /usr/X11/ and /usr/X11R6/ to /opt/X11/.


Reply to this email directly or view it on GitHub.

@cpence
cpence commented Aug 14, 2012

Notably, is there some way (a configure switch?) to prevent Ruby from building the Tcl/Tk example? AFAICT, that's what's causing the error here, and I can't see any reason that anybody would care about whether or not that example would build.

@wingrunr21

Odd. I remember getting this error when I upgraded and recall it not requiring setting that variable once the symlinks were in place.

@jevy
jevy commented Sep 25, 2012

+1 works for me. Sending love your way.

@naomik
naomik commented May 2, 2013

Or you can use --without-tk

Because seriously... tcl/tk? lel.

@mceachen

@naomik is right—if you aren't building some ironic hipster Tcl/Tk UI, and you're using rbenv, this is simplest:

CONFIGURE_OPTS=--without-tk rbenv install 1.8.7-p370
@naomik
naomik commented Jun 3, 2013

@mceachen lol. You made my day.

@leehambley

👍 for @mceachen's:

CONFIGURE_OPTS=--without-tk rbenv install 1.8.7-p370
@wdiechmann

@naomik - what a smart girl !!
and @mceachen: 👍 for the 'finishing touch' :)

@wdiechmann

@naomik that came out all wrong! I did not imply anything except my admiration of your insights!! And from your avatar I reckoned you to be a female – hence the stupid comment. Sorry!

@naomik
naomik commented Aug 20, 2013

@wdiechmann - what a strange thing to say !!

@bendilley

👍 @naomik and @mceachen - thanks v. much for this solution!

@acubillos

Thanks @naomik it worked for me!

@joegoggins

👍 Props to @naomik and @mceachen, works great.

@karmi
karmi commented Sep 26, 2013

@mceachen Excellent advice with great style. Thanks! :)

@mislav mislav added a commit that referenced this issue Oct 27, 2013
@mislav mislav Enable compiling Ruby 1.8 on OS X 10.8+ without extra flags
Because OS X Mountain Lion removed X Windows, compiling Ruby 1.8 would
fail unless the user installed XQuartz manually and passed:

    CPPFLAGS=-I/opt/X11/include rbenv install 1.8.7-p374

This auto-detects if `/opt/X11/include` is present on the system and
configures CPPFLAGS accordingly. However if XQuartz was never installed,
we simply configure Ruby using `--without-tk`.

Fixes #193 #207

References 3532469
d13ae0a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment