How to compile PHP on a HP (yes it's HP now) Nonstop Kernel Himalaya System running
OSS G06:
WARNING: THIS PROCEDURE HAS ONLY BEEN TESTED ON G06 SYSTEMS AND PHP-4.2.0. THERE IS NO
GUARANTEE THAT IT WILL EVEN WORK ON YOUR SYSTEM. THIS IS A DRAFT AND YOU SHOULD NOT
USE THIS NOTE TO INSTALL PHP ON A PRODUCTION HIMALAYA SYSTEM. THIS IS NOT SUPPORTED BY
COMPAQ.
Comments: [EMAIL PROTECTED]
DRAFT 0.1
The problem with running ./configure on an Himalaya system is that the c89 compiler
will not fail if there are unresolved externals. Those are resolved at fixup time, the
first time the program is ran. It has been a linker design since the beginning of
Tandem systems, but doesn't work well with ./configure scripts.
The way to make ./configure work properly and only find procedures that are really
available is to make a wrapper for the c89 compiler, so that it will fail if a
procedure is unknown.
Here are the steps to achieve this:
1) Copy the following script under a directory you will call 'nsk' and create under
the directory that contains ./configure. For example, if you have downloaded the PHP
release in /usr/joe/php-4.2.0, then the ./configure program will be in that directory.
Do the following:
/usr/joe/php-4.2.0: mkdir nsk
/usr/joe/php-4.2.0: cd nsk
Copy the following program in the 'nsk' directory (the program is in between *****):
************************************************************************************
echo "\nStarting to build the procedure list from your system..\n";
# First get the current sysnn
sysnn=`gtacl -c 'sysinfo' | grep "Current SYSnn" | sed 's/[ ]*Current SYSnn[ ]*//'`
echo "You are running on $sysnn.";
# Get the list of SRLs to look for. This is libc.obey
srllist=`cat /usr/lib/libc.obey | sed 's/-l//'`;
srllist="$srllist TSYSCLR";
# For each srl, call nm to extract the procedure names, and store that
# in a file.
# The grep and sed commands remove the extra information and just keep
# the procedure names. The last sed command changes the OSS_xxx_ proc names
# to xxx (e.g. OSS_gethostbyname_ to gethostbyname).
for srl in $srllist; do
fullname="/G/SYSTEM/$sysnn/$srl";
echo "Extracting info from $fullname..." >&2;
nm $fullname | nm $fullname | egrep '(^_EXP#)|(^_ORG#)' | sed -n -e '/|COMMON/d' -e
'/|DATA/d' \
-e '/ file/d' -e 's/^\([^ ]*\).*/\1/p' \
| sed 's/^_EXP#//' | sed 's/^_ORG#//' | sed 's/^OSS_\([a-z]*\)[_]/\1/'
done >procs;
echo "Done.. Now creating nskcc..";
# Now make a fake cc so that the Configure script will work properly. I call
# it 'nskcc', then set the following environment variables. After this is
# done, ./Configure and the subsequent make will run properly.
#
# PATH=$PATH:.
# CC=nskcc
# CFLAGS="-D_XOPEN_SOURCE_EXTENDED=1 -D_TANDEM_SOURCE -Wnowarn=1506,262,707,304,770"
# Remove our previous test file if any.
# launch the c compiler with the options given by the caller.
cat >nskcc <<EOM
rm -f nskt
# Look for the name of the object file.
obj=\`echo \$* | sed 's/.*-o \([A-Za-z0-9.]*\) .*/\1/'\`
# Try the compilation. Return immediately if failed.
if ! c89 \$*;then exit 1;fi
# if a procedure is undefined, it will appear like this:
# (none) : gethostbyname
#
# use grep/sed to extract the procedure names that are undefined.
# we FAIL if there is one procedure undefined, even if the other is
# good. ./configure will rarely check more than one proc at a time
# so that should work 99%.
noft "file \$obj;llf" 2>/dev/null | grep "^(none)" | sed 's/^(none)[ ]*: //' >nskt
# if nskt is not empty, then there is a procedure that was not found in
# the srl, either because it was not declared properly, or because it's
# in the tsysclr. In that case, try to find our procedure in the procs file.
#
# If the procedure is not found, exit with status 1. That way, ./configure will
# think cc failed and consider the procedure to not work.
if test -s nskt; then
proclist=\`cat nskt\`;
for proc in \$proclist; do
if ! grep "^\$proc\\\$" nsk/procs >/dev/null 2>&1; then exit 1; fi
done;
fi
exit;
EOM
# Now tell user to set the env variables so ./configure uses our nskcc program.
echo "Now set the following environment variables and run ./configure."
echo "export PATH=\$PATH:./nsk (or the full path of nsk)";
echo "export CC=nskcc";
echo "export CFLAGS=\"-D_XOPEN_SOURCE_EXTENDED=1 -D_TANDEM_SOURCE
-Dnowarn=1506,262,707,304,770\""
echo "Now run ./configure";
**************************************************************************************************
Name this script as you wish. For example:
/usr/joe/php-4.2.0/nsk/makensk
Allow execution of the script:
chmod +x /usr/joe/php-4.2.0/nsk/makensk
This script will search the SRLs and make a list of procedures that are known on the
system.
2) Execute the script
cd /usr/joe/php-4.2.0/nsk
./makensk
The script will execute (takes some time to run) and search for your SYSnn, for the
SRLs, and extract the procedure names from the SRLs and TSYSCLR. It will then create a
file called "nskcc". nskcc will be the wrapper that you will need to use instead of
c89.
3) You should have a file called "procs" in ../nsk. This file should contain a list of
procedures. If you can't find this file or it is empty, there's been a problem.
4) Now run ./configure:
cd .. (to return to /usr/joe/php-4.2.0)
export CC=nskcc (to tell ./configure to use nskcc as the c compiler)
export LD=nld (tells which linker we have)
export CFLAGS="-D_XOPEN_SOURCE_EXTENDED -D_TANDEM_SOURCE
-Wnowarn=1506,262,707,304,770" (sets the c compiler flags and suppresses some warnings)
export PATH=$PATH:/usr/joe/php-4.2.0/nsk (tells the shell where to look for nskcc)
rm config.cache (if you have already run ./configure)
./configure --without-mysql
Note: if you get the following message:
Configure: error: invalid package name: mysql then you must edit the ./configure file
and comment the following lines:
604 #expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
605 # { echo "$as_me: error: invalid package name: $ac_package" >&2
606 # { (exit 1); exit 1; }; }
5) Look at the output. Verify that it says that it is using nskcc as the C compiler.
6) Prepare yourself a coffee, watch TV, read the latest PHP documentation.. and wait..
7) If ./configure goes into inspect because of unresolved externals asctime_r, then
you've made a mistake, and nskcc is either not used, or the macro didn't work on your
system. Check that you've copied it correctly, and that you've set the paths
correctly. Don't forget to rm config.cache if you're trying again.
8) When ./configure has finished successfully, rename nsk/nskcc to whatever you want,
then create the following nskcc file in /usr/bin:
#!/bin/sh
c89 $*
This is because 'make' will try to run nskcc and won't find it. You could just copy it
to /usr/bin, but it's not necessary to do a complete procedure check again. This will
be fixed in a future version of the macro.
9) Edit main/php_config.h and look for the line that contains "u_int". Comment it:
/* #define in_addr_t u_int */
run make. The warnings you see are okay. You shouldn't get any fatal error.
When the make is finished, run ./php -v to verify that you don't have any unresolved
external. Install PHP as a Pathway CGI module in the iTP Webserver, and..
10) Enjoy PHP on your Himalaya!
Note: if you're going to rebuild PHP, don't forget to remove /usr/bin/nskcc, rename it
correctly in ../nsk and remove config.cache if any. 'make clean' is always a good idea
too.
This compiles PHP with symbols. The resulting code is a huge file, you may strip the
symbols if necessary.