I was given a task to prepare 64-bit version of Apache 1.3 branch to run on AIX 5.3 test server. I've downloaded the source package and searched for some how to as this was my first time of compiling Apache in 64-bit. The first information i found advised me to use the variables 'CCFLAGS=-maix64' and 'LDFLAGS=-maix64' but after running ./configure i got to first barrier:
======== Error Output for sanity check ========
cd ..; gcc -DAIX=530 -U__STR__ -DAIX_BIND_PROCESSOR -DUSE_HSREGEX -DUSE_EXPAT -I./lib/expat-lite -DNO_DL_NEEDED -maix64 `./apaci` -lm -lpthread -maix64 -o helpers/dummy helpers/dummy.c
collect2: library libm not found
make: The error code from the last command is 1.
I was missing the libm library obviously:
# lslpp -l bos.adt.libm
lslpp: 0504-132 Fileset bos.adt.libm not installed.
The next step was to find it somewhere. Again after some searching i finally found out that it's not distributed as separate fileset but bos.adt.libm is included in the bos.adt package which can be found on the first AIX installation CD.
# lslpp -L bos.adt.libm
Fileset Level State Type Description (Uninstaller)
----------------------------------------------------------------------------
bos.adt.libm 5.3.0.60 C F Base Application Development
Math Library
Configure ran clean, next barrier arised when i issued make command:
# make
===> src
===> src/regex
sh ./mkh -i _REGEX_H_ regex2.h regcomp.c regerror.c regexec.c regfree.c > ../include/hsregex.h
gcc -I. -I../os/unix -I../include -DAIX=530 -U__STR__ -DAIX_BIND_PROCESSOR -DUSE_HSREGEX -DUSE_EXPAT -I../lib/expat-lite -DNO_DL_NEEDED -maix64 `../apaci` -DPOSIX_MISTAKE -c regcomp.c
gcc -I. -I../os/unix -I../include -DAIX=530 -U__STR__ -DAIX_BIND_PROCESSOR -DUSE_HSREGEX -DUSE_EXPAT -I../lib/expat-lite -DNO_DL_NEEDED -maix64 `../apaci` -DPOSIX_MISTAKE -c regexec.c
gcc -I. -I../os/unix -I../include -DAIX=530 -U__STR__ -DAIX_BIND_PROCESSOR -DUSE_HSREGEX -DUSE_EXPAT -I../lib/expat-lite -DNO_DL_NEEDED -maix64 `../apaci` -DPOSIX_MISTAKE -c regerror.c
gcc -I. -I../os/unix -I../include -DAIX=530 -U__STR__ -DAIX_BIND_PROCESSOR -DUSE_HSREGEX -DUSE_EXPAT -I../lib/expat-lite -DNO_DL_NEEDED -maix64 `../apaci` -DPOSIX_MISTAKE -c regfree.c
rm -f libregex.a
ar cr libregex.a regcomp.o regexec.o regerror.o regfree.o
ar: 0707-126 regcomp.o is not valid with the current object file mode.
Use the -X option to specify the desired object mode.
ar: 0707-126 regexec.o is not valid with the current object file mode.
Use the -X option to specify the desired object mode.
ar: 0707-126 regerror.o is not valid with the current object file mode.
Use the -X option to specify the desired object mode.
ar: 0707-126 regfree.o is not valid with the current object file mode.
Use the -X option to specify the desired object mode.
make: 1254-004 The error code from the last command is 4.
Stop.
make: 1254-004 The error code from the last command is 1.
Stop.
make: 1254-004 The error code from the last command is 2.
Stop.
make: 1254-004 The error code from the last command is 2.
Stop.
After some searching i have found that this problem can be solved by passing the -maix64 parameter directly to gcc in CC variable:
CC="/usr/bin/gcc -maix64"
But it didn't help. The final step that helped me was following setting of variables (i've unset CFLAGS and LDFLAGS just to be sure):
# export OBJECT_MODE=64
# export CC="/usr/bin/gcc -maix64"
# echo $OBJECT_MODE
64
# echo $CC
/usr/bin/gcc -maix64
The make and make install now passed without problem. And now we're getting to the core and finally to the problem mentioned in our headline. After running /usr/local/apache/bin/apachectl start i got the error.
# /usr/local/apache/bin/apachectl start
httpd: bad user name nobody
/usr/local/apache/bin/apachectl start: httpd could not be started
I've checked the httpd.conf but User nobody and Group nobody directives were uncommented so they should be effective. After checking /etc/passwd and /etc/group i found that user nobody and the group nobody existed. In the next step i tried to create user 'webservd' and group with the same name, changed the directives in httpd.conf and tried to run directly httpd with the -f option specifying the path to the config file.
# file /usr/local/apache/bin/httpd
/usr/local/apache/bin/httpd: 64-bit XCOFF executable or object module
# /usr/local/apache/bin/httpd -f /usr/local/apache/conf/httpd.conf
httpd: bad user name nobody
After that i've tried to create symlink in /etc/apache just to be sure it will find the httpd.conf even in some case of non-standard behaviour but no luck. Output of 'truss /usr/local/apache/bin/httpd -f /usr/local/apache/conf/httpd.conf' showed that no config file is even tried to be loaded which was strange. The final solution that helped was changing the UID and GID numbers for user nobody as AIX uses really non-standard value compared to other OS.
# id nobody
uid=4294967294(nobody) gid=4294967294(nobody)
# lsgroup nobody
nobody id=4294967294 admin=false users=nobody,lpd registry=files
# chgroup
Usage: chgroup [-R load_module] "attr=value" ... group
# chgroup id=65534 nobody
3004-719 Warning: /usr/bin/chgroup does not update /etc/passwd with the new gid.
# id nobody
uid=65534(nobody) gid=65534(nobody)
Please note that i had to edit the /etc/passwd file manually with the new values. After that... tradaaa! Apache finally started with correct user:
# /usr/local/apache/bin/apachectl start
/usr/local/apache/bin/apachectl start: httpd started
# ps -ef | grep htt
webservd 237718 332014 0 15:13:41 – 0:00 /usr/local/apache/bin/httpd
webservd 254028 332014 0 15:13:41 – 0:00 /usr/local/apache/bin/httpd
root 303350 250066 0 15:13:50 pts/0 0:00 grep htt
webservd 311458 332014 0 15:13:41 – 0:00 /usr/local/apache/bin/httpd
webservd 319734 332014 0 15:13:41 – 0:00 /usr/local/apache/bin/httpd
webservd 323838 332014 0 15:13:41 – 0:00 /usr/local/apache/bin/httpd
root 332014 1 0 15:13:41 – 0:00 /usr/local/apache/bin/httpd