FreeBSD port for 1.23.3

If you've made a patch to quick fix a bug or to add a new feature not yet in the main tree then post it here so others can try it out.
Post Reply
achix
Posts: 146
Joined: Tue Oct 02, 2007 9:38 am
Location: Greece

FreeBSD port for 1.23.3

Post by achix »

This is the latest 1.23.3 zoneminder port for FreeBSD 7.0
This port is a continuation of the work of Richard Lee (freebsd-guy) on the 1.22.3 zoneminder port.
This port's patches were created from scratch, but some patches are directly from 1.22.3
Some patches are simply in order to make the compilation succeed.

The pkg-plist is apparently incomplete.
If someone wants he/she may update this file.

The port has been tested with local FreeBSD cameras.
The card tested is a Kodicom 4400 with the relevant patch for 7.0 by Mark Tinguely (tinguely@casselton.net):
http://www.casselton.net/~tinguely/kodicom.patch
However the same FreeBSD local camera code used to work for 1.22.3 with
the single chip Bt878 LML card (LMLBT4x), and it is very likely that it will
continue to do so in 1.23.3
The FreeBSD local camera code comes directly from "official" 1.22.3 with my
(then) patch applied.
This patch was created for 1.22.3 and had to do with working (time division multiplexing) with >=2 cameras on the LMLBT4x.

Be sure to install php5 with apache module support. Also make sure you install
the mysql php extention as well.

I had issues with nph-zms so i changed to zms.

You may also follow the instructions in files/README.FreeBSD.old as a general guide.

You may find the port at http://matrix.gatewaynet.com/panix/zoneminder.tar.gz
untar it under /usr/ports/multimedia and run
make install


Achilleas Mantzios
achill@matrix.gatewaynet.com
Last edited by achix on Tue Jul 15, 2008 1:41 pm, edited 1 time in total.
achix
Posts: 146
Joined: Tue Oct 02, 2007 9:38 am
Location: Greece

bktr cards

Post by achix »

Regarding bt 878 (now conexant) based cards:
- they are very likely to work in FreeBSD
- If they work with xawtv then they will most probably work with zoneminder as well.
achix
Posts: 146
Joined: Tue Oct 02, 2007 9:38 am
Location: Greece

ip cameras

Post by achix »

With IP cameras, you are free to try it!
coke
Posts: 518
Joined: Wed Jan 30, 2008 5:53 pm
Location: St. Louis, MO, USA

Post by coke »

Has anyone done any benchmarking on distros? It feels like freebsd/netbsd are so lightweight by default that if ZoneMinder worked on them, it would work faster than on something heavier, such as Ubuntu.
achix
Posts: 146
Joined: Tue Oct 02, 2007 9:38 am
Location: Greece

Post by achix »

Well it is a long discussion with no real definite answer.
Both systems are good unix or unix-like systems that can outperform many
commercial OSes out there.
Performance wise, i bet any hacker from any of the two camps can make his OS
run faster under some conditions.

It is a matter of preference than anything else.

However i have two more patches that solve the Load: bug in (Load:/Disk:),
and the Signal Lost bug in FreeBSD.

If anyone is interested i will publish the new patchset.
achix
Posts: 146
Joined: Tue Oct 02, 2007 9:38 am
Location: Greece

Update

Post by achix »

After a week or so, both the kodicom 4400 card and the single chip LMLBT4x,
card work very good.
The kodicom clone, bought from ebay for 40 euro is a very cheap yet good card with 4
conexant bt878 chips on board. Currently i have 5 cameras capturing on 25 fps each.

Be sure with the kodicom, to provide sufficient airflow inside the motherboard.
Fitting it on the last PCI slot is a good idea.

Also, the following patches have been added to the port:
- The Load on the top right corner is displayed correctly
- The Signal is detected correctly when lost or regained
- The timestamp label format contains an extra % before the %N, making the default look like
%%N - %Y/%m/%d %H:%M:%S, because strftime in FreeBSD needs two '%' in order to
produce one.
Novice
Posts: 11
Joined: Sat Jul 26, 2008 1:10 am

Post by Novice »

Hello,

I'm trying to get this to compile on a FreeBSD 7.0, i386 (and 6.3, amd64, but getting same results)

After extracting into /usr/ports/multimedia, I do the following

bsd7# make
===> Vulnerability check disabled, database not found
===> Extracting for zoneminder-1.23.3,1
=> MD5 Checksum OK for ZoneMinder-1.23.3.tar.gz.
=> SHA256 Checksum OK for ZoneMinder-1.23.3.tar.gz.
===> zoneminder-1.23.3,1 depends on file: /usr/local/bin/perl5.8.8 - found
===> Patching for zoneminder-1.23.3,1
===> zoneminder-1.23.3,1 depends on file: /usr/local/bin/perl5.8.8 - found
===> Applying FreeBSD patches for zoneminder-1.23.3,1
File to patch:

I have messed around deleting various items in files/ and was able to make make continue, but I don't believe this is correct as I get configure errors similar to just downloading the zoneminder source and building. Any suggestions? Thanks.
achix
Posts: 146
Joined: Tue Oct 02, 2007 9:38 am
Location: Greece

Corrected

Post by achix »

The problem was a minor patch to zm_create.sql, whereas it should refer to zm_create.sql.in. You could just remove this patch and then examine it to see what
it was trying to do.
Anyway, i uploaded the corrected port.
You can download it and try again!

Sorry, i guess i did some late night changes without trying it from scratch.
Now it should be ok.

Do you intend to run zoneminder it with IP cameras?
Novice
Posts: 11
Joined: Sat Jul 26, 2008 1:10 am

Post by Novice »

Thanks for the reply! I've started fresh with the new port you've uploaded, my only intention at the moment is to use IP cameras (axis 206's to be exact) Is it possible in your testing environment you're using a different gcc?

bsd7# make
===> Vulnerability check disabled, database not found
===> Extracting for zoneminder-1.23.3,1
=> MD5 Checksum OK for ZoneMinder-1.23.3.tar.gz.
=> SHA256 Checksum OK for ZoneMinder-1.23.3.tar.gz.
===> zoneminder-1.23.3,1 depends on file: /usr/local/bin/perl5.8.8 - found
===> Patching for zoneminder-1.23.3,1
===> zoneminder-1.23.3,1 depends on file: /usr/local/bin/perl5.8.8 - found
===> Applying FreeBSD patches for zoneminder-1.23.3,1
===> zoneminder-1.23.3,1 depends on file: /usr/local/bin/mysqld_safe - found
===> zoneminder-1.23.3,1 depends on file: /usr/local/bin/php-config - found
===> zoneminder-1.23.3,1 depends on file: /usr/local/lib/perl5/site_perl/5.8.8 /mach/DBI.pm - found
===> zoneminder-1.23.3,1 depends on file: /usr/local/lib/perl5/site_perl/5.8.8 /mach/DBD/mysql.pm - found
===> zoneminder-1.23.3,1 depends on file: /usr/local/lib/perl5/site_perl/5.8.8 /Date/Manip.pm - found
===> zoneminder-1.23.3,1 depends on file: /usr/local/lib/perl5/site_perl/5.8.8 /LWP.pm - found
===> zoneminder-1.23.3,1 depends on file: /usr/local/lib/perl5/site_perl/5.8.8 /Archive/Zip.pm - found
===> zoneminder-1.23.3,1 depends on file: /usr/local/lib/perl5/site_perl/5.8.8 /Archive/Tar.pm - found
===> zoneminder-1.23.3,1 depends on file: /usr/local/lib/perl5/site_perl/5.8.8 /MIME/Lite.pm - found
===> zoneminder-1.23.3,1 depends on file: /usr/local/lib/perl5/site_perl/5.8.8 /MIME/Entity.pm - found
===> zoneminder-1.23.3,1 depends on file: /usr/local/lib/perl5/site_perl/5.8.8 /PHP/Serialization.pm - found
===> zoneminder-1.23.3,1 depends on file: /usr/local/bin/perl5.8.8 - found
===> zoneminder-1.23.3,1 depends on shared library: jpeg.9 - found
===> zoneminder-1.23.3,1 depends on shared library: netpbm.1 - found
===> zoneminder-1.23.3,1 depends on shared library: pcre.0 - found
===> zoneminder-1.23.3,1 depends on shared library: avutil.1 - found
===> Configuring for zoneminder-1.23.3,1
configure: WARNING: you should use --build, --host, --target
checking for a BSD-compatible install... /usr/bin/install -c -o root -g wheel
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/local/bin/gmkdir -p
checking for gawk... no
checking for mawk... no
checking for nawk... nawk
checking whether make sets $(MAKE)... yes
test: localhost: unexpected operator
test: zm: unexpected operator
test: zmuser: unexpected operator
test: zmpass: unexpected operator
test: unexpected operator
configure: WARNING: You can call configure with the --with-libarch option.
This tells configure where to find architecture specific libraries.
The default of 'lib' is usually ok but 64 bit machines may require lib64.
e.g. --with-libarch=lib or --with-libarch=lib64
checking for i386-portbld-freebsd7.0-gcc... gcc34
checking for C compiler default output file name...
configure: error: C compiler cannot create executables
See `config.log' for more details.
===> Script "configure" failed unexpectedly.
Please report the problem to asdfasdf@matrix.gatewaynet.com [maintainer] and
attach the "/usr/ports/multimedia/zoneminder/work/ZoneMinder-1.23.3/config.log"
including the output of the failure of your make command. Also, it might be
a good idea to provide an overview of all packages installed on your system
(e.g. an `ls /var/db/pkg`).
*** Error code 1

Stop in /usr/ports/multimedia/zoneminder.
bsd7#

Not sure what's going on here, as other ports compile just fine.


GCC Version:
bsd7# gcc --version
gcc (GCC) 4.2.1 20070719 [FreeBSD]
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


System:
bsd7# uname -a
FreeBSD bsd7 7.0-RELEASE FreeBSD 7.0-RELEASE #0: Sun Feb 24 19:59:52 UTC 2008 root@logan.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386

Output from config.log
http://zoneminder.pastebin.com/f1b9c1ac3
Novice
Posts: 11
Joined: Sat Jul 26, 2008 1:10 am

Post by Novice »

After one more cup of coffee it became obvious (should of been if I was drunk) what the issue was. An ln -s /usr/bin/gcc /usr/bin/gcc34 fixed the problem, now to fix the Makefile so such a hack is not needed, I'm a n00b so you'll probably know exactly what to do, but i'll try anyway. Thanks.


EDIT:

In the Makefile

--CC=gcc34
++CC=gcc

--CPP=g++34
++CPP=g++

Although I didn't change the CPP variable, as it never seemed to call it. Thanks for all your work on this port.
achix
Posts: 146
Joined: Tue Oct 02, 2007 9:38 am
Location: Greece

gcc

Post by achix »

Thanx,
gcc34 in the Makefile was a leftover from the initial attempts to compile/run the software,
which i forgot to remove. In a moment of despair i thought that some linuxes run
older versions of gcc, so i tried gcc34 to see if that fixed my problems
which didnt change anything, i went on with the port forgetting
to remove the gcc34 lines from Makefile.
Anyway, the port is updated.
If you have any success/issues with the axis cameras, drop a line :D
Novice
Posts: 11
Joined: Sat Jul 26, 2008 1:10 am

Post by Novice »

They actually seem to be working well, although I don't know much about zoneminder to begin with, but the images are showing up (I'm accessing the cameras over a slow VPN, so I believe I have some usual quirkiness that I also had with a ubuntu setup) I had to mess with sysctl variables to get them to work.

From the README.FreeBSD.old

Code: Select all

* options SHMMAXPGS 
This is now SHMALL (as of 6x I believe) which can be set with

sysctl kern.ipc.shmall="$NEWNUMBER" ( I used 134217728)

Code: Select all

* options SHMMNI=384
* options SHMSEG=256


These 2 are still valid, and can be dynamically set with

kern.ipc.shmmni="384"
kern.ipc.shmseg="256"

These tunables may also be put in /boot/loader.conf
achix
Posts: 146
Joined: Tue Oct 02, 2007 9:38 am
Location: Greece

sysctl

Post by achix »

Great news, about the Axis camera!

About IPC,
SHMALL is not SHMMAXPGS,
copying/pasting directly from /usr/src/sys/conf/NOTES,
the default values are:

Code: Select all

# Maximum number of shared memory pages system wide.
options         SHMALL=1025
# Maximum size, in bytes, of a single System V shared memory region.
options         SHMMAX=(SHMMAXPGS*PAGE_SIZE+1)
options         SHMMAXPGS=1025
Just to recap:
SHMALL is Maximum number of shared memory pages system wide.
SHMMAXPGS is Maximum size, in pages, of a single System V shared memory region.
SHMMAX is Maximum size, in bytes, of a single System V shared memory region.
SHMMIN is Minimum size, in bytes, of a single System V shared memory region.
SHMMNI is Maximum number of shared memory regions that can be used on the system at one time.
SHMSEG is Maximum number of System V shared memory regions that can be attached to a single process at one time.

PAGE_SIZE by default = 4k.

You can put your IPC related variables in /etc/sysctl.conf.
With 1GB of main memory, mine are:
kern.ipc.shmmax=536870912
kern.ipc.shm_use_phys=1
kern.ipc.shmall=524288

ipcs command shows IPC related info (mem, semaphores, etc..)

Note that changing IPC kernel tunables must be done having in mind
that it might affect other programs which use IPC, like PostgreSQL.
So the settings must satisfy the requirements of all programs using IPC.
Novice
Posts: 11
Joined: Sat Jul 26, 2008 1:10 am

Post by Novice »

Thanks for clearing that up :)

I think this depend should be added to the make file,

${LOCALBASE}/bin/gnutls-cli:${PORTSDIR}/security/gnutls:install \

I'm trying to get this going on FreeBSD 6.3 amd64 and am running into this:

In file included from zmc.cpp:26:
zm_signal.h:24:22: execinfo.h: No such file or directory
In file included from jinclude.h:20,
from zm_jpeg.h:22,
from zm_image.h:33,
from zm_monitor.h:26,
from zmc.cpp:27:
/usr/local/include/jconfig.h:12:1: warning: "HAVE_STDLIB_H" redefined
In file included from zm_config.h:20,
from zm.h:28,
from zmc.cpp:24:
../config.h:74:1: warning: this is the location of the previous definition
In file included from /usr/local/include/ffmpeg/avformat.h:32,
from zm_mpeg.h:29,
from zm_stream.h:27,
from zm_event.h:36,
from zm_zone.h:27,
from zm_monitor.h:27,
from zmc.cpp:27:
/usr/local/include/ffmpeg/avcodec.h:2248: warning: `ImgReSampleContext' is deprecated (declared at /usr/local/include/ffmpeg/avcodec.h:2242)
/usr/local/include/ffmpeg/avcodec.h:2258: warning: `ImgReSampleContext' is deprecated (declared at /usr/local/include/ffmpeg/avcodec.h:2242)
*** Error code 1

Stop in /usr/ports/multimedia/zoneminder/work/ZoneMinder-1.23.3/src.
*** Error code 1

Stop in /usr/ports/multimedia/zoneminder/work/ZoneMinder-1.23.3.
*** Error code 1

Stop in /usr/ports/multimedia/zoneminder/work/ZoneMinder-1.23.3.
*** Error code 1

Stop in /usr/ports/multimedia/zoneminder.


Any ideas?


EDIT:

I am doing this in a jail, and apparently in a basic jail install /usr/local/include/execinfo.h does not get copied into the jail, placing the file here took care of the issue.
achix
Posts: 146
Joined: Tue Oct 02, 2007 9:38 am
Location: Greece

Post by achix »

I dont have a 6.3 system handy, but can you please repeat the build with this Makefile:

Code: Select all

# New ports collection makefile for:   zoneminder
# Date created:        2008-07-14
# Whom:                Achilleas Mantzios (assisted by port 1.22.3 by Richard Lee (based on Electric Messiah's original))
#
# $FreeBSD$
#

PORTNAME=	zoneminder
PORTVERSION=	1.23.3
PORTEPOCH=	1
CATEGORIES=	multimedia
MASTER_SITES=	http://www2.zoneminder.com/downloads/
DISTNAME=	ZoneMinder-${PORTVERSION}

MAINTAINER=	achill@matrix.gatewaynet.com
COMMENT=	Complete security camera solution, fully web based with image analysis

RUN_DEPENDS=	${SITE_PERL}/${PERL_ARCH}/Apache.pm:${PORTSDIR}/www/mod_perl:install \
		${LOCALBASE}/bin/sudo:${PORTSDIR}/security/sudo:install
LIB_DEPENDS=	jpeg.9:${PORTSDIR}/graphics/jpeg:install \
		netpbm.1:${PORTSDIR}/graphics/netpbm:install \
		pcre.0:${PORTSDIR}/devel/pcre:install \
		avutil.1:${PORTSDIR}/multimedia/ffmpeg:install
BUILD_DEPENDS=	${LOCALBASE}/bin/mysqld_safe:${PORTSDIR}/databases/mysql50-server:install \
		${LOCALBASE}/bin/php-config:${PORTSDIR}/lang/php5-extensions:install \
		${SITE_PERL}/${PERL_ARCH}/DBI.pm:${PORTSDIR}/databases/p5-DBI:install \
		${SITE_PERL}/${PERL_ARCH}/DBD/mysql.pm:${PORTSDIR}/databases/p5-DBD-mysql50:install \
		${SITE_PERL}/Date/Manip.pm:${PORTSDIR}/devel/p5-Date-Manip:install \
		${SITE_PERL}/LWP.pm:${PORTSDIR}/www/p5-libwww:install \
		${SITE_PERL}/Archive/Zip.pm:${PORTSDIR}/archivers/p5-Archive-Zip:install \
		${SITE_PERL}/Archive/Tar.pm:${PORTSDIR}/archivers/p5-Archive-Tar:install \
		${SITE_PERL}/MIME/Lite.pm:${PORTSDIR}/mail/p5-MIME-Lite:install \
		${SITE_PERL}/MIME/Entity.pm:${PORTSDIR}/mail/p5-MIME-Tools:install \
		${SITE_PERL}/PHP/Serialization.pm:${PORTSDIR}/devel/p5-PHP-Serialization:install \
		${LOCALBASE}/include/execinfo.h:${PORTSDIR}/devel/libexecinfo:install

MANCOMPRESSED=	yes
GNU_CONFIGURE=	yes
USE_PHP=	yes
USE_PERL5=	yes

WEBBASE=	${LOCALBASE}/www

CONFIGURE_ARGS=	--with-mysql=${LOCALBASE} \
		--with-webdir=${WEBBASE}/data/zm \
		--with-cgidir=${WEBBASE}/cgi-bin \
		--with-webgroup=www \
		--with-webuser=www \
		--enable-crashtrace=no \
		--with-ffmpeg=${LOCALBASE} \
		--with-extralibs=-lpthread \
		--enable-debug=yes
CONFIGURE_ENV=	LDFLAGS="-L${LOCALBASE}/lib" \
		CFLAGS="-I${LOCALBASE}/include" \
		CPPFLAGS="-I${LOCALBASE}/include" \
		ZM_DB_HOST="localhost" \
		ZM_DB_NAME="zm" \
		ZM_DB_USER="zmuser" \
		ZM_DB_PASS="zmpass"
MAKE_ENV=${CONFIGURE_ENV}
CFLAGS=-I${LOCALBASE}/include/
CXXFLAGS=${CFLAGS}
CPPFLAGS=${CFLAGS}

PLIST_SUB=	WEBBASE=${WEBBASE}
USE_RC_SUBR=	zm.sh

pre-build:
	${CP} ${FILESDIR}/videodev.h ${WRKSRC}/src
	${CP} ${FILESDIR}/zm_fbsd_camera.cpp ${WRKSRC}/src
	${CP} ${FILESDIR}/zm_fbsd_camera.h ${WRKSRC}/src

post-install:
.if !defined(NOPORTDOCS)
	${MKDIR} ${DOCSDIR}
	${INSTALL_MAN} ${FILESDIR}/README.FreeBSD ${DOCSDIR}
	${INSTALL_MAN} ${FILESDIR}/README.FreeBSD.old ${DOCSDIR}
	${INSTALL_MAN} ${WRKSRC}/AUTHORS       ${DOCSDIR}
	${INSTALL_MAN} ${WRKSRC}/COPYING       ${DOCSDIR}
	${INSTALL_MAN} ${WRKSRC}/ChangeLog     ${DOCSDIR}
	${INSTALL_MAN} ${WRKSRC}/INSTALL       ${DOCSDIR}
	${INSTALL_MAN} ${WRKSRC}/NEWS          ${DOCSDIR}
	${INSTALL_MAN} ${WRKSRC}/README        ${DOCSDIR}
	${INSTALL_MAN} ${WRKSRC}/TODO          ${DOCSDIR}
.endif
	${CAT} ${FILESDIR}/README.FreeBSD ${FILESDIR}/README.FreeBSD.old
.include <bsd.port.mk>
As of 7.0 /usr/local/include/execinfo.h belongs to devel/libexecinfo, so i added that.
Please verify for 6.3
Post Reply