Monday, May 08, 2006

Minding It - Part 2

I am determined to make this work. This meaning Zoneminder (www.zoneminder.com). I had it working, sort of, on my VMWare Server-ed Mandriva 2006. But even though it ran, there were numerous errors about shmget and shared memory. Zoneminder consists of several applications, with some controlling others that do specific tasks and each of them exchanging information. My guess is that some information exchange is happening through shared memory: program A loads up stuff into memory and then passes a pointer to program B that does something to that stuff (although Inter-process communication could be involved too). I can see why the author does it. Multiple instances of program can load the same kind of stuff based on different configurations while program B doesn't care about where the stuff came from... it'll take it and process it. Sorta like program A makes batter and program B cut the batter into square shapes to be made into cookies.
Ok, off the food and onto business. My guess is that I am facing problem with shared memory because I am running it on a VM, VMWare Server Beta to be exact. So the next option would be to run on a real physical memory. (actually, the next option would be to it run on something similar like VMWare Workstation, which I-Will-Do-Soon(R)). After the couple of installs I've done, I think it is safe enough to try it on my main machine at home because I don't use apache or MySQL extensively there and the dependent libraries won't probably mess up my main apps there. I am severely tempted to use an older version of a Zoneminder (zm) rpm to weed out dependencies. This is faster than the 'configure-->find out missing lib file --> find rpm for lib file --> get and install lib file --> configure' treadmill. But I've decided to take the long way just in to find out what libraries are actually needed if I was any other person doing this on any other distribution. Experiencing this as any other guy is important for the overall user experience. I am not even going to install the rpm for the perl serial and x10 stuff which is not even on the usual Mandriva repositories to see whether zm really needs it.
I already know from previous experiences that the latest version 1.22.1 complies fast and less of a hassle from the previous version I was using. Somehow, the mysterious "unable to create executables" error had magically disappeared. And I found the correct manual this time for this version.
Apparently they had already fixed some of my previous rants.
My apologies to developers. No bizarre config program and defaults being set at compile. Thank you.

To cut a long story short, compile went ok and everything went exactly like it did previously.. that is it broke in the same place. Same shared memory problem. A glance through the sources did no good. The forum has someone one with the same problem and it was full of debug messages. Out of desperation, I started trying all sorts of things. Like I always tell people who have problems with computers and don't know what to do: "This is not a nuclear bomb. Push all the buttons." Changing the configuration somehow yielded a better error message. I told it to that the image fed to it were 8-bit grayscale (liar) instead of the other only option 24-bit color. I think the image I was sending was 8/16-bit color. But it had only two options. Now the error message was something like "Image captured was of wrong size, height, width or color". Image captured! It got something. Hey, it may be a Celocanth but it's still a fish. Maybe if I set the camera to 8-bit grayscale, it'll capture it correctly! Great! Problem is.. I can't remember the password for the camera. No time to do a reset and sacrifice a lamb or whatever it is I need to do to reset the password. Got to pay the bills. Later.

Saturday, May 06, 2006

Minding it

I am experimenting with Zoneminder . It looks like a promising digital video recorder (DVR) for closed circuit cameras. My interest is primarily for IP based cameras. In theory, this should be easy. IP based cameras usually have a URL that you could pick up frames or even video streams. So building a DVR software should not be that difficult.
I always start with an RPM because I use Mandriva and this helps keeps updates in check. Also I respect the fact that someone invested time in building a package, so why reinvent the wheel. There were RPMs for Mandriva and tried those. I read the instructions in the manual and strangely enough there were instructions on what to do before installing. Wait a minute, isn't an RPM supposed to handle this. That is one of the points of using an RPM. But the request wasn't demanding, just that apache, mysql and php be installed. So I did that. Installing it using urpmi should have resolved dependancies but I wanted to choose which version to be installed anyway and the GUI tool was better at that. When I finally used urpmi to install it, it complained of some missing perl libraries. Great, I thought, a trek to CSPAN to download the libraries and compile them by hand. I later found out that the libraries were for an optional component and not really necessary. But even after the rpm was installed, the instruction asked me to manually edit a file and run a configuration program.. which was broken. Apparently the package author decided to use MySQL-Max and put in code to detect the version of MySQL that was running. At least he made it easier by clearly marking the offending section in the script file with #FIX ME. Finally, I managed to get the components running and configured the program to capture images from my IP camera.
Or so I thought. I couldn't figure out why my settings would not work when I have read the manuals (two of them) and follows almost every instruction there is. I checked the logs and I found out that the program that was picking up the images was crashing. Apparently it requested memory space incorrectly. Wait a minute, this was serious. This is a beta-level error on a 1.2++ version. Problems with memory allocation should have been delt with a long time ago. This only means one thing.. recompile.
I got the latest STABLE sources and tried to compile it. It got worse. The configure command still required parameters passed in.. for the default web directory and location for mysql? If it can't detect that, what is the program actually doing? The more I fed it CLI parameters, the more it asked. In the end there was about 10 odd CLI parameters. And it still wouldn't compile, complaining about the c compiler unable to create executables! What?!
I little more reading led me to a more stable version, a couple of revisions back. No more c compiler complaints. Now it was the normal missing library files that had to be installed, specifically libjpeg.a (libjpeg), libz.a (zlib-devel) and libmysqlclient.a (libmysql-devel). Configure exited and asked to run a configuration program. Which did a lot of what confgure is supposed to do, esp when it came to component detection. It asked a lot of questions, nearly 30 in all. Most of them should have just been set to default. Too late already. Will compile tommorow.
Lessons Learnt.
  1. Good practise for building packages is to seperate the core and optional components.
  2. When building a package make sure all dependancies are included.
  3. Set up DEFAULTS!!
Oh, I am tired.

Recently Popular