Pkgsrc on solaris

From WTFwiki
Jump to navigation Jump to search

This is my attempt to convert opensolaris into a tolerable system using pkgsrc to provide some essential applications like zsh(1) and screen.

Getting GCC on the system

  • Download gcc and libiconv packages from
  • gunzip the files and install them by doing `pkgadd -d </path/to/file>` as root
  • Add /usr/local/bin and /usr/local/sbin to $PATH as root

Bootstrapping pkgsrc

  • Fetch the latest pkgsrc tarball from
  • cd into /usr
  • gunzip </path/to/tarball> | tar -xvf -
  • After the tarball is untarred, you should have /usr/pkgsrc
  • cd into /usr/pkgsrc/bootstrap
  • As root, run `./bootstrap` to bootstrap pkgsrc

Building gcc from pkgsrc

  • put the following in /usr/pkg/etc/mk.conf:
  • add /usr/pkg/bin, /usr/pkg/sbin and /usr/ccs/bin to $PATH
  • Run `crle -l /lib:/usr/lib:/usr/local:/usr/pkg/lib:/usr/pkg/lib/gcc3` as root
  • cd into /usr/pkgsrc/lang/gcc3-c
  • bmake install clean
  • When that's done use pkginfo to find out the names of the sunfreeware packages you installed earlier and remove them.
  • rebuild devel/libtool-base using the new gcc and `bmake update` it
  • You should now have a working pkgsrc toolchain

...probably more to come...


Xfixes fails to build

Xfixes depends on fixesext which is broken somehow in Solaris 10, solution (taken from here) is to append this to your mk.conf:

IS_BUILTIN.fixesext=    no
USE_BUILTIN.fixesext=   no
PREFER.fixesext= 	pkgsrc
# change to fixesproto
IS_BUILTIN.fixesproto=    no
USE_BUILTIN.fixesproto=   no
PREFER.fixesproto= 	pkgsrc

libiconv fails to compile

Check that /usr/pkg/bin/libtool has AR='ar' set, if not, add /usr/ccs/bin to $PATH and rebuild/reinstall libtool-base

gtexinfo or gcc fail to compile due to missing

If gtexinfo bitches about a missing try linking /usr/local/lib/ to /usr/pkg/lib. This fixed the issue for me... Probably should remove this as soon as gtexinfo and gcc and build and rebuild gtexinfo once gcc is built from pkgsrc.

This is caused by bootstrapping pkgsrc using the sun freeware gcc compiler. I recommend you avoid doing this and use sunwpro instead. The sfw gcc makes every binary it compiles rely on the library for some stupid reason.

perl5 fails to build

If when building lang/perl5 you get the error:

 perlio.c:2899: error: structure has no member named `_file'

run `CVS_RSH=ssh cvs update -A` in the directory to fetch the latest pkgsrc stuff for building perl. This should only affect pkgsrc versions 2006Q4 and below.

graphics/feh fails to compile with undefined symbols

If you get undefined symbols for 'gethostbyname' or 'bind' you need to add -lsocket and -lnsl to your linker flags

 LDFLAGS="-lsocket -lnsl" sudo bmake install clean

fonts/ttmkfdir2 fails to compile

If ttmkfdir2 fails to build with an invalid cast in commandline.cpp, try changing line 38 to:

 lopts[j].name = const_cast<char *>(i->second->name.c_str());

This is a hack, but it seems to work. Apparently this is due to solaris requiring all C strings to be const char*.

devel/glib2 fails to compile

Edit the devel/glib2/Makefile and remove c99 from USE_LANGUAGES and bmake clean; bmake install clean


As well as the refc patch noted for pkgsrc on IRIX you need to edit the c_src Makefile to have the OGLDIR path set to /usr/openwin so that the opengl headers/libraries can be linked against.


This doesn't actually work, it builds (but won't install). If you run the following command it initializes a window and segfaults:

 erl -pa /usr/pkg/lib/erlang/lib/esdl-0.95.0630/ebin -pa /usr/pkgsrc/wip/wings/work/wings-0.98.29b/ebin \
 -run wings_start start_halt

The unix/make_installer makes some stupid assumptions about install(1). Not sure how to fix them all..


Just add -lX11 to the pkgsrc Makefile build command to make it link correctly.


RUBY_USE_PTHREAD=NO bmake configure


For some reason doesn't install the terminfo entries by default. After you've run 'bmake build' cd into the work/xterm folder and run

gmake install-ti

as root to install them. Unfortunately, they install to /usr/pkg/lib/terminfo, while, for example, screen installs its terminfo files to /usr/pkg/share/lib/terminfo. I recommend you get creative with symlinks.


If all your programs that link against openssl (wget, svn, lynx, etc) coredump on startup; try compiling openssl with the sunpro compiler instead of gcc. See here. It seems to be safe to use sunpro just for this package.


Needs some patching.

Edit util.h where it checks for FreeBSD/NetBSD/DragonFly to look like this:

#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(sun)
#ifdef sun
#include <sys/byteorder.h>
#include <sys/endian.h>

#define __BYTE_ORDER            _BYTE_ORDER
#define __BIG_ENDIAN            _BIG_ENDIAN
#endif /* sun */

#define bswap_16                bswap16
#define bswap_32                bswap32
#define bswap_64                bswap64
#include <endian.h>
#include <byteswap.h>
#endif /* __FreeBSD__ */

Edit ddf_raid.c (and linux_raid.c):

#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
#include <sys/endian.h>
#elif defined(sun)
#include <sys/byteorder.h>
#include <byteswap.h>
#endif /* __FreeBSD__ */

You'll also have to hack the makefile if you're using solaris' linker because it's passing options to it it doesn't like.


Mega-horked, no fix.


See this bug report for a patch.


Add --enable-system-sqlite to CONFIGURE_ARGS in the pkgsrc Makefile and set PKG_OPTIONS.gecko= -mozilla-jemalloc in mk.conf. Then after the configure stage has run, edit toolkit/library/Makefile and remove -lCstd from EXTRA_DSO_LDOPTS.



CFLAGS.SunOS=          -fPIC

to the pkgsrc Makefile and add -liconv to EXTRALIBS in the real Makefile. Also, this package doesn't like custom CFLAGS.


See here.


If using pkgsrc 2008* cvs update to get some fixed patches.

lan/gcc34 coredumps when trying to compile this package and Sunpro doesn't work either. gcc 4.3 seems to work, if you also fix this. Also, add an #include <string> to src/display/ and an #include <cstdlib> to src/display/

At this point I gave up on rtorrent and installed the standard python bittorrent instead.


The toolchain stuff is configuring itself wrong if you use gcc on solaris. I had to edit tools/build/v2/tools/gcc.jam:

else if [ ] = SOLARIS
  linker = sun ;

in the section where it checks for AIX and stuff...


Edit src/color-profile.cpp and change the #include <sys/fnctl.h> to #include <fnctl.h> Edit sys/isnan.h and change #include <math.h> to #include <cmath> and add

# define isNaN(_a) (isnan(_a))
#define isFinite(_a) (!isNaN((_a) - (_a)))

Edit sys/2geom/isnan.h , change <math.h> to <cmath> and add

#define is_finite(_a) (!isNaN((_a) - (_a)))

You'll get lots of warnings about things being redefined, but at least it'll build.

Edit src/isinf.h to use the solaris8 definition of isinf()

Some other similar stuff I forget, but I can confirm it works, mostly.

External Links

--Andrew 00:50, 26 March 2007 (EDT)