Monkey stumbles upon warpdrive while coding

"I thought it would take 1000 monkeys 1000 years" says ape.

My Photo
Name:
Location: Sydney, New South Wales, Australia

Back from the US, and loving the beaches. Lucky enough to be working in science still.

Tuesday, July 19, 2005

disable touchpad in Gentoo linux

One last thing: I get pissed off this touchpad etc. It goes nuts sometimes,
gets stuck on the side of the screen, clicking everywhere, and it needs a
vigourous swedish massage to get it back to normal - which can't be good for
my laptop. So I wanted to disable my touchpad. Not as easy it as it sounds.
Went into /etc/X11/XF86Config and deleted everything concerning my normal
mouse, and just left the USB in there (ie. deleted mouse0 in the
"ServerLayout"section and the whole Section "InputDevice" section.
Change the USB mouse in "ServerLayout" section to be
InputDevice "USB Mouse" "CorePointer"
instead of SendCoreEvents (which is a slave).
Now the big trick:
cat /dev/input/mice
You'll notice that both the touchpad and USB mouse spew out gibberish for
this. Not cool for excluding only one.
cat /dev/input/mouse0
Only the touchpad has an effect.
cat /dev/input/mouse2
only the USB mouse has an effect: this is the one we want!
Here's the USB section in /etc/X11/XF86Config

Section "Input Device"
Identifier "USB Mouse"
Driver "mouse"
Option "CorePointer"
Option "Device" "/dev/input/mouse2"
Option "Protocol" "IMPS/2"
Option "Emulate3Buttons" "true"
Option "ZAxisMapping" "4 5"
Option "Name" "AutoDetected"
Option "Vendor" "Autodetected"
EndSection

Friday, July 15, 2005

Upgrading to gentoo 2.6

I have a Dell Latitude P-III, with dual boot (ie. windows98 on hda1) run by grub.
I originally installed Gentoo about a year ago because all the guys at VPAC had it and I wanted to be cool too.
Now a year later, and after Steve laughed at me cause my sound still didn't work, I decied to upgrade to Gentoo-2.6.
Of course, like all things gentoo, the process was pretty hands on (But worth it! I know shit now). Without further adeui:

Ok, to update gentoo:

(This probably applies to no-one else in the world:
Also, need to unset http_proxy before emerging stuff
Can do from command line (defined in /etc/profile)
)

This applies from here on:

emerge sync (or emerge --sync - difference??)
Wasn't necessarily using the most recent version of portage, so updated this
automatically

emerge --update portage

Ok, so I couldn't compile ncurses-5.4-r6, there is an internal error in the new version. Can revert to an old one though by putting a line in the file
/etc/portage/package.mask
=sys-libs/ncurses-5.4-r6
This tells portage to ignore version r6, and the put a line in
/etc/portage/package.unmask
which reads
=sys-libs/ncurses-5.4-r4
which seems to work ok.

Seems to be working...

ok, emerged -u portage
Keeps telling me to use newer and newer make.profile files (in /etc)
# rm -f /etc/make.profile
# ln -sf /usr/portage/profiles/default-linux/x86/2005.0 /etc/make.profile
this one is the newer on for gentoo 6, seems to be ok now I updated portage

emerge -u world

Problems with disc space:
can delete stuff in
/var/tmp/portage
after they're installed with no ill effect. Also stuff in
/usr/portage/distfiles
-> this stuff portage will use instead of downloading, but if you're out of discspace it can go.

Bombed when it tried to build libgnomeui. Here is someone else who had the problem, and the solution that worked.

> Hi, all,
>
> I am trying to build Gnome 2.2 on plain redhat 8.0
> from the SRPM's. I have built and installed gtk2-2.2.1.
> When I was build libgnomeui-2.2.0.1, I got err with message
>
> failed to load "./stock_attach.png": Couldn't recognize the image file
> format for file './stock_attach.png'
>
> It turns out that gdk-pixbuf-csource doesn't work on
> any .png file.
>
> /etc/gtk-2.0/gdk-pixbuf.loaders
> is an empty file and
> in directory /usr/lib/gtk-2.0/2.2.0/loaders
> I can see that all the loader libs are installed correctly.
>
> So my question is how to make the correct gdk-pixbuf.loaders
> file for gdk-pixbuf-csource ?
>
> Thanks a lot,
>
> Xiong Jiang
>
> _______________________________________________
> gnome-redhat-list mailing list
> gnome-redhat-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gnome-redhat-list
>

Solution was:

umask 022
/usr/bin/gtk-query-immodules-2.0 > /etc/gtk-2.0/gtk.immodules
/usr/bin/gdk-pixbuf-query-loaders > /etc/gtk-2.0/gdk-pixbuf.loaders

Turns out this last command was dive bombing (ie. seg fault) when it reached the svg*.so loader. This is in
/usr/lib/gtk-2.0/2.4.0/loaders/
So I deleted the loaders that weren't working (svg stuff) - probably will be a problem with icons now, but hey, it compiled.
[Update: icons seems ok so far]

Ok, compiling the kernel.

[1]
First I did this (replace the kernel source simlink)

# rm /usr/src/linux
# cd /usr/src
# ln -s linux-2.6.11-gentoo-r3 linux

But then

# cd /usr/src/linux
# make menuconfig
Didn't work, where it did before (think its cause I haven't compiled that kernel yet...).
So I just copied the old config file:
phobos src # cp linux-2.4.20-gentoo-r6/.config linux/.config
cd linux
make oldconfig
-weird config, lots of questions...
The in /usr/src/linux ran
make && make modules_install

Copy image etc to /boot
cp arch/i386/boot/bzImage /boot/linux-2.6.11-gentoo-r11
cp System.map /boot/System.map-2.6.11-gentoo-r11
cp .config /boot/config-2.6.11-gentoo-r11

This will boot up something, but its crap as the keyboard won't work. Heard on gentoo.org "4. Known pitfalls with Linux 2.6 migration" that if you use an old config file (from 2.4) - people have got probs like "no input from keyboard" - hmm, guess I should have read this first. Sort of annoying though as it just recommends using the "traditional menuconfig method just this once." Duh, you pontificating wanker "make menuconfig" wasn't working in the first place which is why I was using make oldconfig in the first place!!! Ok, calm down.

[2]
Went through the gentoo page, turned all the flags on they said in make menuconfig. Same prob.
Incidentally, in the General Setup --->
--- Support for hot-pluggable devices
- I can't select this as its not a box, its a "---". Why is this so? Continuing undaunted....

[3]
Trying
genkernal --udev --menuconfig --bootloader=grub all
(Goes through menuconfig itself - tried to get it right but no idea. Might be its using the old .config file still - might bomb again...).

No, looks ok! Loads up new gentoo-2.6 kernel.

To get the screen to work I had to do the following:
vi /etc/X11/XF86Config
Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/input/mice"
EndSection
The 2nd last line "/dev/input/mice" used to be "/dev/mouse" which has been superseded. Now X11 works fine! (though I apparently have an old one: I should be editing an xorg.conf file if this was up to date...).

Ok, so eth0 wasn't working. Do this:
ls /lib/modules/`uname -r`/kernel/drivers/net
This has a list. So the one we want is for 3c905C.
To check this run:
lspci
0000:02:00.0 Ethernet controller: 3Com Corporation 3c905C-TX/TX-M [Tornado] (rev 78)
and google the name ie. 3c905c - this needs the 3c59x driver.
>modprobe 3c59x
and this adds the driver.

Need to add the module to startup:
vi /etc/modules.autoload.d/kernel-2.6
and add the line
3c59x

ALSA: this is heavily documented on the web. Make sure you've configured ALSA in the make menuconfig stuff (Device Drivers --> Sound --> Advanced Linux... - modulize everything here). Emerge all the alsa stuff:
emerge alsa-lib alsa-driver alsa-oss alsa-utils mpg321
(last one optional... I didn't emerge it again).
Then run:
alsaconf
this is pretty smart,
rc-update add alsasound boot
voila, sound works!

Ok, for the USB mouse...
This was a little odd, it bombed majorly before, but now it loads up ok (?!) - I didn't change anything from last time?! Did the module loading miracoudly sort itself out? Anyways... What I did:
configure the kernel for USB support: check out http://linux.siprell.com/hardware.htm
[There is some advice in the above page about commenting stuff out of /etc/hotplug/usb.rc and /etc/hotplug/usb.handmap - not sure about this, I haven't done it and things are ok...]
Then go to /etc/X11/XF86Config
Add line up top:
InputDevice "USB Mouse" "SendCoreEvents"
Then add section further down in this file:
Section "Input Device"
Identifier "USB Mouse"
Driver "mouse"
Option "SendCoreEvents" "true"
Option "Device" "/dev/input/mice"
Option "Protocol" "IMPS/2"
Option "Emulate3Buttons" "true"
Option "ZAxisMapping" "4 5"
Option "Name" "AutoDetected"
Option "Vendor" "Autodetected"
EndSection

Why doesn't the desktop picture load automatically??
Hmm... a few tricks here.
First, just delete all the .gconf .gnome* .gtk* .nautilus stuff from your
home. I also moved all the .xsession and .xscreen* etc to temp/. This forces
gnome to loadup all the new defaults instead of using your old. Seemed to be
most of the prob. Also, you can set a default background (eg.) for all users
by running the command:
gconftool-2 --direct --config-source
xml:readwrite:/etc/gconf/gconf.xml.defaults -- type string --set
/desktop/gnome/background/picture_filename filename.png

Ok. This is done. Gentoo upgraded. My sounds works and my USB mouse works. Happy days!

-angrycodemonkey

Friday, February 25, 2005

Dynamical loading libraries problem

So, we're in:
/home/cjoneill/StGermain/StGermain/FE/testApps
And when I compile I get the error (again):
Undefined first referenced
symbol in file
dlsym /home/cjoneill/StGermain/build/lib/libStGermain.a(Plugins.o) (symbol belongs to implicit dependency /usr/lib/libdl.so.1)

There are a few other dl symbols aswell - these control the dynamic loading. The offending library is /home/cjoneill/StGermain/build/lib/libStGermain.a
And the work around is to include more flags in the sun compile:
/home/cjoneill/StGermain/build/lib/libStGermain.a -lm -lnsl -lsocket -lposix4 -ldl
And it builds!
Nb: these go in the configure script as:
EXPORT_DYNAMIC_LFLAGS

Shared libraries on the suns

Ok, so I was compiling shared libraries on the sun using the -share flag:
gcc blahblah -share blah

(Nb: this is in the SO_LFLAGS variable in the StGermain configure script).

And I was getting these :

ld: fatal relocations remain against allocatable but non-writable sections

It turns out the -share flag is actually like using a -G -dys (?sp) -z text flags, and for this I don't think you want the z text stuff.
So, there were 2 options: use -share -mimpure-text which gets sort of leaves off the -z text stuff (as far as I can figure) OR just use -G, which is what I did. (Note -mimpure-text is only a sun option apparently).

Next speedbump:
ld: fatal: Symbol referencing errors.
(in: /home/cjoneill/StGermain/StGermain/FE/testApps)

Solved mpi libraries problem

Ok, so I fixed this.
Problem was linking to mpi libs, ie:
gcc blahblah -L/.../mpich/lib -lmpich
This was all I thought it needed. It came up with the ld problem:
fatal: Symbol referencing error
Undefined first referenced symbol in file
The symbol was sched_yield.

This error generally means that I've created a method for something a .h file, but haven't created a definition for it in a .c file.

Turns out that on the suns sched_yield needs a flag in the gcc command line: -lrt (sometimes this is -lposix4 or something). Sooo, I included this in the library flags so the gcc line looks like this:
gcc blahblah -L/.../mpich/lib -lmpich -lrt
And hey presto. Got past the tests.
Bombed in 'StGermain/Base/src'

Thursday, February 24, 2005

Troubles with mpi libraries

I've run into a tree at testMemory. Its wasn't linking, so I played around with this manually:

gcc -pipe -Wall -g -DDEBUG -O0 -o /home/cjoneill/StGermain/build/tests/testMemory1 /home/cjoneill/StGermain/build/tmp/test-libStGermainBaseFoundation/JournalWrappers.o -I/home/cjoneill/StGermain/build/include -I/home/cjoneill/StGermain/build/include/StGermain -I/opt1/site-sparc-sol8/mpich/include testMemory1.c /home/cjoneill/StGermain/build/lib/libStGermainBaseFoundation.a -L/opt1/site-sparc-sol8/mpich/lib -lmpich -lm

So this looks ok. But I'm getting the:

Undefined first referenced
symbol in file

-this usually means that a symbol is created somewhere (in a .h file) but no definition was made for it (in a .c file). This sounds to me like I haven't included something, but can't imagine what.
Funny thing is, I can compile it mpicc, with the option mpicc -cc=gcc.
(some of the options are a little funky without specifying gcc).
There is only one warning:
gcc: /home/cjoneill/StGermain/build/lib/libStGermainBaseFoundation.a: linker input file unused because linking not done
(why was linking not done? Sounds dodgy). Yet it compiles something that runs.

Ape found lost in jungle of St Germain

Last time I installed StGermain-Snark-Underworld I completely reinstalled my operating system (from redhat to gentoo - since redhat went to the darkside and started charging money).
I also had one Mr Turnbull helping me which made life a whole lot easier.

So now I'm in a foreign country (Texas, USA) on a Sun Solaris system trying to compile the whole she-bang again.

So first: changed everything during configure to GNU: this includes gcc g++ g77 etc etc. The sun compilers suck (at least for this). This also includes using gmake instead of make (sunOS make also sucks - doesn't get past the first line of the make file).

The configure is very hands on - I had to include an extra operating system (SunOS) everywhere. and also for petsc a new system architecture called solaris-2.8 or something.

First big ld problem is a sun thing: concerns the rpath. Now in theory the rpath flags:
'-Xlinker -rpath -Xlinker ${LIB_DIR}
should work, right? Not on solaris! Found this fix on the web:
'-Wl,-rpath, $LIB_DIR}

Next ld problem: linking to the mpi_python libraries. Was about to start headbutting the computer but Pat suggested deleting libpython & mpipython from the def_sub list, ie.
1. Edit the StGermain/compatibility/Makefile.def file
2. remove "libpython mpipython" from the def_sub list.

So this swept that problem under the carpet for now.

Next is where I'm stuck now. MPI LIBRARIES!

Here's the error:

/StGermain/StGermain/Base/Foundation/tests> gmake
/usr/local/bin/gcc -pipe -Wall -g -DDEBUG -O0 -o /home/cjoneill/StGermain/build/tests/testMemory0 /home/cjoneill/StGermain/build/tmp/test-libStGermainBaseFoundation/JournalWrappers.o -I/home/cjoneill/StGermain/build/include -I/home/cjoneill/StGermain/build/include/StGermain -I/opt1/site-sparc-sol8/mpich/include -I/opt/antelope/4.6/include/libxml2 testMemory0.c /home/cjoneill/StGermain/build/lib/libStGermainBaseFoundation.a -L/opt1/site-sparc-sol8/mpich/lib -lmpich -lpmpich -lm -L/opt/antelope/4.6/lib -R/opt/antelope/4.6/lib -lxml2 -L/opt/antelope/4.6/lib -R/opt/antelope/4.6/lib -lz -lpthread -lm -lsocket -lnsl
Undefined first referenced
symbol in file
sched_yield /opt1/site-sparc-sol8/mpich/lib/libmpich.a(p4_tsr.o)
ld: fatal: Symbol referencing errors.

I went into the offending directory so I wouldn't have to compile everything. So: the problem is linking with the libmpich, which is definitely in: /opt1/site-sparc-sol8/mpich.
I tried setting MPI_DIR='/opt1/site-sparc-sol8/mpich' no luck.
I also noticed in many forums that many linux->sun problems are solved by including the flags:
-lsocket -lnsl
manually. But these are already included so it shouldn't be this.
HELP!