mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-09 10:52:24 +00:00
168 lines
4.4 KiB
Plaintext
168 lines
4.4 KiB
Plaintext
This file documents how to use lcc 4.1 as the C compiler when
|
|
installing Mercury on Linux.
|
|
|
|
Some of the same issues may arise when using lcc on other systems,
|
|
or when using other versions of lcc.
|
|
|
|
1. You can get lcc from <http://www.cs.princeton.edu/software/lcc/>.
|
|
In particular Linux RPM's are available from
|
|
<ftp://ftp.cs.princeton.edu/pub/packages/lcc/contrib>.
|
|
|
|
2. Apply the following patches:
|
|
|
|
(i) On at least some versions of Linux, the following patch must be
|
|
applied to /usr/include/stdint.h. This is because the Boehm (et al)
|
|
collector uses elf.h, and the version of elf.h that gets installed on
|
|
Linux uses by default is not compatible with lcc -- it uses
|
|
typedefs defined as `long long' in stdint.h.
|
|
|
|
If you prefer you can copy stdint.h to /usr/local/lib/lcc-4.1/include
|
|
and then apply the patch there.
|
|
|
|
This should be fixed in newer versions of glibc.
|
|
|
|
--- /usr/include/stdint.h Sun Nov 7 03:23:27 1999
|
|
+++ ./stdint.h Tue Nov 21 05:25:39 2000
|
|
@@ -28,6 +28,22 @@
|
|
#include <stddef.h>
|
|
#include <bits/wordsize.h>
|
|
|
|
+#ifdef __GNUC__
|
|
+__extension__
|
|
+typedef long long __long_long;
|
|
+__extension__
|
|
+typedef unsigned long long __u_long_long;
|
|
+#else
|
|
+typedef struct {
|
|
+ long __ll_first;
|
|
+ long __ll_second;
|
|
+} __long_long;
|
|
+typedef struct {
|
|
+ unsigned long __ull_first;
|
|
+ unsigned long __ull_second;
|
|
+} __u_long_long;
|
|
+#endif
|
|
+
|
|
/* Exact integral types. */
|
|
|
|
/* Signed. */
|
|
@@ -42,8 +58,10 @@
|
|
typedef long int int64_t;
|
|
# else
|
|
__extension__
|
|
-typedef long long int int64_t;
|
|
+typedef __long_long int64_t;
|
|
# endif
|
|
+#else
|
|
+typedef __long_long int64_t;
|
|
#endif
|
|
|
|
/* Unsigned. */
|
|
@@ -54,7 +72,7 @@
|
|
typedef unsigned long int uint64_t;
|
|
#else
|
|
__extension__
|
|
-typedef unsigned long long int uint64_t;
|
|
+typedef __u_long_long uint64_t;
|
|
#endif
|
|
|
|
|
|
@@ -68,7 +86,7 @@
|
|
typedef long int int_least64_t;
|
|
#else
|
|
__extension__
|
|
-typedef long long int int_least64_t;
|
|
+typedef __long_long int_least64_t;
|
|
#endif
|
|
|
|
/* Unsigned. */
|
|
@@ -79,7 +97,7 @@
|
|
typedef unsigned long int uint_least64_t;
|
|
#else
|
|
__extension__
|
|
-typedef unsigned long long int uint_least64_t;
|
|
+typedef __u_long_long uint_least64_t;
|
|
#endif
|
|
|
|
|
|
@@ -95,7 +113,7 @@
|
|
typedef int int_fast16_t;
|
|
typedef int int_fast32_t;
|
|
__extension__
|
|
-typedef long long int int_fast64_t;
|
|
+typedef __long_long int_fast64_t;
|
|
#endif
|
|
|
|
/* Unsigned. */
|
|
@@ -108,7 +126,7 @@
|
|
typedef unsigned int uint_fast16_t;
|
|
typedef unsigned int uint_fast32_t;
|
|
__extension__
|
|
-typedef unsigned long long int uint_fast64_t;
|
|
+typedef __u_long_long uint_fast64_t;
|
|
#endif
|
|
|
|
|
|
@@ -134,9 +152,9 @@
|
|
typedef unsigned long int uintmax_t;
|
|
#else
|
|
__extension__
|
|
-typedef long long int intmax_t;
|
|
+typedef __long_long intmax_t;
|
|
__extension__
|
|
-typedef unsigned long long int uintmax_t;
|
|
+typedef __u_long_long uintmax_t;
|
|
#endif
|
|
|
|
(ii) On some versions of Linux, the following patch must be
|
|
applied to /usr/local/lib/lcc-4.1/include/stdio.h.
|
|
This is due to an incompatibility between glibc's <sys/types.h>
|
|
and lcc's <stdio.h>.
|
|
|
|
--- stdio.h.orig Thu Jul 6 10:12:07 2000
|
|
+++ stdio.h Sun Feb 4 18:33:46 2001
|
|
@@ -444,18 +444,20 @@
|
|
are originally defined in the Large File Support API. */
|
|
|
|
/* Types needed in these functions. */
|
|
-#ifndef off_t
|
|
+#if !defined off_t && !defined __off_t_defined
|
|
# ifndef __USE_FILE_OFFSET64
|
|
typedef __off_t off_t;
|
|
# else
|
|
typedef __off64_t off_t;
|
|
# endif
|
|
# define off_t off_t
|
|
+# define __off_t_defined
|
|
#endif
|
|
|
|
-#if defined __USE_LARGEFILE64 && !defined off64_t
|
|
+#if defined __USE_LARGEFILE64 && !defined off64_t && !defined __off64_t_defined
|
|
typedef __off64_t off64_t;
|
|
# define off64_t off64_t
|
|
+# define __off64_t_defined
|
|
#endif
|
|
|
|
(iii) lcc 4.1 on at least some versions of Linux has a bug where
|
|
`lcc -static' is broken. To work around that, rename the
|
|
original `lcc' program as `lcc.orig' and replace it with the
|
|
following script:
|
|
|
|
#!/bin/sh
|
|
lcc.orig "$@" -lc -lgcc
|
|
|
|
This results in some spurious warnings when invoking `lcc -c ...',
|
|
but ensures that `lcc -static ...' works.
|
|
|
|
3. When invoking `configure', use the `--with-cc=lcc' option.
|
|
|
|
4. If you run into a fixed limit with lcc, it might be necessary
|
|
to pass the `--max-jump-table-size' to mmc, e.g. by putting
|
|
`EXTRA_MCFLAGS=--max-jump-table-size 100' in Mmake.params.
|
|
This requires recompiling the Mercury sources to C,
|
|
so you need to have a working Mercury compiler already installed
|
|
(e.g. one built using gcc instead of lcc).
|
|
|
|
5. Otherwise, follow the normal installation instructions in the INSTALL file.
|
|
|