A blog about my experiences with bioinformatics, operating systems, and random other technologies and bits.

Saturday, June 30, 2007

The "simple" way to do things.

Who wants to make play lists or keep an alarm clock when you have your laptop with you 23/24 hours each day?

Say I want to find all the songs with bach or mozart in the title and loop through them. This (somewhat long) one-liner will do the trick:

echo `find ./ -name '*[B|b]ach*' -o -name '*[M|m]ozart*' | xargs -I song echo "'song'"` | xargs mplayer -loop 0

(substitute mplayer with your favorite command line music player) There is probably a shorter way of accomplishing the same thing. If you find such a way, please post it!

Setting an alarm is much simpler. If you want to get up in 8 hours,

bash-3.00$ bc
bash-3.00$ sleep 28800 && mplayer Shared/George\ Michael\ wham\ -\ wake_me_up_before_you_go_go.mp4

If you have a more regular sleep schedule (but then, why would you be reading this?) you may find setting up a cron job to play a song more useful.

Tuesday, June 19, 2007

Useful Solaris tips for Linux Users

Since I'm coming from Linux, I thought it would be useful to start a long entry about Solaris tips for Linux users. I'll update this entry with new tips as I find them.

ldconfig and ld.so.conf solaris equivalents (taken from the blog of Chris Miles):

If you're a Linux admin on Solaris and are looking for the Solaris equivalent of ldconfig and /etc/ld.so.conf read on.

The command you are looking for is crle(1) - this is the equivalent of Linux's ldconfig but even more powerful. Read the man pages to crle for all the details. But here's a quick howto - how to add /usr/local/lib to the default ls.so.1 path. Run crle with no arguments to see the default paths.
mad[~] crle

Default configuration file (/var/ld/ld.config) not found
Default Library Path (ELF): /lib:/usr/lib (system default)
Trusted Directories (ELF): /lib/secure:/usr/lib/secure (system default)
Use crle -u -l /usr/local/lib to add /usr/local/lib to the default ld.so.1 path.
mad[~] sudo crle -u -l /usr/local/lib
mad[~] crle

Configuration file [version 4]: /var/ld/ld.config
Default Library Path (ELF): /lib:/usr/lib:/usr/local/lib
Trusted Directories (ELF): /lib/secure:/usr/lib/secure (system default)

Command line:
crle -c /var/ld/ld.config -l /lib:/usr/lib:/usr/local/lib
And that's it really. The configuration is stored in /var/ld/ld.config but crle should always be used to manipulate it. Hope that is useful.

prstat can be used instead of top, and is supposedly more robust.

Monday, June 18, 2007

Building GCC on Solaris

Update: On OpenSolaris 2008.11 I used the following (after having intalled gcc packages from blastwave):

../gcc-4.3.2/configure --with-gnu-as --with-as=/usr/sfw/bin/gas --without-gnu-ld --with-ld=/usr/ccs/bin/ld --enable-shared --enable-languages=c,c++,objc,fortran --with-mpfr=/opt/csw --with-gmp=/opt/csw --with-libiconv-prefix=/opt/csw --prefix=/usr/local && gmake -j4

I got a new laptop (my old one was 2 1/2 years old, huge, and prone to overheating - but other than that still not a bad machine). The new laptop is a Dell Inspiron E1505N, shipped with Ubuntu. I removed Ubuntu immediately as my experiences have never been good with it. Vista was installed and removed the next day as well. I'm now happily running (for the most part) Windows XP 64 edition and Solaris Developer edition on the machine. Perhaps a full review of Solaris will be in order later, but for now, I wanted to show how to build GCC 4.2.0 on Solaris.

It is rather simple once you know the tricks.... I leave it to the reader to deduce why all this works, as much of it was just trial and error. Note: I never got gcj to work and I didn't bother with ada. There were several bugs in boehm-gc with which I ran out of patience. Please let me know if you have better success =) I'm new to Solaris still; I've primarily been a user of Linux for the past few years.

Here is the path that was used to build GCC:
bash-3.00$ echo $PATH

export LD_LIBRARY_PATH=/opt/csw/lib
(make sure you have mpfr and gmp installed - I installed the packages from blastwave)

And the command to build:
../gcc-4.2.0/configure --with-as=/opt/csw/bin/gas --with-gnu-as --with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-threads=posix --enable-multilib --enable-nls --with-included-gettext --with-system-zlib --with-mpfr=/opt/csw --with-gmp=/opt/csw --enable-languages=c,c++,objc,fortran --enable-shared --with-libiconv-prefix=/opt/csw && gmake -j 4

The result:

bash-3.00$ gcc -v
Reading specs from /opt/csw/gcc4/lib/gcc/i386-pc-solaris2.8/4.0.2/specs
Target: i386-pc-solaris2.8
Configured with: ../sources/gcc-4.0.2/configure --prefix=/opt/csw/gcc4 --with-local-prefix=/opt/csw --with-gnu-as --with-as=/opt/csw/bin/gas --without-gnu-ld --with-ld=/usr/ccs/bin/ld --enable-threads=posix --enable-shared --enable-multilib --enable-nls --with-included-gettext --with-libiconv-prefix=/opt/csw --with-x --enable-java-awt=xlib --with-system-zlib --enable-languages=c,c++,f95,java,objc,ada
Thread model: posix
gcc version 4.0.2