You are on page 1of 4

Aolserver installation with Google Perftools

System:
Red Hat Enterprise Linux ES release 4 (Nahant Update 4)
Dual-Core AMD Opteron(tm) Processor 2210 HE
3 GB memory

Software :
aolserver-4.0.10-src.tar.gz or aolserver-4.5.0-src.tar.gz
Google perftools 0.8
tcl8.4.14-src.tar.gz

Installation :

Google perftools installation :

# mkdir ~/software
# cd ~/software
# wget http://google-perftools.googlecode.com/files/google-perftools-0.8.tar.gz
# tar xzf .tar.gz
# cd google-perftools-0.8
# ./configure --prefix/home/atif/googlelib
# make

it gave an error

src/base/linux_syscall_support.h:339: error: invalid conversion from `long int' to `void*'


make: *** [libtcmalloc_minimal_la-malloc_hook.lo] Error 1

open src/base/linux_syscall_support.h and edit line 338

Change this To this


static inline _syscall6(void*, sys_mmap, static inline _syscall6(long int,
void*, s, sys_mmap, void*, s,
size_t, l, int, size_t, l, int,
p, p,
int, f, int, int, f, int,
d, d,

after that

# make clean
# make
# mkdir /home/atif/googlelib
# make install

I also added in LD_LIBRARY_PATH the location /home/atif/googlelib/lib , in fact i even


added it in /etc/ld.so.conf and ran . make sure you have LD_LBRARY_PATH in your
~/.bash_profile

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/atif/googlelib/lib
# ldconfig

TCL installation:

# mkdir ~/tcl
# cd ~/software
# wget http://surfnet.dl.sourceforge.net/sourceforge/tcl/
# tar xzf tcl8.4.14-src.tar.gz
# cd tcl8.4.14/unix
# ./configure --prefix=/home/atif/tcl --enable-threads

export the tcl library location in your LD_LIBRARY_PATH put this line in bash_profile if
using bash.

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/atif/tcl/lib

We want tcl to use google tcmalloc() for thread allocation so we will enable thread support
but disable thread allocation from tcl. create a simple bash script named disablealloc.sh

cd ./unix && \
cat Makefile | sed -e 's/-DUSE_THREAD_ALLOC=1//' > Makefile.new && \
cat tclConfig.sh | sed -e 's/-DUSE_THREAD_ALLOC=1//' > tclConfig.sh.new&& \
cp Makefile.new Makefile && \
cp tclConfig.sh.new tclConfig.sh

All this does is to change two files and removes -DUSE_THREAD_ALLOC=1 from each
file . Save this script in ~/tcl

#cd /home/atif/tcl
# sh disablealloc.sh

after that

# make
# make install

Aolserver installation :

Aolserver 4.0.10:

# mkdir ~/aol40
# cd ~/software/
# wget http://ovh.dl.sourceforge.net/sourceforge/aolserver/aolserver-4.0.10-src.tar.gz
# tar xzf aolserver-4.0.10-src.tar.gz
# cd aolserver-4.0.10

-- if you are compiling on redhat enterprise 3 on a 64 bit platform like amd opteron change
the nsd/tclobj.c and comment out following lines , line 88
(On redhat enterprise 4 this is not needed)

Change this To this


if (sizeof(int) < sizeof(long)) { /* if (sizeof(int) < sizeof(long)) {
Tcl_Panic("NsTclInitObjs: sizeof(int) < Tcl_Panic("NsTclInitObjs: sizeof(int) <
sizeof(long)"); sizeof(long)");
} }
*/

after that :

# ./configure --prefix=/home/atif/aol40 --with-tcl=/home/atif/tcl/lib --enable-threads --


enable-64bit
# make
# make install

Aolserver 4.5.0 :

# mkdir ~/aol45
# cd ~/software/
# wget http://ovh.dl.sourceforge.net/sourceforge/aolserver/aolserver-4.5.0-src.tar.gz
# tar xzf aolserver-4.5.0-src.tar.gz
# cd aolserver-4.5.0
# ./configure --prefix=/home/atif/aol45 --with-tcl=/home/atif/tcl/lib --enable-threads --
enable-64bit
# /home/atif/tcl/bin/tclsh8.4 ./nsconfig.tcl -install /home/atif/aol45
# make

It should work fine on almost all platforms except redhat enterprise 3 update 4 with 64 bit
linxu x86_64
If you get this error on make

info.c: In function `NsTclInfoObjCmd':


info.c:515: syntax error before "opt"
info.c:522: `opt' undeclared (first use in this function)
info.c:522: (Each undeclared identifier is reported only once
info.c:522: for each function it appears in.)
info.c:571: warning: implicit declaration of function `Tcl_GetMemoryInfo'
info.c: At top level:
info.c:36: warning: `RCSID' defined but not used
gmake[1]: *** [info.o] Error 1
gmake[1]: Leaving directory `/software/nsadmin/aolserver-4.5.0/nsd'
make: *** [build] Error 1

Apply this patch to fix the problem .

Index: include/nsattributes.h
===================================================================
RCS file: /cvsroot/aolserver/aolserver/include/nsattributes.h,v
retrieving revision 1.3
diff -u -r1.3 nsattributes.h
--- include/nsattributes.h 25 Aug 2005 15:46:11 -0000 1.3
+++ include/nsattributes.h 27 Jul 2006 11:48:59 -0000
@@ -38,8 +38,6 @@
#ifndef NSATTRS_H
#define NSATTRS_H

-#ifndef __GNUC__
-
# define _nsmalloc
# define _nspure
# define _nsconst
@@ -56,8 +54,6 @@
# define _nswarnunused
# define _nsmayalias

-#else
-
#ifdef __GNUC_MINOR__
#ifdef __GNUC_PREREQ
#undef __GNUC_PREREQ
@@ -120,8 +116,6 @@

#endif /* __GNUC__PREREQ */

-#endif /* __GNUC__ */
-
#define NS_RCSID(string) static const char *RCSID _nsunused = string \
", compiled: " __DATE__ " " __TIME__

save above text as a file called nsattribute.h.patch and put it on the root of aolserver
source and run this command

# patch -p0 <nsattribute.h.patch

after that

# make clean
# make
# make install

Start Alserver :
To start aolserver in a way that tcl uses tcmalloc() start it like this

cd /home/atif/aol40
LD_PRELOAD=/home/atif/googlelib/lib/libtcmalloc.so ./bin/nsd -t sampleconfig.tcl

or for aolserver 4.5

cd /home/atif/aol45
LD_PRELOAD=/home/atif/googlelib/lib/libtcmalloc.so ./bin/nsd -t sampleconfig.tcl

You might also like