[Hugs] #52: [PATCHES] port hugs98-Sep2006 to AIX 4.3.3, AIX 5.2,
HPUX 11.0, SUNOS 5.9
Hugs
trac at galois.com
Tue Jan 16 14:23:00 EST 2007
#52: [PATCHES] port hugs98-Sep2006 to AIX 4.3.3, AIX 5.2, HPUX 11.0, SUNOS 5.9
-------------------------+--------------------------------------------------
Reporter: guest | Owner: nobody
Type: enhancement | Status: new
Priority: major | Milestone:
Component: hugs | Version: 200609
Keywords: port |
-------------------------+--------------------------------------------------
Sorry if this is a duplicate. I sent it to hugs-bugs at haskell.org but it
just
seems to have disappeared into the ether.
Here is a shell script that I used to build the Sep 2006 release for:
AIX 4.3.3 (IBM 5.0.2.0 compiler)
AIX 5.2 (IBM 6.0.0.7 compiler)
HPUX 11.0 (A.11.00.13 compiler)
Redhat 9 x86
Redhat AS 4 x86 (CentOS actually)
Solaris 9 (6.0u2 compiler)
There are some source patches in the script as well as some settings
that are required for proper
compilation. I have a framework that runs the script in the unpacked
source tree to do the build
and install.
Some autoconf work needs to be done for proper configuration of inline
functions and shared library
creation. As far as the latter goes you might consider using libtool,
which is designed for that
sort of thing. The current approach of using the compiler for shared
library creation is not supported
by HPUX 11.0 -- the link needs to be done by the linker directly. So at
the very least the compiles
and links need to be split into two separate commands.
Some documentation for the OPTFLAGS and PTHREAD_CC variables would be
nice.
There is still an issue in the SUNOS build related to a couple of
symbols in System/Posix/Internals.so.
Hugs runs properly for what I am doing so I haven't spent time on this
yet:
runhugs: Error occurred
ERROR "libraries/bootlib/System/Posix/Internals.hs" - Error while
importing DLL "libraries/bootlib/System/Posix/Internals.so":
ld.so.1: ffihugs: fatal: relocation error: file
libraries/bootlib/System/Posix/Internals.so: symbol __hscore_readdir:
referenced symbol not found
There is also a question about the make_bootlib script -- what is "cat
-s" intended to do? It is not clear
to me that it is portable -- the AIX man page states that -S does what
-s used to do, for example.
Here is a summary of what I had to do for the various platforms to get
hugs to compile and install:
- AIX
The AIX preprocessor fails when it sees invalid # directives. (Note
that it also allows #
directives to have white space or comments before the # -- it looked
like some of the Haskell
code in Hugs thinks spaces will prevent interference from the
preprocessor.)
The proper inline keyword is __inline.
The _LARGE_FILES symbol collides with _LARGE_FILES_API, which latter is
turned
on automatically when long long is enabled (in at least one failed
compilation, anyway).
The hugs code has // comments in it -- this is not valid for older C
compilers.
Increase -qmaxmem so optimization completes without warnings.
Turn on alloca support.
Use -G compiler option for proper shared library support.
- HPUX
Added +Z to generate position independent code for shared library use.
Added +DAportable so the resulting binaries can run on older PARISC
version processors.
Pass -b option to linker when building shared libraries.
Added wrapper around ld for proper shared library linking. HPUX 11, at
least the version I have,
does not support linking a shared library via the compiler -- you are
supposed to use the linker
directly. I made a wrapper that throws away the crt0.o argument that
the compiler passes to
the linker and that seems to fix the problem (that particular file is
not used for dynamic
links and is not position-independent anyway so will cause a link
failure).
The HPUX compiler I have does not appear to support the inline keyword.
- LINUX
no changes necessary
- SUNOS
The SUNOS compiler I have (6.0u2) has some sort of problem with inline
functions as used by
Hugs in shared libraries. I converted them to "static" to work around
whatever was going on.
Perhaps "extern inline" is needed or some such.
Set the -G option for linking shared libraries.
-- Joe Buehler
jbuehler at spirentcom.com
{{{
#!/bin/ksh
HOST="$1"
OS="$2"
OS_VERSION="$3"
OS_VERSION_MINOR="$4"
patch_aix()
{
/usr/local/bin/patch -p0 -N -b -Vnumbered <<\EOF
--- libraries/tools/make_bootlib.~1~ 2006-05-19 17:36:17.000000000
-0400
+++ libraries/tools/make_bootlib 2007-01-09 12:50:58.000000000
-0500
@@ -62,10 +62,19 @@
# portability we run the preprocessor on a .c file.
cpp_input=$tmpdir/cppinput.c
- cp "$1" $cpp_input
+ # AIX C/C++ compiler version 6.0 fails on illegal preprocessor
directives
+ sed '
+ s/^\([ ]*#[ ]*[-!]\)/ELIMINATE THIS STRING PLEASE\1/
+ s/^\([ ][ ]*#[ ]*[A-Z]\)/ELIMINATE THIS STRING
PLEASE\1/
+ s/^\([ ][ ]*#[ ]*osthreads\)/ELIMINATE THIS
STRING PLEASE\1/
+ ' "$1" >$cpp_input
# gcc-3.3 on MacOS X 10.3 is reported to add #pragma
- $cpp $cpp_flags $cpp_input | grep -v '^#' | cat -s
+ $cpp $cpp_flags $cpp_input |
+ sed '
+ /^#/d
+ s/^ELIMINATE THIS STRING PLEASE//
+ ' | cat -s
}
# internal Hugs modules
--- packages/base/include/HsBase.h.~1~ 2006-09-20 18:01:52.000000000
-0400
+++ packages/base/include/HsBase.h 2007-01-09 13:10:35.000000000
-0500
@@ -220,6 +220,8 @@
#ifndef INLINE
# if defined(_MSC_VER)
# define INLINE extern __inline
+# elif defined(__xlC__)
+# define INLINE __inline
# elif defined(__GNUC__)
# define INLINE extern inline
# else
EOF
}
patch_hpux()
{
/usr/local/bin/patch -p0 -N -b -Vnumbered <<\EOF
--- packages/base/include/HsBase.h.~1~ 2006-09-20 18:01:52.000000000
-0400
+++ packages/base/include/HsBase.h 2007-01-09 13:10:35.000000000
-0500
@@ -220,6 +220,8 @@
#ifndef INLINE
# if defined(_MSC_VER)
# define INLINE extern __inline
+# elif defined(__hpux)
+# define INLINE static
# elif defined(__GNUC__)
# define INLINE extern inline
# else
EOF
}
patch_sunos()
{
/usr/local/bin/patch -p0 -N -b -Vnumbered <<\EOF
--- packages/base/include/HsBase.h.~1~ 2006-09-20 18:01:52.000000000
-0400
+++ packages/base/include/HsBase.h 2007-01-09 13:10:35.000000000
-0500
@@ -220,6 +220,8 @@
#ifndef INLINE
# if defined(_MSC_VER)
# define INLINE extern __inline
+# elif defined(__sun)
+# define INLINE static
# elif defined(__GNUC__)
# define INLINE extern inline
# else
EOF
}
export CC=cc
export PTHREAD_CC=cc
export CFLAGS=-O
export OPTFLAGS=-O
case "$OS" in
aix)
# This is the compiler I like to use under AIX.
CC=/usr/vacpp/bin/xlC_r
PTHREAD_CC=/usr/vacpp/bin/xlC_r
# Enable large files -- this is implied by "long long" so we turn
it on globally.
CFLAGS="$CFLAGS -D_LARGE_FILE_API"
# Some of the C code actually has C++ commments in it!
CFLAGS="$CFLAGS -qcpluscmt"
# Increase memory available for optimization.
CFLAGS="$CFLAGS -qmaxmem=32768"
# For alloca support
CFLAGS="$CFLAGS -ma"
# This version of HUGS does not know how to make AIX shared
objects.
export ac_cv_dll_flags=-G
# The _LARGE_FILES and _LARGE_FILE_API symbols are incompatible --
# defining both causes system header file conflicts (AIX 5.2.0.0)
export ac_cv_sys_large_files=no
patch_aix
;;
hpux)
# This version of HUGS does not know how to make HPUX shared
objects.
CFLAGS="$CFLAGS +Z +DAportable -tl,$PWD/myld"
export ac_cv_dll_flags="-Wl,-b"
cat >myld <<-\EOF && chmod 755 myld
#!/bin/ksh
I=0
J=0
SHARED=
#echo "LINK: $0 $*" >&2
for ARG; do
case "$ARG" in
*/crt0.o)
ARGV[$I]="$ARG"
I=$(expr $I + 1)
;;
-b)
SHARED=1
ARGV[$I]="$ARG"
ARGV_SHARED[$J]="$ARG"
I=$(expr $I + 1)
J=$(expr $J + 1)
;;
*)
ARGV[$I]="$ARG"
ARGV_SHARED[$J]="$ARG"
I=$(expr $I + 1)
J=$(expr $J + 1)
;;
esac
done
if [ "$SHARED" != "" ]; then
set -x
ld "${ARGV_SHARED[@]}"
else
set -x
ld "${ARGV[@]}"
fi
EOF
patch_hpux
;;
linux)
;;
sunos)
# This version of HUGS does not know how to make SUNOS shared
objects.
export ac_cv_dll_flags=-G
patch_sunos
;;
esac &&
./configure \
CC="$CC" \
PTHREAD_CC="$CC" \
CFLAGS="$CFLAGS" \
OPTFLAGS="$OPTFLAGS" \
--disable-large-banner \
--with-pthreads \
&&
gmake &&
( gmake verbosecheck || true ) &&
gmake install &&
true
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/hugs/ticket/52>
Hugs <http://www.haskell.org/hugs/>
Hugs 98, an interpreter for Haskell
More information about the Hugs-Bugs
mailing list