现在的位置: 首页 > 综合 > 正文

Building GCC 4.2.1 On Solaris

2013年02月13日 ⁄ 综合 ⁄ 共 1896字 ⁄ 字号 评论关闭
The default version of gcc shipped with Solaris 10 is 3.4.3 and is found in /usr/sfw/bin. The current available version of gcc (released is) 4.3. So the version Sun makes available dates from 2005...

[allen@tecra:pciutils-3.0.0]uname -a
SunOS tecra 5.11 snv_85 i86pc i386 i86pc Solaris

[allen@tecra:pciutils-3.0.0]gcc -v
Reading specs from /usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/specs
Configured with: /builds2/sfwnv-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++,f77,objc --enable-shared
Thread model: posix
gcc version 3.4.3 (csl-sol210-3_4-20050802)

One
assumes that Sun has no interest in letting Solaris users use more
modern versions of gcc and would rather we use their own compiler.

But to properly compile on Solaris 10 with 64bit see notes from gcc.gnu.org

"i?86-*-solaris2.10
Use
this for Solaris 10 or later on x86 and x86-64 systems. This
configuration is supported by GCC 4.0 and later versions only.

It is recommended that you configure GCC to use the GNU assembler in /usr/sfw/bin/gas but the Sun linker, using the options --with-gnu-as --with-as=/usr/sfw/bin/gas --without-gnu-ld --with-ld=/usr/ccs/bin/ld"


So gcc 4.0 is the lowest version you can use for cross-compiling 32bit and 64bit applications on Solaris 10...


So we have to build our own gcc to do the firebird compilation, here's how you do it....
1. Download a copy of the gcc source (e.g. gcc-4.1.2.tar.gz) from gcc.gnu.org
2. Install gnu tar, solaris tar has problems extracting the source from the gcc tar file.
3. You will probably need to install libintl too (you can get a pre-built version of this froim www.sunfreeware.com)
4. gunzip gcc-4.1.2.tar.gz
5. /usr/local/bin/tar -xvf gcc-4.1.2.tar
6. cd gcc-4.1.2
7. mkdir objdir
8. cd objdir
9.
../configure --with-gnu-as --with-as=/usr/sfw/bin/gas --without-gnu-ld
--with-ld=/usr/ccs/bin/ld --enable-shared --enable-languages=c,c++
10. gmake
11. as root - make install

Your new version of gcc will be installed in /usr/local/bin

Appendix:
1. For gcc on Solaris, this site is very helpful.
http://www.softpanorama.org/Lang/gcc.shtml

抱歉!评论已关闭.