0

I need to install GNU c/c++ in solaris 11. The box provided is a solaris zone. I don't have the sudo permission as well as root for the zone does not have the privilege for using pkg command.

Solaris 11 does not come with default gcc.

Solaris studio has been provided with the gnu c/c++ source code.

How can I install gcu c/c++ with the help of Solaris Studio.

Please help on this, thanks in advance.

Regards, Anand Kumar Keshri

  • Did you check in `/usr/sfw/bin` for `gcc` and `g++`? – wkl Nov 10 '11 at 06:26
  • Yes I checked the /usr/sfw/bin. I tried find command also. – Anand Kumar Keshri Nov 10 '11 at 06:33
  • It will be very helpful if you can tell how can I compile gcc with the help of solaris studio. – Anand Kumar Keshri Nov 10 '11 at 06:35
  • I've done this before several times, and it's an extremely error-prone and excruciating process if you can't install binaries and must build using SunCC. What version of Solaris studio are you running? Why do you need GCC over SunCC? Do you have any of the GCC build dependencies ready? (gmake 3.80+, GMP, mpfr, mpc). This is not a simple answer. – wkl Nov 10 '11 at 06:42
  • I was spiking on the internet for the feasibility of installing gnu c/c++ with the help of studio.. Whether it is possible or not ? Thanks for your answer.. that it is possible. And you have done it several times... As i don't have the permission to use pkg install gcc-3 from the zone... I was looking for this path – Anand Kumar Keshri Nov 10 '11 at 06:54
  • I'll attempt to write an answer in the morning when I am clear-headed enough to write down steps to do Solaris stuff. – wkl Nov 10 '11 at 07:01
  • Possible duplicate of [Installing GCC on Oracle Solaris 11](https://stackoverflow.com/questions/4664472/installing-gcc-on-oracle-solaris-11) – Paul Floyd Jul 11 '17 at 10:13

2 Answers2

0

Not strictly an answer to your question, but you can get a Solaris package of gcc from http://www.opencsw.org/packages/CSWgcc4core/

(I have built gcc using a non-gcc C compiler to start with, but not for many years.)

armb
  • 278
  • 2
  • 13
0

You may just build it from the sources, and install gcc in some place, where you have permissions to do so, i.e.,

./configure --prefix=${HOME}/gcc
make
make install
export PATH=${HOME}/gcc:${PATH}
  • I can't do this because it also requires gcc to compile gcc. As I mentioned there is no default gcc available. – Anand Kumar Keshri Nov 10 '11 at 06:34
  • Oh if it were really only this simple - when you're on the Solaris toolchain there is a lot more to consider (like using the GNU `ld` vs. Sun `ld` - pick the latter), and in his environment he's going to probably have to build a ton of dependencies himself. – wkl Nov 10 '11 at 06:43
  • There is a way to build gcc from source, starting with a non-gcc compiler. The process uses the native compiler to build an intermediate gcc executable, then uses that to build the final gcc. I've done it, but not in several years, and the details have probably changed with later gcc releases. I do remember that one of the steps was `make bootstrap`. And as others have mentioned, setting up the prerequisites is non-trivial. – Keith Thompson Nov 10 '11 at 06:54
  • @KeithThompson - Last time I did this was in 2010 - the process is still like that depending on your starting point. Bootstrap GCC, hope it builds with SunCC (or compiler of choice), and if that works, you can then use that GCC to rebuild the dependencies again and rebuild GCC. – wkl Nov 10 '11 at 07:00
  • I think it should be: export PATH=${HOME}/gcc/bin:${PATH} (you need the .../bin part). – automaciej Dec 06 '11 at 21:17