Build issues on Leopard

Hello,
I’m having some issues building r190 on Leopard (10.5.1):

$ rake
(in /Users/johan/temp/superredcloth)
ragel superredcloth_scan.rl | rlgen-cd -G2 -o superredcloth_scan.c
ragel superredcloth_inline.rl | rlgen-cd -G2 -o superredcloth_inline.c
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
extconf.rb
checking for main() in -lc… yes
creating Makefile
make
gcc -I. -I.
-I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-
darwin9.0 -I. -fno-common -arch ppc -arch i386 -Os -pipe -fno-common
-c
superredcloth_inline.c
powerpc-apple-darwin9-gcc-4.0.1: Internal error: Segmentation fault
(program
cc1)
Please submit a full bug report.
See URL:http://developer.apple.com/bugreporter for instructions.
i686-apple-darwin9-gcc-4.0.1: Internal error: Segmentation fault
(program
cc1)
Please submit a full bug report.
See URL:http://developer.apple.com/bugreporter for instructions.
make: *** [superredcloth_inline.o] Error 1
rake aborted!
Command failed with status (2): [make…]
/Users/johan/temp/superredcloth/rakefile:129

(I tried removing the -arch ppc flags from the Makefile, still
segfaults)

$ ruby -v
ruby 1.8.6 (2007-06-07 patchlevel 36) [universal-darwin9.0]

$ ragel -v # (from macports)
Ragel State Machine Compiler version 5.24 September 2007
Copyright © 2001-2007 by Adrian Thurston

$ which gcc; gcc --version
/usr/bin/gcc
i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5465)
Copyright © 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

Anyone know what’s up?

Thanks,
JS

On 12/11/07, Johan Sørensen [email protected] wrote:

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
Please submit a full bug report.
See <URL:http://developer.apple.com/bugreporter > for instructions.
i686-apple-darwin9-gcc-4.0.1: Internal error: Segmentation fault (program
cc1)
Please submit a full bug report.
See <URL: http://developer.apple.com/bugreporter> for instructions.
make: *** [superredcloth_inline.o] Error 1
rake aborted!
Command failed with status (2): [make…]
/Users/johan/temp/superredcloth/rakefile:129

The solution here was to use the -O1 instead of the default (generated)
-Os
CFLAG.

Here’s a patch (there may be better ways to do this with mkmf?):

Index: ext/superredcloth_scan/extconf.rb

— ext/superredcloth_scan/extconf.rb (revision 190)
+++ ext/superredcloth_scan/extconf.rb (working copy)
@@ -1,5 +1,10 @@
require ‘mkmf’

+if /darwin9/ =~ RUBY_PLATFORM

  • OSX 10.5 doesn’t like the default “-Os”

  • $CFLAGS << " -O1 "
    +end

dir_config(“superredcloth_scan”)
have_library(“c”, “main”)

JS

Thanks! Patch applied.