Dec 21, 2008

HOWTO: installing gmake, gcc, svn and git on OpenSolaris

OpenSolaris is a cool OS, but it's lacking a lot of software packages present in all Linux distributions. This should improve gradually, but in the meantime, you probably will have to rebuild a lot of stuff from source.

However, some really basic tools are not installed by default:
  • GNU make,
  • gcc / g++, the GNU C / C++ compilers,
  • svn, a well-known revision control system,
  • git, another well-known revision control system
Let's take care of this.

1) Installing GNU make

julien@opensolaris:~$ sudo pkg install SUNWgmake
DOWNLOAD PKGS FILES XFER (MB)
Completed 1/1 6/6 0.22/0.22
PHASE ACTIONS
Install Phase 31/31
PHASE ITEMS
Reading Existing Index 9/9
Indexing Packages 1/1
julien@opensolaris:~$ gmake
gmake: *** No targets specified and no makefile found. Stop.


2) Installing GNU C / C++

julien@opensolaris:~$ sudo pkg install SUNWgcc
DOWNLOAD PKGS FILES XFER (MB)
Completed 4/4 2086/2086 29.94/29.94
PHASE ACTIONS
Install Phase 2512/2512
PHASE ITEMS
Reading Existing Index 9/9
Indexing Packages 4/4
julien@opensolaris:~$ gcc
gcc: no input files

3) Installing Subversion

julien@opensolaris:~$ sudo pkg install SUNWsvn
DOWNLOAD PKGS FILES XFER (MB)
Completed 4/4 249/249 2.05/2.05
PHASE ACTIONS
Install Phase 372/372
PHASE ITEMS
Reading Existing Index 9/9
Indexing Packages 4/4
julien@opensolaris:~$ svn
Type 'svn help' for usage.

4) Installing Git

Let's build Git from source. You need to download the latest stable release from the Git homepage (1.6.0.6 at the time of writing):

julien@opensolaris:~$ wget http://kernel.org/pub/software/scm/git/git-1.6.0.6.tar.bz2
--20:23:40-- http://kernel.org/pub/software/scm/git/git-1.6.0.6.tar.bz2
=> `git-1.6.0.6.tar.bz2'
Resolving kernel.org... 149.20.20.133, 204.152.191.37
Connecting to kernel.org|149.20.20.133|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1,882,225 (1.8M) [application/x-bzip2]
100%[====================================>] 1,882,225 126.47K/s ETA 00:00
20:23:55 (122.96 KB/s) - `git-1.6.0.6.tar.bz2' saved [1882225/1882225]

julien@opensolaris:~$ bzip2 -d git-1.6.0.6.tar.bz2
julien@opensolaris:~$ tar xvf git-1.6.0.6.tar
julien@opensolaris:~$ cd git-1.6.0.6
julien@opensolaris:~$ ./configure --prefix=/usr/local
julien@opensolaris:~$ gmake
julien@opensolaris:~$ sudo make install
julien@opensolaris:~$ git --version
git version 1.6.0.6

Done! Now we have a basic build environment on OpenSolaris :)

You also may want to check the 'GNU' section in the graphical Package Manager: it lists all GNU packages available for OpenSolaris, including automake, autoconf, etc.

3 comments:

  1. The default OpenSolaris user can use 'pfexec' instead of 'sudo' - this has some advantages, like when you send a command over ssh. It's single sign-on, too.

    ReplyDelete
  2. I tried to install Git and I got an error seen below:

    #sudo make install
    make: Fatal error in reader: Makefile, line 158: Unexpected end of line seen


    Have you seen this before?

    ReplyDelete
  3. I think you can skip dealing with this and just add the dev repository, then do 'pkg install SUNWgit' or something like that.

    The repo is at http://pkg.opensolaris.org/dev

    ReplyDelete