slocate on opensolaris

If you’re looking for how to get slocate on opensolaris working, skip to the bottom of the article for step-by-step instructions.

Getting up to speed on opensolaris is a gradual process. There are tools you take for granted in Linux, that suddenly aren’t there, and it can be quite frustrating trying to figure out what package they’re in. Even tools that don’t seem to exist!

One of the most important is locate, or slocate (I’m not fussy – either will do nicely). After a frustrating hunt for the package containing it, I turned to google, which seems to tell me there is no (s)locate package! So I’ll have to build from source.

Right, google takes me to slocate.trakker.ca. Download it, check the signature. Hmm, no chain of trust, but a bit more googling finds the author is a Debian developer, and debian.org vouches for him. So the chance of it being a trojan is pretty much negligible. OK, go ahead.

Ouch! There’s no configure, only a Makefile. If I just try to make, it complains of missing header files. Where to find them, or am I onto a loser?

A bit more googling finds me this article, which recommends installing slocate version 2.7 which comes with a configure script. So I tried, only to find that doesn’t work either. Too many missing pieces, and silly things like a hardwired autoconf-1.4 (OpenSolaris offers 1.9 and 1.10). Fixing that just launches me into the next problem. Bah, humbug.

But wait: there’s also an autogen.sh. Running that is a different story: it generates a Makefile that Just Works! Right, now I have the binary. make install still fails, but make -n install tells me what I need to do (and it’s not much). So I can do that by hand without pain.

Now updatedb runs just fine, whereupon I have a working locate. Eureka!

HowTo

    • Ensure you have a GNU build environment. For example, pfexec pkg install gcc-dev will give you that, if you don’t already have it.
    • Download slocate 2.7 from slocate.trakker.ca, and verify the PGP signature.
    • Unpack slocate-2.7 and cd to it.
    • Run autogen.sh
    • make
    • make -n install
    • Follow the steps shown, but use cp rather than install, since the latter is incompatible with the usage in the Makefile.
    • Optionally, create /etc/updatedb.conf
    • Run updatedb, and try a locate (you may want to add /usr/local/bin to your PATH if it’s not there already).
    • Finally set up the cron job to taste. I find a weekly updatedb works well for me, but YMMV.

      Posted on July 8, 2008, in opensolaris. Bookmark the permalink. 6 Comments.

      1. thanks for the info on autogen.sh. I actually installed an instance of autoconf-1.4 to get the configure working.

        The final of part of the makefile error is because the install command accept diffrent parameter in solaris than in linux, which the makefile is suppossed to be made for.

        I editted the make files for it to work. It’s a simple edit if you know what to look for. But your solution seems easier than mine.

      2. I found it easier to edit the generated Makefile than to do the install manually. It’s acutally quite trivial. The patch follows, but I suspect that you’re better off just making the changes by hand. (I bet that if install isn’t in your path when you run autogen.sh, that’ll “just work”. But that’s no excuse for gratuitous GNUish chown syntax…)

        — Makefile.orig Wed Dec 17 00:33:54 2008
        +++ Makefile Wed Dec 17 00:34:20 2008
        @@ -84,7 +84,7 @@
        GZIP_ENV = –best
        distuninstallcheck_listfiles = find . -type f -print
        distcleancheck_listfiles = find . -type f -print
        -INSTALL = install -c
        +INSTALL = $(install_sh) -c
        ACLOCAL = aclocal-1.8
        AMDEP_FALSE = #
        AMDEP_TRUE =
        @@ -548,8 +548,8 @@
        # -/usr/sbin/pw groupadd slocate
        -/usr/sbin/groupadd slocate
        $(INSTALL) -d $(DESTDIR)$(datadir)/slocate
        – chown root.slocate $(DESTDIR)$(bindir)/slocate
        – chown root.slocate $(DESTDIR)$(datadir)/slocate
        + chown root:slocate $(DESTDIR)$(bindir)/slocate
        + chown root:slocate $(DESTDIR)$(datadir)/slocate
        chmod 2755 $(DESTDIR)$(bindir)/slocate
        chmod 0750 $(DESTDIR)$(datadir)/slocate
        -ln -f -s $(DESTDIR)$(bindir)/slocate $(DESTDIR)$(bindir)/updatedb

      3. FWIW, slocate is bundled in OpenSolaris 2008.11. I guess the purpose of this post will eventually fade into history.

      1. Pingback: Compiling slocate on Solaris 10 | The Tech Mind

      2. Pingback: Adventures in OpenSolaris « niq’s soapbox

      Leave a Reply

      Fill in your details below or click an icon to log in:

      WordPress.com Logo

      You are commenting using your WordPress.com account. Log Out / Change )

      Twitter picture

      You are commenting using your Twitter account. Log Out / Change )

      Facebook photo

      You are commenting using your Facebook account. Log Out / Change )

      Google+ photo

      You are commenting using your Google+ account. Log Out / Change )

      Connecting to %s

      %d bloggers like this: