Zoneminder won't compile on Gentoo

Forum for questions and support relating to the 1.25.x releases only.
Locked
kbaegis0
Posts: 7
Joined: Fri Mar 23, 2012 5:04 pm

Zoneminder won't compile on Gentoo

Post by kbaegis0 »

Zoneminder was taken out of the portage tree as it is no longer maintained. Relevant output:
make[2]: Entering directory `/source/zoneminder/svn/src'
g++ -DHAVE_CONFIG_H -I. -I.. -I/usr/include -I/usr/include -Wall -Wno-sign-compare -fno-inline -I/usr/include -g -O2 -MT zmc.o -MD -MP -MF .deps/zmc.Tpo -c -o zmc.o zmc.cpp
In file included from zm_stream.h:27:0,
from zm_event.h:39,
from zm_zone.h:27,
from zm_monitor.h:26,
from zmc.cpp:28:
zm_mpeg.h:43:7: error: use of enum ‘PixelFormat’ without previous declaration
zm_mpeg.h:44:2: error: ‘AVOutputFormat’ does not name a type
zm_mpeg.h:45:2: error: ‘AVFormatContext’ does not name a type
zm_mpeg.h:46:2: error: ‘AVStream’ does not name a type
zm_mpeg.h:47:2: error: ‘AVFrame’ does not name a type
zm_mpeg.h:48:2: error: ‘AVFrame’ does not name a type
make[2]: *** [zmc.o] Error 1
make[2]: Leaving directory `/source/zoneminder/svn/src'
make[1]: *** [all-recursive] Error 1
Configure was run with the following arguments:
./configure --with-webdir=/var/www/localhost/htdocs/zm --with-cgidir=/var/www/localhost/cgi-bin ZM_DB_USER=*** ZM_DB_PASS=*** LDFLAGS=-s CPPFLAGS=-I/usr/local/include --no-create --no-recursion
checking libavutil/avutil.h usability... no
checking libavutil/avutil.h presence... yes
configure: WARNING: libavutil/avutil.h: present but cannot be compiled
configure: WARNING: libavutil/avutil.h: check for missing prerequisite headers?
configure: WARNING: libavutil/avutil.h: see the Autoconf documentation
configure: WARNING: libavutil/avutil.h: section "Present But Cannot Be Compiled"
configure: WARNING: libavutil/avutil.h: proceeding with the compiler's result
configure: WARNING: ## ------------------------------------------------------------------------- ##
configure: WARNING: ## Report this to http://www.zoneminder.com/forums/ - Please check FAQ first ##
configure: WARNING: ## ------------------------------------------------------------------------- ##
checking for libavutil/avutil.h... no
checking for libavutil/avutil.h... no
checking libavcodec/avcodec.h usability... no
checking libavcodec/avcodec.h presence... yes
configure: WARNING: libavcodec/avcodec.h: present but cannot be compiled
configure: WARNING: libavcodec/avcodec.h: check for missing prerequisite headers?
configure: WARNING: libavcodec/avcodec.h: see the Autoconf documentation
configure: WARNING: libavcodec/avcodec.h: section "Present But Cannot Be Compiled"
configure: WARNING: libavcodec/avcodec.h: proceeding with the compiler's result
configure: WARNING: ## ------------------------------------------------------------------------- ##
configure: WARNING: ## Report this to http://www.zoneminder.com/forums/ - Please check FAQ first ##
configure: WARNING: ## ------------------------------------------------------------------------- ##
checking for libavcodec/avcodec.h... no
checking libavformat/avformat.h usability... no
checking libavformat/avformat.h presence... yes
configure: WARNING: libavformat/avformat.h: present but cannot be compiled
configure: WARNING: libavformat/avformat.h: check for missing prerequisite headers?
configure: WARNING: libavformat/avformat.h: see the Autoconf documentation
configure: WARNING: libavformat/avformat.h: section "Present But Cannot Be Compiled"
configure: WARNING: libavformat/avformat.h: proceeding with the compiler's result
configure: WARNING: ## ------------------------------------------------------------------------- ##
configure: WARNING: ## Report this to http://www.zoneminder.com/forums/ - Please check FAQ first ##
configure: WARNING: ## ------------------------------------------------------------------------- ##
checking for libavformat/avformat.h... no
checking libswscale/swscale.h usability... no
checking libswscale/swscale.h presence... yes
configure: WARNING: libswscale/swscale.h: present but cannot be compiled
configure: WARNING: libswscale/swscale.h: check for missing prerequisite headers?
configure: WARNING: libswscale/swscale.h: see the Autoconf documentation
configure: WARNING: libswscale/swscale.h: section "Present But Cannot Be Compiled"
configure: WARNING: libswscale/swscale.h: proceeding with the compiler's result
configure: WARNING: ## ------------------------------------------------------------------------- ##
configure: WARNING: ## Report this to http://www.zoneminder.com/forums/ - Please check FAQ first ##
configure: WARNING: ## ------------------------------------------------------------------------- ##
checking for libswscale/swscale.h... no
While this is svn commit 3648 from svn.zoneminder (dot) com/svn/zm/trunk (last updated several months ago), I also tried compiling the 1.25.0 tarball.

gcc (Gentoo 4.5.3-r2 p1.1, pie-0.4.7) 4.5.3
autoconf (GNU Autoconf) 2.68
automake (GNU automake) 1.11.3
m4 (GNU M4) 1.4.16
Linux 3.3.0-v.17:2-3-2012-04074-g5375871 SMP (x86_64)
ffmpeg version 0.10.2
libavcodec.so.53.61.100
libavutil.so.51.35.100
libavformat.so.53.32.100
libswscale.so.2.1.100
kbaegis0
Posts: 7
Joined: Fri Mar 23, 2012 5:04 pm

Re: Zoneminder won't compile on Gentoo

Post by kbaegis0 »

bump
christophe_y2k
Posts: 102
Joined: Mon Oct 12, 2009 8:47 am
Location: EUROPE-FRANCE-MANDELIEU

Re: Zoneminder won't compile on Gentoo

Post by christophe_y2k »

Hello, this is my method to compile Latest SVN ZoneMinder V1.25.0 on Linux Gentoo 64 :
Updated 15 AOUT 2012.

If you don't have SVN tool install this
# emerge SVN-Mirror

For download the latest svn source code of ZM:

Code: Select all

# rm -R /usr/share/zoneminder
# svn co http://svn.zoneminder.com/svn/zm/trunk /usr/share/zoneminder
ZM need some software must be instelled before compilling

Code: Select all

# emerge www-servers/apache
# emerge dev-db/mysql
# emerge dev-lang/php
# emerge dev-lang/perl

# emerge app-admin/sudo
# emerge media-video/ffmpeg
# emerge dev-libs/libpcre
# emerge virtual/jpeg
# emerge net-libs/gnutls
# emerge virtual/perl-Archive-Tar
# emerge dev-perl/Archive-Zip
# emerge dev-perl/DateManip
# emerge dev-perl/DBD-mysql
# emerge dev-perl/DBI
# emerge dev-perl/Device-SerialPort
# emerge dev-perl/libwww-perl
# emerge dev-perl/MIME-Lite
# emerge dev-perl/MIME-tools
# emerge dev-perl/PHP-Serialization
# emerge virtual/perl-Getopt-Long
# emerge virtual/perl-libnet
# emerge virtual/perl-Module-Load
# emerge virtual/perl-Sys-Syslog
# emerge virtual/perl-Time-HiRes
# emerge media-libs/netpbm
# emerge dev-libs/boost
# emerge dev-libs/pcre++
# emerge dev-perl/Expect
# emerge dev-perl/Archive-Zip
# emerge perl-core/Time-HiRes
# emerge media-libs/netpbm

# emerge dev-perl/net-sftp

# revdep-rebuild
and if you upgrade perl you must start
# perl-cleaner reallyall

You need to configure your database with mysql:

Code: Select all

# mysql --user=root -p 
Enter password: xxxx

# mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| test               |
| zm                 |
+--------------------+
4 rows in set (0.00 sec)

#mysql> drop database zm;
Query OK, 16 rows affected (0.01 sec)

# mysql> create database zm;
Query OK, 1 row affected (0.00 sec)
# quit;
Bye
# mysql --user=root -p zm < /usr/share/zoneminder/db/zm_create.sql
# mysql --user=root -p zm

# mysql> grant select,insert,update,delete,create on zm.* to 'your_zm_user'@localhost identified by 'your_zm_password';
Query OK, 0 rows affected (0.00 sec)
# mysql> quit;
Bye
# mysqladmin --user=root -p reload
You need startup service for auto run ZoneMinder at boot

# nano -w /etc/init.d/zoneminder

Code: Select all

#!/sbin/runscript
# ----------------------------------------------------------------------
# File:    /etc/init.d/zoneminder
# Purpose:  Startup the Zoneminder Server
# By:   Danky
# Date: 8-31-2010
# Upgrated By Christophe DAPREMONT (christophe_y2k@yahoo.fr) for zm >= V1.25.0 BUILD 3579 SVN on gentoo linux
# Date: 31 December 2011 Happy New Year
# Updated 15 Aout 2012
# ----------------------------------------------------------------------
depend()	{ 
		use mysql apache2
}
prog=ZoneMinder
ZM_PATH_BIN="/usr/bin"
command="$ZM_PATH_BIN/zmpkg.pl"
ZM_TMP1='mkdir /tmp/zm'
ZM_TMP2='chown -R apache:apache /tmp/zm'
ZM_RUN1='mkdir /var/run/zm'
ZM_RUN2='chown -R apache:apache /var/run/zm'
ZM_RM_TMP='rm -R /tmp/zm'
ZM_RM_RUN='rm -R /var/run/zm'

start() {
        ebegin "Create /tmp/zm directory"
        $ZM_TMP1
	eend $? "Failed to create /tmp/zm directory ! (probably already exist)"
	ebegin "chown -R apache:apache /tmp/zm"
        $ZM_TMP2
	eend $? "Failed chown command !"
	
	ebegin "Create /var/run/zm directory"
        $ZM_RUN1
	eend $? "Failed to create /var/run/zm directory ! (probably already exist)"
	ebegin "chown -R apache:apache /var/run/zm"
        $ZM_RUN2
	eend $? "Failed chown command !"
        ebegin "Starting Zoneminder"
        $command start
        eend $? "Failed to start $prog"
}

stop() {
        ebegin "Stopping $prog"
        $command stop
        eend $? "Failed to stop $prog"
        ebegin "Remove /var/run/zm directory"
        $ZM_RM_RUN
	eend $? "Failed to remove /var/run/zm directory !"
	ebegin "Remove /tmp/zm directory"
        $ZM_RM_TMP
	eend $? "Failed to remove /tmp/zm directory !"
}
status()	{
		result=`$command status`
		if [ "$result" = "running" ]; then
		 echo "ZoneMinder is running"
		 RETVAL=0 
		else
		 echo "ZoneMinder is stopped"
		 RETVAL=1
		fi
		exit ${RETVAL}
}
# chmod +x /etc/init.d/zoneminder

You need apache configuration file:

# nano -w /etc/apache2/vhosts.d/10_zoneminder.conf

Code: Select all

ScriptAlias /var/www/zoneminder/cgi-bin/zms "/var/www/zoneminder/cgi-bin/zms"
ScriptAlias /var/www/zoneminder/cgi-bin/nph-zms "/var/www/zoneminder/cgi-bin/nph-zms"

<Directory "/var/www/zoneminder/cgi-bin">
  AllowOverride All
  Options ExecCGI
  Order allow,deny
  Allow from all
</Directory> 

Alias /zoneminder "/var/www/zoneminder/htdocs"

<Directory "/var/www/zoneminder/htdocs">
  Options -Indexes MultiViews FollowSymLinks
  AllowOverride All
  Order allow,deny
  Allow from all
</Directory> 
# rc-update add zoneminder default

and now compilation of ZM:

Code: Select all

# cd /usr/share/zoneminder

# ./configure --prefix=/usr --with-webhost=zoneminder --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --libdir=/usr/lib64 --with-libarch=lib64 --with-mysql=/usr --with-ffmpeg=/usr --with-webdir=/var/www/zoneminder/htdocs --with-cgidir=/var/www/zoneminder/cgi-bin --with-webuser=apache --with-webgroup=apache --enable-debug=no --enable-crashtrace=no --enable-mmap=no ZM_DB_HOST=localhost ZM_DB_NAME=zm ZM_DB_USER=your_zm_user ZM_DB_PASS=your_zm_password CXXFLAGS=-D__STDC_CONSTANT_MACROS

# make
# make install
# make clean
# cd ..
# zmupdate.pl
# zmupdate.pl -f
Now you can start ZoneMinder:

# /etc/init.d/zoneminder start
Go to webpage http://localhost/zoneminder
and configure your zoneminder

------------------------------
CONFIGURATION of STREAMING
IN "OPTIONS" --> "PATHS"

PATH_ZMS --> Web path to zms streaming server (?) --> /zoneminder/cgi-bin/nph-zms
-------------------------------------------------------------------------------------------
For move the events directory to another destination (on big raid5 hdd) :
My system is compiled on 120Go SSD for faster result, and ZoneMinder data are stocked on 2.8To RAID5...
/video is my 2.8To formatted with ext4, RAID5 4x1To HDD array (software raid with mdadm)

# mkdir /video/zoneminder
# mkdir /video/zoneminder/htdocs
# mkdir /video/zoneminder/htdocs/events
# chown -R apache:apache /video/zoneminder
# mv /var/www/zoneminder/htdocs/events /video/zoneminder/htdocs/events
# chown -R apache:apache /video/zoneminder

# ln -s /video/zoneminder/htdocs/events /var/www/zoneminder/htdocs/events
Last edited by christophe_y2k on Wed Aug 15, 2012 11:26 am, edited 4 times in total.
kbaegis0
Posts: 7
Joined: Fri Mar 23, 2012 5:04 pm

Re: Zoneminder won't compile on Gentoo

Post by kbaegis0 »

Many thanks!
Locked