[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: MIT-Scheme (SVM1 version) on NetBSD/arm64
From: |
Taylor R Campbell |
Subject: |
Re: MIT-Scheme (SVM1 version) on NetBSD/arm64 |
Date: |
Sat, 4 Jan 2020 05:42:46 +0000 |
> Date: Fri, 03 Jan 2020 23:22:11 +0100
> From: "Alexander Shendi (Web.DE)" <address@hidden>
>
> Thank you for the quick response. I guess there is no native code
> generator for aarch64/arm64? There used to be a portable C-backend?
> What is the state of it?
There is, in fact, a native aarch64 back end, in git, not yet released
-- `git clone https://git.savannah.gnu.org/projects/mit-scheme.git'.
To cross-build it, you'll need a host with an existing MIT Scheme
10.1.10 system, e.g. an x86 workstation like I use.
Our build system is kinda bodgy and doesn't support cross-compilation
well, but here's the two ways that it can be done at the moment --
shell commands are marked with an `x86$' or `arm$' prompt according to
which machine you need to run them on:
A: Using a NetBSD cross-build, from any host that can build NetBSD.
(This is what I usually do.)
1. First populate a NetBSD objdir with
x86$ cd /path/to/netbsd/src
x86$ ./build.sh -O /path/to/netbsd/obj -T /path/to/netbsd/tools \
-U -u -m evbarm64 -j4 tools distribution
2. Then configure Scheme to cross-compile _both_ the Scheme parts
(`--enable-cross-compiling', `--enable-native-code=aarch64le')
_and_ the C parts (`--host'/`--sysroot'/&c.):
x86$ cd /path/to/mit-scheme/src
x86$ ./Setup.sh
x86$ PATH=$PATH:/path/to/netbsd/tools ./configure \
--enable-cross-compiling=yes \
--enable-native-code=aarch64le \
--host=aarch64--netbsd \
CFLAGS=--sysroot=/path/to/netbsd/obj/destdir.evbarm \
CPPFLAGS=--sysroot=/path/to/netbsd/obj/destdir.evbarm \
LDFLAGS=--sysroot=/path/to/netbsd/obj/destdir.evbarm \
HOST_CC=cc \
ac_cv_func_setpgrp_void=no ac_cv_func_mmap_fixed_mmap=yes
(The ac_cv_func_* settings are needed because autoconf doesn't
know how to detect those when cross-compiling, but I happen to
know they are correct on NetBSD.)
3. Cross-compile the Scheme code:
x86$ make -j4 cross-host
4. Cross-compile the C code, but because our build system is bodgy
this will fail trying to run an aarch64 executable on your host
(say x86) system:
x86$ make -j4 cross-target
Usually it'll be something like `../microcode/scheme: can't
execute ELF file', so don't worry if it fails that way.
5. Then, once it gets that far, rsync the code over to the target
aarch64 system and rerun it to natively build the rest on the
target:
arm$ make -j4 cross-target
B: Cross-compile the Scheme part, and natively compile the C part.
(This is how I started the aarch64 port, and it takes less setup
time because it doesn't need a NetBSD objdir, but it's a bit of a
pain because my Pinebook is much slower to compile the C code and
incremental don't work as well.)
1. Configure Scheme to cross-compile just the Scheme parts:
x86$ cd /path/to/mit-scheme/src
x86$ ./Setup.sh
x86$ ./configure --enable-cross-compiling=yes \
--enable-native-code=aarch64le
2. Cross-compile the Scheme code:
x86$ make -j4 cross-host
3. Rsync the code over to the target and re-configure the C code on
the aarch64 target:
arm$ (cd microcode && ./configure)
4. Then natively compile the rest on the aarch64 target:
arm$ make -j4 cross-target