From: Andrew Morrow Date: 2006-04-27T22:34:55+09:00 Subject: [PATCH] use -shared to gcc for shared link Solaris ------=_Part_5115_13922488.1146144891305 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline While trying to build a 64 bit ruby from cvs on Solaris 10 x86 with a recent gcc-4.2 snapshot (configured to use the solaris linker) the build fails: making ruby gmake[1]: Entering directory `/home/acm/ruby/build/targets' /usr/local/gcc-4.2-20060415/bin/gcc -std=3Dgnu99 -m64 -fPIC -DRUBY_EXPORT -std=3Dgnu99 -m64 -R/home/acm/ruby/build/install/lib -L. main.o -lruby -lrt -lpthread -lsocket -ldl -lm -o ruby gmake[1]: Leaving directory `/home/acm/ruby/build/targets' ld.so.1: ruby: fatal: relocation error: R_AMD64_PC32: file ./libruby.so.1: symbol main: value 0x280011941c0 does not fit This appears to be because the shared link step for libruby was driven with -Wl,-G instead of -shared: /usr/local/gcc-4.2-20060415/bin/gcc -Wl,-G -std=3Dgnu99 -m64 -Wl,-h,libruby.so.1 -lrt -lpthread -lsocket -ldl -lm -o libruby.so.1 gcc wants to know that this is a shared link, not just the linker, and changing the shared link command LDSHARED from '$CC -Wl,-G' to '$CC -shared' in configure.in fixes the problem. The attached patch unconditionally sets LDSHARED to '$CC -shared' when using gcc on Solaris, instead of only using -shared when GNU ld is detected. Thanks, Andrew ------=_Part_5115_13922488.1146144891305 Content-Type: application/octet-stream; name=configure.in.patch Content-Transfer-Encoding: 7bit X-Attachment-Id: f_emj4tgny Content-Disposition: attachment; filename="configure.in.patch" Index: configure.in =================================================================== RCS file: /src/ruby/configure.in,v retrieving revision 1.299 diff -u -r1.299 configure.in --- configure.in 2 Feb 2006 05:51:44 -0000 1.299 +++ configure.in 26 Apr 2006 13:32:21 -0000 @@ -888,10 +888,9 @@ : ${LIBPATHENV=SHLIB_PATH} rb_cv_dlopen=yes;; solaris*) if test "$GCC" = yes; then - : ${LDSHARED='$(CC) -Wl,-G'} + : ${LDSHARED='$(CC) -shared'} if test "$rb_cv_prog_gnu_ld" = yes; then LDFLAGS="$LDFLAGS -Wl,-E" - LDSHARED="$LDSHARED -shared" fi else : ${LDSHARED='ld -G'} ------=_Part_5115_13922488.1146144891305--