Seg fault when building ruby 1.8.6-p111 on MacOS X 10.5

I’m getting a segmentation fault when building ruby 1.8.6-p111 (from
source and by itself, not as part of a larger distribution). I’m
running on a clean version of MacOS X 10.5 and a new build of readline
5.2 installed in /usr/local.

My configure line is: ./configure --prefix=/usr/local/ruby --with-
readline-dir=/usr/local/readline --enable-pthread

There weren’t any issues that I could see during the configure process
and the make process looked fine right up until the segmentation
fault. Here’s where it ended:

gcc -g -O2 -pipe -fno-common -DRUBY_EXPORT -I. -I. -c time.c
gcc -g -O2 -pipe -fno-common -DRUBY_EXPORT -I. -I. -c util.c
gcc -g -O2 -pipe -fno-common -DRUBY_EXPORT -I. -I. -c variable.c
gcc -g -O2 -pipe -fno-common -DRUBY_EXPORT -I. -I. -c version.c
gcc -g -O2 -pipe -fno-common -DRUBY_EXPORT -I. -I. -c dmyext.c
ar rcu libruby-static.a array.o bignum.o class.o compar.o dir.o dln.o
enum.o error.o eval.o file.o gc.o hash.o inits.o io.o marshal.o math.o
numeric.o object.o pack.o parse.o process.o prec.o random.o range.o
re.o regex.o ruby.o signal.o sprintf.o st.o string.o struct.o time.o
util.o variable.o version.o dmyext.o
gcc -g -O2 -pipe -fno-common -DRUBY_EXPORT -I. -I. -c main.c
gcc -g -O2 -pipe -fno-common -DRUBY_EXPORT -I. -I. -c dmydln.c
gcc -g -O2 -pipe -fno-common -DRUBY_EXPORT -L. main.o dmydln.o
libruby-static.a -lpthread -ldl -lobjc -o miniruby
ruby: [BUG] Segmentation fault
ruby 1.8.6 (2007-09-24) [i686-darwin9.0.0]

make: *** [.rbconfig.time] Abort trap

Has anyone else run into this and maybe found a solution?



Interestingly, I’m getting the same problem when building ruby 1.8.6-
p110 and ruby 1.8.6-p36… the latter being the same version that is
include in the shipping OS!

I’ve found many references to this issue, but never any explanation
for what causes it, let alone a solution to fixing it.


So I was able to get ruby to compile by removing the --enable-pthread
option. I’m not sure why that was needed though, since I’ve always
used it before. I did see a reference to ruby not liking pthread
enabled if tcl/tk’s pthread was disabled, but that there was a warning
mechanism in place to handle that.

I’m going to try building my own version of tcl/tk and seeing if I can
get things to be happy again with pthread, but if anyone knows a
different way of fixing things up, I’d really appreciate it.


Laurent has already explained why this is and provides patches. Which
already have been committed to macports.

FMI see …

What type of performance does pthread offer when it is enabled?