Ticket #52 (new enhancement)

Opened 6 years ago

Last modified 6 years ago

[PATCHES] port hugs98-Sep2006 to AIX 4.3.3, AIX 5.2, HPUX 11.0, SUNOS 5.9

Reported by: guest Owned by: nobody
Priority: major Milestone:
Component: hugs Version: 200609
Keywords: port Cc:

Description

Sorry if this is a duplicate. I sent it to hugs-bugs@… 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@…

#!/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

Change History

Changed 6 years ago by edoll

 google左侧排名  google排名  飞机票  破碎机  球磨机  选矿设备  雷蒙磨  烘干机  整形  隆鼻  机票  打包机  短信群发  短信群发器  短信群发软件  数据恢复  google左侧排名  google左侧排名  google排名  google排名  工控机  机票  IBM笔记本  鲜花

 磁选机  浮选机  球磨机  破碎机  蟑螂  床上用品  大屏幕  减肥  专业美容  西装  职业装  礼服  平板电脑  嵌入式触摸屏  人机界面  家教  北京家教  google排名  google左侧排名

 干洗机  干洗  干洗机价格  干洗店加盟  干洗设备  干洗加盟  墙面粉刷  地毯清洗  石材翻新  清洗油烟机  木地板翻新  google左侧排名  google左侧推广  google左侧优化

 集团电话  群发短信  北京办公家具  真空泵  玩具  模型  无线网桥  亚洲交友中心  google左侧排名  google左侧排名  google排名  google左侧排名

 防雷  废料  玩具认证  鲜花  监控  综合布线  系统集成  北京家教  firefox 2.0  firefox  firefox下载  个人网站  网站推广  google优化  搜索引擎优化  浮选机  磁选机  google左侧排名  google左侧排名

 广告公司  文化传播有限公司  婚庆公司  北京婚庆公司  礼仪庆典公司  北京演出公司  演出公司  公关公司  偶联剂  凌华工控机  google排名  google排名  google左侧排名  google左侧排名

Note: See TracTickets for help on using tickets.