-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bootstrap on OpenBSD? #296
Comments
A working but unfinished MLton port for OpenBSD 5.9 can be found here: https://github.com/extensibl/ports The mlton-bootstrap README in the above repository contains notes on how to bootstrap the older version of MLton. However, the port is not completed exactly because there were difficulties bootstrapping MLton in offline mode with just MLton sources available. |
Thanks! I'm not sure I have the skills to finish the port, though. |
I would suggest to try and get it done the right way from the start, both OpenBSD and MLton are many commits ahead, so it might just work. There are some instructions in the MLton documentation and wiki. Cross-compilation notes for the older version of MLton are here, as well as the resulting files, needed to bootstrap the compiler on OpenBSD: https://github.com/extensibl/ports/blob/master/mlton-bootstrap/bootstrap/ |
It should be possible to either actually cross-compile on Linux (i.e., produce OpenBSD binaries on a Linux machine) or to indirectly cross-compile on Linux (i.e., use the Linux machine to produce the bootstrap files that will then be compiled on the OpenBSD machine). See http://mlton.org/PortingMLton for some details, especially the |
Thanks for comming back to this issue.
### cross compiling
In order to use `-target` I need a GCC version that can cross
compile[0]. I think that's where I gave up.
### bootstrapping
That's what I tried along the lines:
- install mlton on OSX
- vim /usr/local/bin/mlton
* add `-keep g` to `doit "$lib"`
- download mlton source
- cd into mlton source code
- vim bin/mlton-script
* add `-keep g` to `doit "$lib"`
- make CC=clang
- scp source to OpenBSD
- vim runtime/util/die.c
* include stdlib.h, stdio.h, errno.h, stdarg.h, string.h
- cd runtime/util
* clang -c die.c
- `clang -std=gnu11 -fno-common -pedantic -Wall -Wextra -Wformat=2 \
-Wswitch-default -Wswitch-enum -Wuninitialized -Winit-self \
-Wstrict-aliasing=2 -Wfloat-equal -Wundef -Wshadow -Wpointer-arith \
-Wbad-function-cast -Wcast-qual -Wwrite-strings -Waggregate-return \
-Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes \
-Wmissing-declarations -Wmissing-field-initializers -Wmissing-noreturn \
-Wmissing-format-attribute -Wredundant-decls -Wnested-externs \
-fvisibility=hidden -m64 -I. -Iplatform -Wdisabled-optimization -O2 \
-fomit-frame-pointer -c -o build/lib/mlton/mlton-compile \
-Lbuild/lib/mlton/targets/self -L/usr/local/lib \
mlton/mlton-compile.135.c -lmlton -lgmp -lgdtoa -lm \
-Ibuild/lib/mlton/include -I build/lib/mlton/targets/self/include`
That failed, too. I don't remember the error message, though.
[0] http://www.mlton.org/CrossCompiling
|
One problem with keeping the generated .c files on MacOS with |
One problem with keeping the generated .c files on MacOS with `-target self` is that you may have embedded libc constants from MacOSX that don't make sense on OpenBSD.
Thanks, I didn't think about that.
You really need to build the runtime system and the constants file on the OpenBSD system.
Can you elaborate a little bit on this?
From reading [0] a had the impression `mlton -keep g && scp` is the
way to go:
Building and maintaining cross-compiling gcc's is complex. You may find it simpler to use mlton -keep g to generate the files on the host, then copy the files to the target, and then use gcc or mlton on the target to compile the files.
|
The essential steps (albeit, cribbed together from different pages) is
Essentially, this is the |
Thanks for your patience with a noob!
Unfourtunately, I didn't try these steps yet. (Time, you know...)
Feel free to close the issue for now.
I hope to add a comment if I check out your suggestions.
|
If I replace the path with
Is it correct that there should be a binary in PS: The tar archive, that gets copied to the target, doesn't include the |
I think that Yes, |
After `make all` the binary is there.
But even though `make` says
Build of MLton succeeded.
the `./bin/add-cross amd64-pc-openbsd amd64 openbsd <target>` complains
with
invalid target: amd64-pc-openbsd
.
PS: If I nag to much, just tell me.
|
Can you tell where in |
Line 160:
"$src/build/bin/mlton" -target $crossTarget ...
|
Then something went wrong earlier in the script with either building the runtime on the target system or copying files from the target system back to the host system. On the host, you should have a |
Maybe no longer of interest, but #380 has streamlined bootstrapping MLton on new platforms. With it, I was able to bootstrap on amd64-openbsd; the resulting amd64-openbsd binary release file is at: https://downloads.sourceforge.net/project/mlton/mlton/experimental/20200523/mlton-20200523.150430-gb1b624ad3-1.amd64-openbsd.tgz |
@MatthewFluet I consider using OpenBSD as a second system on my PowerPC hardware, if that works, I will be interested to build |
I'd like to try MLton on OpenBSD.
However, in order to compile
mlton
I need a compiledmlton
:)Sourceforge has only binaries for Darwin and Linux.
Any idea how to proceed?
The text was updated successfully, but these errors were encountered: