public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* gcc on solaris
@ 2011-10-03  6:35 Christer Solskogen
  2011-10-03  7:10 ` Maciej (Matchek) Bliziński
  0 siblings, 1 reply; 4+ messages in thread
From: Christer Solskogen @ 2011-10-03  6:35 UTC (permalink / raw)
  To: gcc-help

Hi!

The gcc that comes with Solaris is quite old, so I figured that I'll 
compile my own. Compiling went fine, and that compiler even compiled 
binutils and gawk without troubles.
Then I went on installing postgresql (which also went fine) and running 
"make check" and suddenly bailed on because of missing libgcc_so.1. Aha! 
So I need to add /path/to/libgcc to "crle" (something like ld.so.conf on 
linux) But no. That did not go well.

Then I tried objdump. Compiling this test.c with Solaris gcc I got:
objdump -x a.out | grep -i rpath
   RPATH                /usr/ccs/lib:/lib:/usr/lib:/usr/sfw/lib

But with my own built gcc, I got nothing.
So, how do I add that to my own gcc?
I noticed that gcc -v on the solaris "version" said something about rpath:

/usr/sfw/bin/gcc -v
Reading specs from /usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/specs
Configured with: /builds/sfw10-gate/usr/src/cmd/gcc/gcc-3.4.3/configure 
--prefix=/usr/sfw --with-as=/usr/sfw/bin/gas --with-gnu-as 
--with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++ 
--enable-shared
Thread model: posix
gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath)

Any clue?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gcc on solaris
  2011-10-03  6:35 gcc on solaris Christer Solskogen
@ 2011-10-03  7:10 ` Maciej (Matchek) Bliziński
  2011-10-03 11:36   ` Christer Solskogen
  0 siblings, 1 reply; 4+ messages in thread
From: Maciej (Matchek) Bliziński @ 2011-10-03  7:10 UTC (permalink / raw)
  To: Christer Solskogen; +Cc: gcc-help

2011/10/3 Christer Solskogen <christer.solskogen@gmail.com>:
> The gcc that comes with Solaris is quite old, so I figured that I'll compile
> my own.

There are already efforts to provide fresh GCC on Solaris.  I myself
built a set of packages with gcc-4.6.1 for Solaris 9 and 10.  They are
available from the unstable catalog at OpenCSW.

http://mirror.opencsw.org/opencsw/

I would really appreciate if you tested my GCC packages.

> Compiling went fine, and that compiler even compiled binutils and
> gawk without troubles.
> Then I went on installing postgresql (which also went fine) and running
> "make check" and suddenly bailed on because of missing libgcc_so.1. Aha! So
> I need to add /path/to/libgcc to "crle" (something like ld.so.conf on linux)
> But no. That did not go well.
>
> Then I tried objdump. Compiling this test.c with Solaris gcc I got:
> objdump -x a.out | grep -i rpath
>  RPATH                /usr/ccs/lib:/lib:/usr/lib:/usr/sfw/lib
>
> But with my own built gcc, I got nothing.
> So, how do I add that to my own gcc?

When compiling software, add -R/path/to/the/libraries to the linker
invocation.  This can be often achieved by setting the LDFLAGS
environment variable.

LDFLAGS="-R/path/to/libgcc" ./configure ...

If that doesn't work, your last resort is setting LD_OPTIONS during
the build phase:

./configure ...
LD_OPTIONS="-R/path/to/libgcc" gmake

> I noticed that gcc -v on the solaris "version" said something about rpath:
>
> /usr/sfw/bin/gcc -v
> Reading specs from /usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/specs
> Configured with: /builds/sfw10-gate/usr/src/cmd/gcc/gcc-3.4.3/configure
> --prefix=/usr/sfw --with-as=/usr/sfw/bin/gas --with-gnu-as
> --with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++
> --enable-shared
> Thread model: posix
> gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath)
>
> Any clue?

The SFW version of GCC has a special patch which makes it add the -R
flag by default.  Unless you add that a patch, GCC will not add
anything to RPATH on its own.

If you want more context, here's a long thread about this subject:
http://sourceforge.net/mailarchive/forum.php?thread_name=1317153375.32384.5.camel%40xylabto.upc.cz&forum_name=pkgbuild-sfe-devel

Maciej

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gcc on solaris
  2011-10-03  7:10 ` Maciej (Matchek) Bliziński
@ 2011-10-03 11:36   ` Christer Solskogen
  2012-01-11 13:08     ` Maciej (Matchek) Bliziński
  0 siblings, 1 reply; 4+ messages in thread
From: Christer Solskogen @ 2011-10-03 11:36 UTC (permalink / raw)
  To: gcc-help

On 03.10.11 09:09, Maciej (Matchek) Bliziński wrote:

> The SFW version of GCC has a special patch which makes it add the -R
> flag by default.  Unless you add that a patch, GCC will not add
> anything to RPATH on its own.
>

True. So I patched the specfile of gcc instead (as found in the link you 
gave me) - that worked perfectly! :-)

         spec_string="%{m64:-R ${PREFIX}/lib/amd64 %D}%{!m64:-R 
${PREFIX}/lib %D}"
         ${PREFIX}/bin/gcc -dumpspecs | sed -e "/%D/d" | awk '{print} 
/*link_libgcc:/{print "'"${spec_string}"'"}' > ${OBJDIR}/specs
         SPECFILE=`dirname $(${PREFIX}/bin/gcc 
-print-libgcc-file-name)`/specs
         cp ${OBJDIR}/specs ${SPECFILE}

Not sure how that works out on sparc(64).

-- 
chs


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gcc on solaris
  2011-10-03 11:36   ` Christer Solskogen
@ 2012-01-11 13:08     ` Maciej (Matchek) Bliziński
  0 siblings, 0 replies; 4+ messages in thread
From: Maciej (Matchek) Bliziński @ 2012-01-11 13:08 UTC (permalink / raw)
  To: Christer Solskogen; +Cc: gcc-help

2011/10/3 Christer Solskogen <christer.solskogen@gmail.com>:
> On 03.10.11 09:09, Maciej (Matchek) Bliziński wrote:
>
>> The SFW version of GCC has a special patch which makes it add the -R
>> flag by default.  Unless you add that a patch, GCC will not add
>> anything to RPATH on its own.
>>
>
> True. So I patched the specfile of gcc instead (as found in the link you
> gave me) - that worked perfectly! :-)
>
>        spec_string="%{m64:-R ${PREFIX}/lib/amd64 %D}%{!m64:-R ${PREFIX}/lib
> %D}"
>        ${PREFIX}/bin/gcc -dumpspecs | sed -e "/%D/d" | awk '{print}
> /*link_libgcc:/{print "'"${spec_string}"'"}' > ${OBJDIR}/specs
>        SPECFILE=`dirname $(${PREFIX}/bin/gcc -print-libgcc-file-name)`/specs
>        cp ${OBJDIR}/specs ${SPECFILE}
>
> Not sure how that works out on sparc(64).

I did it with a post-build shell script[1]:

"${gcc_bin}" -dumpspecs > specs
gsed -i -e \
'/\*lib:/,+1 s+%.*+& %{m64:-R /opt/csw/lib/64 } %{!m64:-R /opt/csw/lib}+' \
specs

...and shipping the package with a custom specs file. Works well.

Maciej

[1] https://gar.svn.sourceforge.net/svnroot/gar/csw/mgar/pkg/gcc4/trunk/files/customize_specs.sh

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-01-11 12:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-03  6:35 gcc on solaris Christer Solskogen
2011-10-03  7:10 ` Maciej (Matchek) Bliziński
2011-10-03 11:36   ` Christer Solskogen
2012-01-11 13:08     ` Maciej (Matchek) Bliziński

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).