Difference between revisions of "FreeBSD10"

From VoIPmonitor.org
Jump to navigation Jump to search
 
(10 intermediate revisions by the same user not shown)
Line 27: Line 27:
 
  /etc/rc.d/ldconfig restart
 
  /etc/rc.d/ldconfig restart
  
Check that json-c.pc is on a right place
+
Check that json-c.pc has been installed on a right place
  pkg-config --variable pc_path pkg-config
+
  pkg-config --variable pc_path pkg-config //this show you where pkg-config search for .pc files
  
My situation solved creating a symlink
+
Bad situation solved creating a symlink
 
  ln -s /usr/local/lib/pkgconfig/json-c.pc /usr/local/libdata/pkgconfig/json-c.pc
 
  ln -s /usr/local/lib/pkgconfig/json-c.pc /usr/local/libdata/pkgconfig/json-c.pc
  
Line 36: Line 36:
 
  pkg-config --libs json-c
 
  pkg-config --libs json-c
  
Download and install voipmonitor
+
Download and configure voipmonitor
 
  cd /usr/src
 
  cd /usr/src
  git clone git://git.code.sf.net/p/voipmonitor/git voipmonitor-git
+
  git clone https://github.com/voipmonitor/sniffer.git
  cd voipmonitor-git
+
  cd sniffer
 
  ./configure
 
  ./configure
 +
 +
Locate ansidecl.h in your environmentand copy it to voipmonitor sources dir
 +
locate ansidecl.h //returned /usr/local/lib/gcc48/gcc/i386-portbld-freebsd10.0/4.8.3/plugin/include/ansidecl.h
 +
cp /usr/local/lib/gcc48/gcc/i386-portbld-freebsd10.0/4.8.3/plugin/include/ansidecl.h ansidecl.h
 +
 +
Modify Makefile and compile voipmonitor
 +
sed -i.orig s/\ json/\ json-c/g Makefile
 +
sed -i.bak 's/.*MYSQLLIB =.*/'MYSQLLIB\ \=\ -L\\/usr\\/local\\/lib\\/mysql\ -lmysqlclient\ -lm'/' Makefile
 +
sed -i.bak2 's/${CXX} $(objects).*'\$'/ld --allow-multiple-definition -Vt -o voipmonitor '\\/'usr'\\/'lib'\\/'crt1.o '\\/'usr'\\/'lib'\\/'crti.o '\\/'usr'\\/'lib'\\/'crtbegin.o ${objects} ${LIBS} ${LIBS_PATH} --as-needed -lgcc_s --no-as-needed '\\/'usr'\\/'lib'\\/'crtend.o '\\/'usr'\\/'lib'\\/'crtn.o /' Makefile
 +
sed -i.bak3 s/\ \-ldl// Makefile
 +
 
  ln -s /usr/bin/c++ /usr/sbin/g++
 
  ln -s /usr/bin/c++ /usr/sbin/g++
gmake //this command halt with complaining about multiple definitions when linking voipmonitor, issue this command:
 
 
  
Manually link objects and libraries (depends on which libraries you have installed and configured voipmonitor with)
+
gmake
  "/usr/bin/ld" --allow-multiple-definition -o voipmonitor /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/local/lib/mysql -L/usr/lib/mysql -L/usr/local/lib/ -L/usr/lib64/mysql -L/usr/lib config_mysql.o regcache.o codec_alaw.o codec_ulaw.o format_slinear.o format_wav.o format_ogg.o calltable.o rtp.o voipmonitor.o sniff.o jitterbuffer/utils.o jitterbuffer/fixedjitterbuf.o jitterbuffer/jitterbuf.o jitterbuffer/abstract_jb.o jitterbuffer/frame.o manager.o tools.o filter_mysql.o hash.o mos_g729.o odbc.o rtcp.o pcap_queue.o sql_db.o md5.o mirrorip.o ipaccount.o skinny.o pstat.o generator.o tcpreassembly.o http.o cleanspool.o fraud.o rrd.o heap_safe.o ssldata.o tar.o tools_dynamic_buffer.o webrtc.o -lpthread -lpcap -lz -lvorbis -lvorbisenc -logg -lodbc -lmysqlclient -lrt -lsnappy -lcurl -lssl -lcrypto -ljson -lssh -lssh_threads -lxml2 -lrrd -llzma -lc++ -lm -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/crtend.o /usr/lib/crtn.o
+
  gmake install
  
 
 
Create voipmonitor startup script
 
Create voipmonitor startup script
  

Latest revision as of 16:36, 21 January 2015

note:tested on 32bit release with voipmonitor 11 sources

Install packages

pkg install libexecinfo libpcap unixODBC mysql56-client libvorbis libogg vorbis-tools gmake subversion wget bash libssh git mysql56-server autotools

Startup mysql

echo mysql_enable=\"YES\" >> /etc/rc.conf
vim /var/db/mysql/my.cnf 
service mysql-server start

Download and install snappy

cd /usr/src
wget --no-check-certificate https://snappy.googlecode.com/files/snappy-1.1.1.tar.gz
tar xzf snappy-1.1.1.tar.gz
cd snappy-1.1.1
./configure
make
make install

Download and install json-c

cd /usr/src
git clone https://github.com/json-c/json-c.git;
cd json-c;
sh autogen.sh;
./configure; make; make install
ln -s /usr/local/lib/libjson-c.so.2.0.0 /usr/lib/libjson.so
/etc/rc.d/ldconfig restart

Check that json-c.pc has been installed on a right place

pkg-config --variable pc_path pkg-config //this show you where pkg-config search for .pc files

Bad situation solved creating a symlink

ln -s /usr/local/lib/pkgconfig/json-c.pc /usr/local/libdata/pkgconfig/json-c.pc

Recheck that pkg_config know about json-c (should return something like '-L/usr/local/lib -ljson-c')

pkg-config --libs json-c

Download and configure voipmonitor

cd /usr/src
git clone https://github.com/voipmonitor/sniffer.git
cd sniffer
./configure

Locate ansidecl.h in your environmentand copy it to voipmonitor sources dir

locate ansidecl.h //returned /usr/local/lib/gcc48/gcc/i386-portbld-freebsd10.0/4.8.3/plugin/include/ansidecl.h
cp /usr/local/lib/gcc48/gcc/i386-portbld-freebsd10.0/4.8.3/plugin/include/ansidecl.h ansidecl.h

Modify Makefile and compile voipmonitor

sed -i.orig s/\ json/\ json-c/g Makefile
sed -i.bak 's/.*MYSQLLIB =.*/'MYSQLLIB\ \=\ -L\\/usr\\/local\\/lib\\/mysql\ -lmysqlclient\ -lm'/' Makefile
sed -i.bak2 's/${CXX} $(objects).*'\$'/ld --allow-multiple-definition -Vt -o voipmonitor '\\/'usr'\\/'lib'\\/'crt1.o '\\/'usr'\\/'lib'\\/'crti.o '\\/'usr'\\/'lib'\\/'crtbegin.o ${objects} ${LIBS} ${LIBS_PATH} --as-needed -lgcc_s --no-as-needed '\\/'usr'\\/'lib'\\/'crtend.o '\\/'usr'\\/'lib'\\/'crtn.o /' Makefile
sed -i.bak3 s/\ \-ldl// Makefile
ln -s /usr/bin/c++ /usr/sbin/g++
gmake
gmake install

Create voipmonitor startup script

echo voipmonitor_enable=\"YES\" >> /etc/rc.conf
vi /usr/local/etc/rc.d/voipmonitor
#!/bin/sh
#
#
# PROVIDE: voipmonitor
# REQUIRE: mysql
# KEYWORD: shutdown
#
. /etc/rc.subr
name=voipmonitor
rcvar=voipmonitor_enable
export PATH=/usr/local/bin:/usr/local/sbin:$PATH
pidfile="/var/run/${name}.pid"
procname="/usr/sbin/voipmonitor"
start_cmd="/usr/sbin/voipmonitor --config-file=/etc/voipmonitor.conf -v1"
load_rc_config $name
run_rc_command "$1"
ldconfig
service voipmonitor start