Zoneminder Surveillance on Mac OS X Server 10.6.5 - all prerequisites completed - stuck at make

Mike Thostenson mike at prowessnetworks.com
Sat Dec 4 15:05:37 PST 2010


I have contributed a few different HOWTOs to the Zoneminder project including CentOS, Ubuntu, and even Yellow Dog Linux build procedures to run Zoneminder on a Playstation 3.

My new goal is to work with others to create a successful build of the Zoneminder Surveillance software for Mac Mini Servers.

There have been several people that have successfully ported Zoneminder to FreeBSD 7.x and 8.x so I am confident this can be done on Mac OS X.

Here is my thread at zoneminder.com:
http://www.zoneminder.com/forums/viewtopic.php?t=16801

Here is how to setup a Mac Mini Server with all of the prerequisites:

Mac Mini Server 10.6.5 Zoneminder HOWTO

Note: This Zoneminder build is for IP based cameras only. So far it is NOT designed for capture cards or USB video devices.

Note: by default apple does not let you boot into the 64 bit kernel using the late 2009 mac mini server 3,1 so this will be a 32bit build

1. Install Mac OS X Server but do not install any services, we will add these after we perform all of the updates to snow leopard server. Run Apple Icon Software Update and reboot -- Software Update again until there are no more updates available.

2. ADD REQUIRED SERVICES
Open the Server Admin
In the lower left click on the plus symbol then add service. The following is a list of services that you will want checked:
AFP
DNS
MySQL
Web

Click on MySQL then Start
Click on Web then Start

3. Next enable the necessary apache php modules by going into the server admin, web on the left, settings at the top, then modules. Enable the php5_module. Stop then start web services.

4. mkdir /Library/WebServer/Documents/zm

5. Go to http://developer.apple.com/ register as a developer and login to the developer site.

6. Download and install xcode322_2148_developerdvd.dmg from http://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wa/downloads (Developer Tools on the right menu)

7. For this how to we will be permanently logging in with escalated privileges. This isn't really the preferred method due to security concerns but it will keep the documentation a little less cluttered. Normally you would type sudo before every command that needs escalated privileges.

8. Open terminal and type sudo -i then enter. You are now logged in with escalated privileges.
sudo -i

9. For this how to we will work out of the standard privileged root user's home directory of /var/root. To get to this directory quickly just type cd then enter.
cd /var/root

10. CREATE A BUILD DIRECTORY
mkdir /var/root/builds

11. CHANGE TO THE BUILD DIRECTORY
cd /var/root/builds

12. GRAB MYSQL SOURCE FROM APPLE AND INSTALL
visit http://www.opensource.apple.com/source/MySQL/MySQL-54/
download mysql-5.0.91-apple.tar.gz
drop mysql-5.0.91-apple.tar.gz into your /var/root/builds directory
tar -xzvf mysql-5.0.91-apple.tar.gz
./configure
make
cd include include
cp *.h /usr/include

CHANGE TO THE BUILD DIRECTORY
cd /var/root/builds

13. INSTALL REQUIRED PERL MODULES
perl -MCPAN -e 'shell' (just answer yes to any questions it will ask you several times)
install YAML
install DBI
fforce install DBD::mysql (we have to force here…no worries though I know why)
install Date::Manip
install PHP::Serialization
install Sys::Mmap

14. COMPILE & INSTALL LAME:
GRAB A SNAPSHOT OF LAME SOURCE:
cvs -d:pserver:anonymous at lame.cvs.sourceforge.net:/cvsroot/lame login (then enter for password)
cvs -z3 -d:pserver:anonymous at lame.cvs.sourceforge.net:/cvsroot/lame co -P lame
cd lame
./configure
make
make install

CHANGE BACK TO YOUR BUILD DIRECTORY:
cd /var/root/builds

15. COMPILE & INSTALL wget
curl -O http://ftp.gnu.org/gnu/wget/wget-1.12.tar.gz
tar -xzvf wget-1.12.tar.gz
cd wget-1.12
./configure
make
make install

CHANGE TO THE BUILD DIRECTORY
cd /var/root/builds

16. COMPILE & INSTALL FAAD2
wget http://downloads.sourceforge.net/faac/faad2-2.7.tar.gz
tar -xzvf faad2-2.7.tar.gz
cd faad2-2.7
./configure
make
make install

CHANGE BACK TO YOUR BUILD DIRECTORY:
cd /var/root/builds

17. COMPILE & INSTALL FAAC
wget http://downloads.sourceforge.net/faac/faac-1.28.tar.gz
tar -xzvf faac-1.28.tar.gz
cd faac-1.28/
./configure
make
make install

CHANGE BACK TO YOUR BUILD DIRECTORY:
cd /var/root/builds

18. INSTALL git
visit http://code.google.com/p/git-osx-installer/
download and install git-1.7.3.2-intel-leopard.dmg
cd /usr/bin/
ln -s /usr/local/git/bin/git git

CHANGE BACK TO YOUR BUILD DIRECTORY:
cd /var/root/builds

19. COMPILE & INSTALL yasm
wget http://www.tortall.net/projects/yasm/releases/yasm-1.1.0.tar.gz
tar -xzvf yasm-1.1.0.tar.gz
cd yasm-1.1.0
./configure
make
make install

CHANGE BACK TO YOUR BUILD DIRECTORY:
cd /var/root/builds

20. GRAB LIBJPEG SOURCE AND INSTALL
wget http://www.ijg.org/files/jpegsrc.v8b.tar.gz
tar -xzvf jpegsrc.v8b.tar.gz
cd jpeg-8b
./configure
make
make install

CHANGE BACK TO YOUR BUILD DIRECTORY:
cd /var/root/builds

21. COMPILE & INSTALL x264
/usr/local/git/bin/git clone git://git.videolan.org/x264.git
cd x264
CPPFLAGS="-D__STDC_CONSTANT_MACROS" ./configure --enable-shared
In config.mak, I moved -fPIC to the front.
eg.: 'CFLAGS=-Wshadow -O3 -ffast-math -Wall -I. -std=gnu99 -I/usr/local/include -fPIC -s -fomit-frame-pointer -fno-tree-vectorize'
became: 'CFLAGS=-fPIC -Wshadow -O3 -ffast-math -Wall -I. -std=gnu99 -I/usr/local/include -s -fomit-frame-pointer -fno-tree-vectorize'.
make
make install

CHANGE BACK TO YOUR BUILD DIRECTORY:
cd /var/root/builds

22. GRAB A SNAPSHOT OF FFMPEG SOURCE:
chmod 755 /usr/bin/pod2man ( or ffmpeg make will fail)
svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
cd ffmpeg
CPPFLAGS="-D__STDC_CONSTANT_MACROS" ./configure --enable-gpl --enable-libx264 --enable-shared --enable-pthreads
make
make install

CHANGE BACK TO YOUR BUILD DIRECTORY:
cd /var/root/builds

23. WORKAROUND FOR V4L COMPATIBILITY
mkdir /usr/include/linux
wget http://src.gnu-darwin.org/ports/multimedia/v4l_compat/files/videodev.h
cp videodev.h /usr/include/linux

CHANGE BACK TO YOUR BUILD DIRECTORY:
cd /var/root/builds

28. COMPILE AND INSTALL Zoneminder:
mkdir /var/root/builds/mysqllibs
cd /var/root/builds/mysql-5.0.91/libmysql/
cd /var/root/builds/mysqllibs
cp -R * /usr/lib
cd /var/root/builds/mysql-5.0.91
cp -R include/ /usr/include/mysql
cd /var/root/builds

DOWNLOAD AND UNPACK FREEBSD 8.0 SUPPLIED PATCH FILES
wget http://white-raven.pisem.net/zoneminder/zoneminder-1.24.2_2-freebsd-8.0.tar.gz
tar -xzvf zoneminder-1.24.2_2-freebsd-8.0.tar.gz
mv zoneminder bsd-zm-patches

CHANGE BACK TO YOUR BUILD DIRECTORY:
cd /var/root/builds

wget http://www2.zoneminder.com/downloads/ZoneMinder-1.24.2.tar.gz
tar -xzvf ZoneMinder-1.24.2.tar.gz
cd ZoneMinder-1.24.2
patch -p0 < ../bsd-zm-patches/files/patch-Makefile.am
patch -p0 < ../bsd-zm-patches/files/patch-Memory.pm
patch -p0 < ../bsd-zm-patches/files/patch-Memory.pm.in
patch -p0 < ../bsd-zm-patches/files/patch-configure.ac
patch -p0 < ../bsd-zm-patches/files/patch-functions.php
patch -p0 < ../bsd-zm-patches/files/patch-zm_create.sql.in
patch -p0 < ../bsd-zm-patches/files/patch-zm_debug.c
patch -p0 < ../bsd-zm-patches/files/patch-zm_event.cpp
patch -p0 < ../bsd-zm-patches/files/patch-zm_ffmpeg_camera.cpp
patch -p0 < ../bsd-zm-patches/files/patch-zm_image.cpp
patch -p0 < ../bsd-zm-patches/files/patch-zm_image.h
patch -p0 < ../bsd-zm-patches/files/patch-zm_jpeg.c
patch -p0 < ../bsd-zm-patches/files/patch-zm_jpeg.h
patch -p0 < ../bsd-zm-patches/files/patch-zm_local_camera.h
patch -p0 < ../bsd-zm-patches/files/patch-zm_monitor.cpp
patch -p0 < ../bsd-zm-patches/files/patch-zm_mpeg.cpp
patch -p0 < ../bsd-zm-patches/files/patch-zm_remote_camera.h
patch -p0 < ../bsd-zm-patches/files/patch-zm_remote_camera_http.cpp
patch -p0 < ../bsd-zm-patches/files/patch-zm_rtp_source.cpp
patch -p0 < ../bsd-zm-patches/files/patch-zm_signal.h
patch -p0 < ../bsd-zm-patches/files/patch-zm_stream.cpp
patch -p0 < ../bsd-zm-patches/files/patch-zm_time.h
patch -p0 < ../bsd-zm-patches/files/patch-zmaudit.pl
patch -p0 < ../bsd-zm-patches/files/patch-zmc.cpp
patch -p0 < ../bsd-zm-patches/files/patch-zmcomms.cpp
patch -p0 < ../bsd-zm-patches/files/patch-zmcomms.h
patch -p0 < ../bsd-zm-patches/files/patch-zmcontrol.pl
patch -p0 < ../bsd-zm-patches/files/patch-zmdc.pl
patch -p0 < ../bsd-zm-patches/files/patch-zmfilter.pl
patch -p0 < ../bsd-zm-patches/files/patch-zmpkg.pl
patch -p0 < ../bsd-zm-patches/files/patch-zmpkg.pl.in
patch -p0 < ../bsd-zm-patches/files/patch-zmtrack.pl
patch -p0 < ../bsd-zm-patches/files/patch-zmtrigger.pl
patch -p0 < ../bsd-zm-patches/files/patch-zmu.cpp
patch -p0 < ../bsd-zm-patches/files/patch-zmu2.cpp
patch -p0 < ../bsd-zm-patches/files/patch-zmwatch.pl
patch -p0 < ../bsd-zm-patches/files/patch-zmx10.pl

cp -i ../bsd-zm-patches/files/videodev.h src/
cp -i ../bsd-zm-patches/files/zm.sh.in src/
cp -i ../bsd-zm-patches/files/zm_fbsd_camera.cpp src/
cp -i ../bsd-zm-patches/files/zm_fbsd_camera.h src/

CPPFLAGS="-D__STDC_CONSTANT_MACROS" ./configure --with-webdir=/Library/WebServer/Documents/zm --with-cgidir=/Library/WebServer/CGI-Executables ZM_DB_HOST=localhost ZM_DB_NAME=zm ZM_DB_USER=zmuser ZM_DB_PASS=zmpass --enable-debug=yes --with-webgroup=_www --with-webuser=_www --with-mysql=/usr/local ZM_SSL_LIB=openssl --enable-shared

vi src/zm_signal.h (change ucontext.h to sys/ucontext.h)
vi src/zm_signal.cpp (change ucontext.h to sys/ucontext.h)

make

THIS IS THE ERROR THAT I AM WORKING ON ---GETTING CLOSER TO A MAC BUILD!

if g++ -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -I/usr/include -Wall -Wno-sign-compare -fno-inline -I/usr/include -D__STDC_CONSTANT_MACROS -frepo -D__STDC_CONSTANT_MACROS -MT zm_signal.o -MD -MP -MF ".deps/zm_signal.Tpo" -c -o zm_signal.o zm_signal.cpp; \
then mv -f ".deps/zm_signal.Tpo" ".deps/zm_signal.Po"; else rm -f ".deps/zm_signal.Tpo"; exit 1; fi
<command-line>: warning: "__STDC_CONSTANT_MACROS" redefined
<command-line>: warning: this is the location of the previous definition
zm_signal.cpp: In function ‘void zm_die_handler(int, siginfo_t*, void*)’:
zm_signal.cpp:98: error: request for member ‘gregs’ in ‘uc->__darwin_ucontext::uc_mcontext’, which is of non-class type ‘__darwin_mcontext64*’
zm_signal.cpp:98: error: ‘REG_EIP’ was not declared in this scope
zm_signal.cpp:102: error: request for member ‘gregs’ in ‘uc->__darwin_ucontext::uc_mcontext’, which is of non-class type ‘__darwin_mcontext64*’
zm_signal.cpp:102: error: ‘REG_EIP’ was not declared in this scope
zm_signal.cpp:112: warning: format not a string literal and no format arguments
zm_signal.cpp:126: warning: format not a string literal and no format arguments
make[2]: *** [zm_signal.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2


If I use --disable-crashtrace in the configure statement I do not see the other issue listed in the previous post but now I get this:
if g++ -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -I/usr/include -Wall -Wno-sign-compare -fno-inline -I/usr/include -D__STDC_CONSTANT_MACROS -frepo -D__STDC_CONSTANT_MACROS -MT zm_thread.o -MD -MP -MF ".deps/zm_thread.Tpo" -c -o zm_thread.o zm_thread.cpp; \
then mv -f ".deps/zm_thread.Tpo" ".deps/zm_thread.Po"; else rm -f ".deps/zm_thread.Tpo"; exit 1; fi
<command-line>: warning: "__STDC_CONSTANT_MACROS" redefined
<command-line>: warning: this is the location of the previous definition
zm_thread.cpp: In member function ‘void Mutex::lock(int)’:
zm_thread.cpp:78: error: ‘pthread_mutex_timedlock’ was not declared in this scope
zm_thread.cpp: In member function ‘void Mutex::lock(double)’:
zm_thread.cpp:85: error: ‘pthread_mutex_timedlock’ was not declared in this scope
make[2]: *** [zm_thread.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Any help would be appreciated. Thanks!



More information about the macports-dev mailing list