Installing GCC on Oracle Solaris 11
i recently got Oracle Solaris on my VM to test some code on it, i was unable to install gcc since i dont really know how, i googled alot but all info is about oracle compilers, i needed GCC, any idea where can i get GCC or 开发者_JAVA技巧how to install it?
thanks
The original answer applied to Solaris 11 Express/non-official release - if you're doing this today with a full release of Solaris 11.x, use the pkg install
command like you see in xavier's response.
Run this command from your terminal to install GCC.
For GCC 3.4.x
pkg install gcc-3
For GCC 4.5.x
pkg install gcc-45
For GCC 4.7.x
pkg install gcc-47
For GCC 4.8.x
pkg install gcc-48
The gcc
command should then already be placed in your path /usr/bin/gcc
, which is a symlink).
Old Answer
Solaris 11 should already have gcc installed in /usr/sfw/bin/
, but it's probably not in your PATH
. Try this at the prompt: /usr/sfw/bin/gcc
Two steps:
- pkg install gcc-45
- pkg install system/header
that is all
if you see more info http://blog.csdn.net/zjg555543/article/details/8217769
Just download gcc from its homepage, follow one of the mirror links to fetch the latest binary package (in .tar.gz or tar.bz2 format), and use traditional steps to build:
- ./configure --<> // give your options
- make
- make install
The good news is you can customize what you need and always stay with the latest, while bad part is you may lose the power to debug with mdb/adb - we are facing such problems with latest GCC 4.6.x
Solaris 10 and prior version :
/usr/sfw/bin/gcc works.
Solaris 11 :
pkg install gcc-3
pkg install gcc
worked for me
This will install entire gcc collection on your machine. Which anyways will be required
My Solaris 2.11 does NOT have internet access :/
What work for me:
(1) I use this link as guideline
(2) From my windows machine, download gcc at one of their mirror sites, i used here, normally the closer the better
(3) Upload gcc-9.2.0.tar.gz to target /tmp directory using WinSCP
(4) tar -xvf gcc-9.2.0.tar.gz
(5) cd gcc-9.2.0
(6) mkdir /usr/local/gcc
(7) cd /usr/local/gcc
(8) /tmp/gcc-9.2.0/configure -v --program-suffix=9.2
At this point, you might get this error:
Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.
(9) Manually download the required files here.
Note: To know what files are required, check contrib/download_prerequisites
(10)Copy over the files in (9) to /tmp/gcc-9.2.0
(11)Extract, then create shortcuts: ln -s gmp-6.1.0 gmp, ln -s mpc-1.0.3 mpc, ln -s mpfr-3.1.4 mpfr, ln -s isl-0.18 isl
(12)/tmp/gcc-9.2.0/configure -v --program-suffix=9.2 --enable-languages=c,c++ -v
(13) nohup gmake & (At this point it's going to take some time...mine took ~6 hours. Use -j option if you can, to gmake it faster )
(14) gmake install
(15) /usr/local/bin# ./gcc9.2 --version
gcc9.2 (GCC) 9.2.0
Copyright (C) 2019 Free Software Foundation, Inc.
Voila! :-)
You can install gcc 4.3 from OpenCSW:
pkg-get -i gcc4code gcc4g++
I also had to run mkheaders manually after the install.
I had the same problem and 'pkg install gcc-3' worked for me.
I'll quote the answer from unix.stackexchange.com.
On Solaris 11 gcc
is not installed by default. Normally you'll want more than just the compiler itself so my answer will include all the usual suspects for building open source software on Solaris that you've downloaded from somewhere in source code format.
By far the easiest is to use IPS to install it using the commands below (while being root or other superuser):
pkg install pkg://solaris/developer/build/gnu-make \
pkg://solaris/developer/build/make \
pkg://solaris/developer/gcc \
pkg://solaris/system/header \
pkg://solaris/developer/build/autoconf \
pkg://solaris/developer/build/automake
(I use fully qualified package names here, that is not really necessary)
Note that some of the packages are available in the official repo in various versions. If you just reference developer/gcc
then you'll at the time of writing this get GNU C v4.8.2, but you may explicitly ask for a prior version, e.g. by using package name such as developer/gcc-45
.
精彩评论