gcc on solaris
Maciej (Matchek) Bliziński
maciej@opencsw.org
Mon Oct 3 07:10:00 GMT 2011
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
More information about the Gcc-help
mailing list