This portion of the manual will cover advanced topics, such as compiling and debugging the GNU Gatekeeper.
The following instructions are an example of how to compile GnuGk from source on an Ubuntu platform.
First make sure your system is up-to-date and install the tools needed for the compile
sudo apt-get update sudo apt-get install flex bison build-essential subversion cvs pkg-config automake linuxdoc-toolsAlso make sure the "...-devel" packages for all databases or LDAP servers you want to use are installed.
NOTE: As of 2016-5-11, it's recommended that you do not use PTLib SVN; it is undergoing many changes that are incompatible with GnuGk. Use the patched version PTLib 2.10.9.
Get and compile PTLib from SourceForge:
cd ~ wget http://sourceforge.net/projects/openh323gk/files/ptlib-2.10.9-gnugk-patch2.tar.gz cd ptlib-v2.10.9-gnugk export PTLIBDIR=~/ptlib-v2.10.9-gnugk ./configure --enable-ipv6 --disable-odbc --disable-sdl --disable-lua --disable-expat make optnoshared
Get and compile H323Plus:
cd ~ cvs -d:pserver:anonymous@h323plus.cvs.sourceforge.net:/cvsroot/h323plus login (just press enter when prompted for password) cvs -z3 -d:pserver:anonymous@h323plus.cvs.sourceforge.net:/cvsroot/h323plus co -P h323plus cd h323plus export OPENH323DIR=~/h323plus ./configure --enable-h235 -enable-h46017 --enable-h46026 make optnoshared
Get and compile GnuGk:
cd ~ cvs -d:pserver:anonymous@openh323gk.cvs.sourceforge.net:/cvsroot/openh323gk login (just press enter when prompted for password) cvs -z3 -d:pserver:anonymous@openh323gk.cvs.sourceforge.net:/cvsroot/openh323gk co -P openh323gk cd openh323gk ./configure --enable-h46018 make optnoshared
Once the compile is finished, the binary can be found in the obj_linux_x86_s subdirectory.
At this time, because all libraries and GnuGk are running CVS and SVN versions of the software, in order to stay up-to-date, run the following:
cd ~/ptlib svn update cd ~/h323plus cvs update cd ~/openh323gk cvs updateIf any of the source files are changed, you have to recompile.
If GnuGk doesn't handle calls like you expect, you can enable tracing to see what GnuGk does internally. This should not be confused with connection to the status port and looking at the events ("telnet 127.0.0.1 7000"). Creating a trace file will reveal a lot more of the internal workings.
On the command line, start GnuGk with -ttttt and -o to write the trace to a file:
gnugk -c gnugk.ini -ttttt -o trace.log
If you have a lot of calls, trace.log can grow quite large, so make sure you disable it after you are done with testing, or at least reduce the trace level to 2 or 3 for production.
You can also enable tracing in your config file:
[Gatekeeper::Main] TraceLevel=5 [LogFile] Filename=trace.log
Or you can enable tracing through the status port:
setlog trace.log debug trc 5
Doing it through the status port has the advantage that you won't interrupt ongoing calls and you can quickly turn it on or off.
The trace file will contain information detailing everything GnuGk does. To reduce it to a single call, you can search for the callID or write a small Perl script to extract only those messages you are interested in.
In order to use gdb with GnuGk, the software and libraries must be compiled with debug support.
You may follow the instructions above in obtaining the software, but the compile in each subdirectory must be:
make debugnoshared
Allow unlimited core dumps:
ulimit -c unlimited
Run GnuGk:
~/openh323/obj_linux_x86_64_d_s/gnugk -c your.ini
Then wait for the crash and run GDB to get a stack backtrace:
gdb obj_linux_x86_64_d_s/gnugk core bt
Once you've obtained a backtrace, post it to the mailing list.
Note: On some systems, the core dump is named "core.xxx" where xxx is the process number of the GnuGk process that crashed.