Wandering Thoughts archives

2006-02-10

The charm of Sun's Freeware collection

Presented on a stock install Solaris 9:

$ cat hello.cpp
#include <iostream.h>

main()
{
    cout << "Hello World!\n";
}
$ g++ hello.cpp
$ ./a.out
ld.so.1: a.out: fatal: libstdc++.so.2.10.0: \
  open failed: No such file or directory
Killed

(Line wrapping added for clarity.)

To get the Sun Freeware g++ working, the magic solution is 'g++ -Wl,-R/opt/sfw/lib ...', which adds /opt/sfw/lib (where the necessary g++ internal library is) to the runtime shared library lookup path.

The irony here is that the Sun Freeware g++ has already been configured to look in /opt/sfw/lib (or it would report a compile time error about not being able to find the library). But nobody went the extra step to add it to the default runtime path, and no one bothered to test the Freeware g++ before they shipped it.

If I have to use g++ on Solaris much, I expect I'll just write a cover script for gcc and g++ that just always adds that argument. (Or replace the g++ version entirely, since it is gcc 2.95.3.)

Update: courtesy of the htdig FAQ, another workaround is to set the LD_RUN_PATH environment variable to /opt/sfw/lib when you compile stuff.

SunFreewareCharm written at 16:03:26; Add Comment

2006-02-07

$PATH in Solaris

It's always the little things about new Unix systems that get to me. Take $PATH on Solaris.

On a modern Linux distribution with a stock install, a sysadmin's full $PATH needs only five directories:

/bin /usr/bin /sbin /usr/sbin /usr/X11R6/bin

(Sometimes /usr/bin/X11 is used instead of /usr/X11R6/bin.)

On Solaris 9, my $PATH is (so far):

/usr/bin /bin /usr/sbin /sbin /usr/ccs/bin /opt/sfw/bin /usr/openwin/bin /usr/sfw/bin

Why are all of these necessary? Well,

  • /usr/ccs/bin is where Solaris hides make (and m4).
  • /usr/openwin/bin is where all the X programs live.
  • /usr/sfw/bin has wget.
  • /opt/sfw/bin has all the useful freeware programs, like rsync, python, lynx, and a diff that understands -u.

If I want to do anything with Sun's dt* tools, I need to add /usr/dt/bin. If I fiddled much with Java, I'd want to add /usr/java/bin.

Personally, I think that this is the sign of immature package management tools in Solaris 9. Not needing a pile of entries in $PATH is much easier for users, and decent package management tools make it no more difficult for the system administrator to manage.

SolarisPATH written at 01:47:15; Add Comment


Page tools: See As Normal.
Search:
Login: Password:
Atom Syndication: Recent Pages, Recent Comments.

This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.