Installing AOLServer 4.5.0 + NsMySQL

Some errors that I’ve encountered while installing AOLServer with NsMysql module and our custom build module that uses NsMysql and Bstring libraries.

1. If make install gives you an error like this:

aolserver-4.5.0 # make install
./util/nsmakeall.tcl install nsthread nsd nstclsh
./util/nsmakeall.tcl: line 48: syntax error near unexpected token `}'
./util/nsmakeall.tcl: line 48: `}'
make: *** [install-bins] Error 2

Try running this command:

tclsh8.4 ./nsconfig.tcl -install /usr/local/aolserver

Here, /usr/local/aolserver is the path where you want aolserver installed.

2. When compiling(actually linking) nsmysql and getting error like this:

/usr/bin/tclsh8.4 /usr/local/aolserver/bin/nsremove.tcl
ld -shared -o -L/usr/local/mysql/lib/lib/ -lmysqlclient_r -L`gcc-config -L` -L. -lnsmysql -L/usr/local/aolserver/lib -lnsd -lnsthread -L/usr/lib -ltcl8.4 -ldl -lpthread -lieee -lm -lgcc_s -Wl,-rpath,/usr/local/aolserver/lib:/usr/lib/usr/local/aolserver/lib -Wl,-rpath,/usr/local/aolserver/lib:/usr/lib:/usr/lib
ld: unrecognized option '-Wl,-rpath,/usr/local/aolserver/lib:/usr/lib/usr/local/aolserver/lib'
ld: use the --help option for usage information
make: *** [] Error 1

Try running ld from command line without that -Wl,-rpath options at all. What I did, I just copy-paste ld call and ereased these options. In my example it will be like this:

ld -shared -o -L/usr/local/mysql/lib/lib/ -lmysqlclient_r -L`gcc-config -L` -L. -lnsmysql -L/usr/local/aolserver/lib -lnsd -lnsthread -L/usr/lib -ltcl8.4 -ldl -lpthread -lieee -lm -lgcc_s

(this one uses paths I set in the Makefile, that may be different for your case)

and then I did ‘make install’ and it worked. I know, it maybe a bit dumb, but it worked and I didn’t spend hours reading ld manual and trying to fix it the proper way.

3. Compiling AOLServer on 64bit platform

Putting AOLServer together on x86_64 was giving me bunch of errors like this:

/usr/bin/tclsh ./util/nsmakeall.tcl install nsthread nsd nstclsh
make install: nsthread
gmake[1]: Entering directory `/usr/local/src/aolserver-4.5.0/nsthread'
/usr/bin/tclsh /usr/local/src/aolserver-4.5.0/util/nsremove.tcl
x86_64-pc-linux-gnu-gcc -pipe -shared -Wl,-soname, -o error.o master.o memory.o mutex.o cslock.o rwlock.o reentrant.o sema.o thread.o tls.o compat.o time.o pthread.o fork.o signal.o nsthread_libinit.o \
-L/usr/lib64 -ltcl8.4 -ldl -lpthread -lieee -lm -lgcc_s -Wl,-rpath,:/usr/lib64/usr/local/aolserver/lib -Wl,-rpath,:/usr/lib64/lib
nsthread_libinit.o: In function `_init':
nslibinit.c:(.text+0x0): multiple definition of `_init'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/../../../../lib64/crti.o:(.init+0x0): first defined here
collect2: ld returned 1 exit status
gmake[1]: *** [] Error 1
gmake[1]: Leaving directory `/usr/local/src/aolserver-4.5.0/nsthread'
make: *** [install-bins] Error 1

You got to modify gcc call to be made with -nostartfiles. I changed it directly in include/ns.mak and just rebuild aolserver with make install. Folks from mailing list recommended changing this in configure file:

diff -urNad aolserver4~/configure aolserver4/configure
--- aolserver4~/configure 2007-04-22 19:19:35.000000000 +0200
+++ aolserver4/configure 2007-07-26 16:31:22.000000000 +0200
@@ -2520,11 +2520,7 @@
- case "$LDLIB" in
- *gcc*)
- LDLIB="$LDLIB -nostartfiles"
- ;;
- esac
+ LDLIB="$LDLIB -nostartfiles"
if test "$TCL_EXEC_PREFIX" != "$prefix"

Either way, this has solved the issue.