How to use pkgsrc on Solaris

From NetBSD Wiki

Jump to: navigation, search

Document status: DRAFT

In this article I will document how to transform a Solaris 10 x86 core installation into a pkgsrc-powered desktop system. The Solaris core installation does not include any X11, GNOME or GNU utilites. We will use modular X.org from pkgsrc. The guide assumes that the reader has some prior experience using Solaris and pkgsrc.


Contents

Installation

Begin by installing a Solaris core system. When done, mount the Solaris CD/DVD and install the following extra packages:

  • SUNWarc Lint Libraries (usr)
  • SUNWbtool CCS tools bundled with SunOS (Solaris 9)
  • SUNWbzip The bzip compression utility
  • SUNWdoc Documentation Tools
  • SUNWhea SunOS Header Files
  • SUNWlibm Math & Microtasking Library Headers & Lint Files (Usr)
  • SUNWlibmr Math Library Lint Files (Root) (Solaris 10)
  • SUNWman On-Line Manual Pages
  • SUNWscpr Source Compatibility, (Root)
  • SUNWscpu Source Compatibility, (Usr)
  • SUNWsprot Solaris Bundled tools
  • SUNWtoo SUNWtoo Programming Tools
  • SUNWxcu4 XCU4 Utilities

These packages are required if you intend to use modular-xorg-server from pkgsrc:

  • SUNWdfbh Dumb Frame Buffer Header Files
  • SUNWaudh Audio Header Files (don't ask why!)
# mount -F hsfs /dev/dsk/c1t1d0p0 /mnt
# cd /mnt/Solaris10/Product
# cp -r SUNW... /var/spool/pkg
# pkgadd

To see which SUNW packages are already installed, use the /usr/bin/pkginfo command.

Compiler setup

Now you need a compiler. You have a couple of options:

  • Use my prebuilt compiler kit, available from http://notyet
  • Install SUNWgcc from the Solaris DVD
  • Install Sun Studio 10
  • Install gcc from Sunfreeware.com
  • [advanced] Bootstrap your own gcc, using one of the above. If you get an error about a library not being found, remember to use crle -u -l libpath to add it to the link path. Make sure any /usr/pkg/* library paths are included early in this string so that pkgsrc binaries will only have dependencies on pkgsrc libraries as much as possible.

pkgsrc

Got a compiler? Good! Let's download and bootstrap pkgsrc.

Grab pkgsrc.tar.gz from ftp://ftp.NetBSD.org/pub/pkgsrc/current/ and untar to /usr, or get it from CVS.

# cd /usr/pkgsrc/bootstrap
# env CFLAGS=-O2 CC=/usr/local/gcc4/bin/gcc ./bootstrap

[coffee break]

Now we can tune /usr/pkg/etc/mk.conf. I use the following additional settings:

CFLAGS+=-O2
CXXFLAGS+=-O2
CC=/usr/local/gcc4/bin/gcc
CXX=/usr/local/gcc4/bin/g++
X11_TYPE=modular
PKG_DEVELOPER=yes
PKG_DEFAULT_OPTIONS+=freetype truetype mmx subpixel official-mozilla-branding

At this point you're free to install whatever packages you like.

Installing modular X.org from pkgsrc

It is mentioned above, but easy to miss... you really want to set X11_TYPE=modular in mk.conf, otherwise none of this will work. You will also want to set MOTIF_TYPE=openmotif or MOTIF_TYPE=lesstif to avoid having pkgsrc/mk/motif.buildlink3.mk choose /usr/dt/... which requires X11_TYPE=native instead of modular.

Packages needed for modular X.org are:

  • meta-pkgs/modular-xorg-fonts
    • xxx: fonts/mkfontdir needs a hack that I have not yet committed
  • meta-pkgs/modular-xorg-apps
  • x11/modular-xorg-server
    • xxx: needs some hacks that have not yet been committed (--disable-dri, libdrm, driproto KDSETMODE ioctl, vtname /dev/fb)
  • x11/xf86-input-keyboard
  • x11/xf86-input-mouse
  • x11/xf86-video-vesa (or pick a suitable driver for your card)
  • x11/xterm

Now run /usr/pkg/bin/Xorg -configure, which should work. Move the generated configuration file to /etc/X11/xorg.conf. Now you can attempt to start the server, by running Xorg with no arguments. If you get a picture, but the mouse isn't working, try to set your mouse device to "/dev/kdmouse" and the protocol to "PS/2" in xorg.conf.

TODO: write about installing firefox, desktop stuff, ...

Outstanding PR's with patches

There are some PR's with patches that solve Solaris build issues that are not yet committed. These may solve a problem you are having.

  • pkg/40153 - Synopsis: pkgsrc/devel/binutils fails to build on solaris 10 sparc
  • pkg/40154 - Synopsis: pkgsrc/print/acroread8 adding solaris sparc support
  • pkg/40201 - Synopsis: pkgsrc/sysutils/memconf update needed
  • pkg/40203 - Synopsis: pkgsrc/net/tcpdump fix build on solaris
  • pkg/39775 - Synopsis: trying to get print/ghostscript to work under Solaris
  • pkg/39085 - Synopsis: firefox3 compile problem (just committed!)
  • pkg/36132 - Synopsis: x11/openmotif Solaris Xorg modular
  • pkg/40221 - Synopsis: pkgsrc/mail/p5-Mail-Mbox-MessageParser requires GNU grep (needed by grepmail)
  • pkg/40222 - Synopsis: pkgsrc/databases/sqsh fix build w/sybase libs on Solaris
  • pkg/40223 - Synopsis: pkgsrc/www/htmldoc update to 1.8.27 (fixes build on Solaris too)

Other hints

These may not be the 'right' think to do, but are still a help to get past some issues until the right thing can be figured out:

  • errors building libffi (required by python 2.5+) using Sun Studio compiler can be worked around by using gcc or setting:
  PYTHON_VERSION_DEFAULT=24
  • errors regarding a missing gtk-rebase can be worked around by installing the package textproc/gtk-doc
  • using a native jdk (on anything except SunOS-5.11-i386, which already works) can be done by adding these to /usr/pkg/etc/mk.conf:
  PKG_JVM_DEFAULT=                sun-jdk6
  _PKG_JVMS_ACCEPTED+=            sun-jdk6
  • errors regarding wrong number of arguments to readdir_r() and some other xxx_r() functions can be fixed by adding to the package Makefile:
  CFLAGS.SunOS+=                  -D_POSIX_PTHREAD_SEMANTICS

If you encounter issues with missing libraries, refer to the pkgsrc guide first.

See also

External links

Personal tools