Skip to content
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

Help targeting macOS #63

Open
larsbrinkhoff opened this issue Jun 27, 2017 · 2 comments
Open

Help targeting macOS #63

larsbrinkhoff opened this issue Jun 27, 2017 · 2 comments
Labels

Comments

@larsbrinkhoff
Copy link
Owner

I'd like to make a port to macOS, but it's not really viable to do that without access to a macOS machine.

If I could get ssh access to a machine for a month or so, that'd be really helpful.

@LdBeth
Copy link

LdBeth commented Nov 13, 2018

Building with C target on latest macOS Mojave with official CommandLineTools C toolchain and Clozure CL works fine except a few trivia:

  1. macOS deprecated i386 and probably will remove it in the future, so ld would complaint the default -m32, but simply substitute it with -m64 works out without much problem.

  2. Clang does not support -fno-unit-at-a-time.

Practically testing with macOS in VirtualBox is preferred.

/Library/Developer/CommandLineTools/usr/bin/make -ftargets/c/bootstrap.mk
make[1]: Circular kernel.c <- b-forth dependency dropped.
gcc -m64 -O2 -fomit-frame-pointer -fno-unit-at-a-time -Itargets/c targets/c/params.c -o params
clang: warning: the clang compiler does not support '-fno-unit-at-a-time'
targets/c/run.sh ./params -lisp > params.lisp
cp targets/c/jump.fth jump.fth
cp targets/ctc.fth threading.fth
cp targets/c/target.fth target.fth
echo ": sysdir   s\" src/\" ;" >> target.fth
./lisp/lisp.sh '(load "lisp/meta.lisp") (compile-forth "targets/c/nucleus.fth" "src/kernel.fth")'
;; Loading file lisp/meta.lisp ...
;;  Loading file params.lisp ...
;;  Loaded file params.lisp
;;  Loading file lisp/words.lisp ...
;;  Loaded file lisp/words.lisp
;; Loaded file lisp/meta.lisp
gcc -m64 -O2 -fomit-frame-pointer -fno-unit-at-a-time -Itargets/c  -c -o kernel.o kernel.c
clang: warning: the clang compiler does not support '-fno-unit-at-a-time'
gcc -m64 kernel.o -o b-forth
rm -f kernel.c kernel.o params.lisp jump.fth threading.fth target.fth
cp b-forth forth
rm -f *-stamp
touch c-.-stamp
targets/c/run.sh ./params -forth > params.fth
cp targets/c/jump.fth jump.fth
cp targets/ctc.fth threading.fth
cp targets/c/target.fth target.fth
echo ": sysdir   s\" src/\" ;" >> target.fth
echo 'include targets/c/build.fth  bye' | targets/c/run.sh ./forth | tail -n+3 > kernel.c ; grep -a Meta-OK kernel.c
/* Meta-OK */ 
gcc -m64 -O2 -fomit-frame-pointer -fno-unit-at-a-time -Itargets/c  -c -o kernel.o kernel.c
clang: warning: the clang compiler does not support '-fno-unit-at-a-time'
gcc -m64 kernel.o -o c-forth
rm -f forth.exe
cp c-forth forth

@larsbrinkhoff
Copy link
Owner Author

Thanks for checking. The C target works, but what I'd like to do is writing the target Mach-O file image from Forth, like how the Linux target writes an ELF file and the Windows targets writes a PE file.

I tried to use Virtual Box at some point, but failed the installation. And now I have other priorities.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants