Project

General

Profile

Actions

Backport #2826

closed

pthreads compilation failure on Solaris

Added by grobian (Fabian Groffen) about 14 years ago. Updated over 4 years ago.


Description

=begin
Original bug:
http://bugs.gentoo.org/show_bug.cgi?id=307159

Ruby's configure tries to find the right way to link against pthread libs by itself. This fails amongst others on Solaris. GCC itself knows fairly well how to link against pthreads libs using -pthread. The original error on Solaris is:

i386-pc-solaris2.10-gcc -shared -o ../../.ext/i386-solaris2.10/bigdecimal.so
bigdecimal.o -L. -L../.. -L. -Wl,-E -Wl,-R
-Wl,/nilfisk/home/dve/gentoo-new/usr/lib -L/nilfisk/home/dve/gentoo-new/usr/lib
-lruby18 -lpthread -lrt -ldl -lcrypt -lm -lc
/nilfisk/home/dve/gentoo-new/usr/lib/gcc/i386-pc-solaris2.10/4.4.3/../../../../i386-pc-solaris2.10/bin/ld:
../../libruby18.so: pthread_mutex_unlock: invalid version 2 (max 0)
../../libruby18.so: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[1]: *** [../../.ext/i386-solaris2.10/bigdecimal.so] Error 1

When -lpthread is replaced by -pthread (hence letting GCC inject the right linker arguments -- and in the correct order) this compiles fine. I created a patch to configure.in for this, but it is quite hacky, and only serves as an indication.

I tested that this patch does not break compilation on Darwin (10.4/ppc). I think the ideal solution would be to use something like ax_pthread (http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob;f=m4/ax_pthread.m4;h=37502dd83abe789d2287418f9ed10fd24c21b314;hb=7a6c511965489c38f5d3bef4afe113e3fe11c2ac) which contains all the gory logic to find the right argument to link against pthread libs.
=end


Files

ruby-1.8.7_p249-pthread-linking.patch (610 Bytes) ruby-1.8.7_p249-pthread-linking.patch grobian (Fabian Groffen), 02/28/2010 10:12 PM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0