Difference between revisions of "Clean on Mac OS X"
(Change building of patch_bin, clm, clms to include new patch and build in x86 mode) |
(When we build the 64-bit version, the error is gone. So update patch etc - now we end up with the same error as the Linux page) |
||
Line 36: | Line 36: | ||
~/clean$ md5sum *.patch | ~/clean$ md5sum *.patch | ||
3fda955b8801fd1da98a55ba09d6a795 clean_mac_clm.patch | 3fda955b8801fd1da98a55ba09d6a795 clean_mac_clm.patch | ||
− | + | e23bacd27bc99e4c1c5ef90fda983a30 clean_mac_codegenerator.patch | |
cb877dc83ecd1c0cd8d7307de255d22b clean_mac_runtimesystem.patch | cb877dc83ecd1c0cd8d7307de255d22b clean_mac_runtimesystem.patch | ||
e8bf18f68d336ddf879c5c8e11eaec56 clean_mac_stdenvinclusion.patch | e8bf18f68d336ddf879c5c8e11eaec56 clean_mac_stdenvinclusion.patch | ||
Line 73: | Line 73: | ||
== Building the Code Generator == | == Building the Code Generator == | ||
+ | |||
+ | In this section, we will build the 64 bit version of the CodeGenerator (while we up till now have forced the i386 version of the rest). This is because [https://wiki.clean.cs.ru.nl/index.php?title=Clean_on_Mac_OS_X&oldid=660#Compiling_the_system_libraries some weird compilation error] occured later if we don't - having a 64-bit CodeGenerator apparantly solves this. | ||
<pre> | <pre> | ||
~/clean$ patch -p0 <clean_mac_codegenerator.patch | ~/clean$ patch -p0 <clean_mac_codegenerator.patch | ||
+ | [...] | ||
~/clean$ cd clean/src/CodeGenerator | ~/clean$ cd clean/src/CodeGenerator | ||
~/clean/clean/src/CodeGenerator$ mkdir o | ~/clean/clean/src/CodeGenerator$ mkdir o | ||
− | ~/clean/clean/src/CodeGenerator$ make -f Makefile. | + | ~/clean/clean/src/CodeGenerator$ make -f Makefile.macosx_intel64 |
[...] | [...] | ||
~/clean/clean/src/CodeGenerator$ file cg | ~/clean/clean/src/CodeGenerator$ file cg | ||
− | cg: Mach-O executable | + | cg: Mach-O 64-bit executable x86_64 |
</pre> | </pre> | ||
Line 97: | Line 100: | ||
~/clean$ cd stdenv/Clean\ System\ Files | ~/clean$ cd stdenv/Clean\ System\ Files | ||
~/clean/stdenv/Clean System Files$ ../../exe/cg _system | ~/clean/stdenv/Clean System Files$ ../../exe/cg _system | ||
− | + | ~/clean/stdenv/Clean System Files$ file _system.obj | |
− | + | _system.obj: ACB archive data | |
− | + | ~/clean/stdenv/Clean System Files$ | |
</pre> | </pre> | ||
− | |||
− | |||
== Compiling patch_bin, clm and clms == | == Compiling patch_bin, clm and clms == | ||
Line 140: | Line 141: | ||
~/clean/clean/src$ cp ../exe/cg tools/elf_linker | ~/clean/clean/src$ cp ../exe/cg tools/elf_linker | ||
~/clean/clean/src$ make tools/elf_linker/linker | ~/clean/clean/src$ make tools/elf_linker/linker | ||
− | + | cd tools/elf_linker; \ | |
− | + | ../clm/clms -nr -nt -h 20m -s 2m -I ia32 -I ../../libraries/ArgEnvUnix -I ../../compiler/main/Unix -I ../../../stdenv linker -o linker; \ | |
− | + | cp linker ../../../exe/linker; \ | |
− | + | ../../../bin/clm -nr -nt -h 20m -s 2m -I ia32 -I ../../libraries/ArgEnvUnix -I ../../compiler/main/Unix linker -o linker | |
+ | Generating code for linker | ||
+ | Generating code for ArgEnv | ||
+ | Generating code for set_return_code | ||
+ | Generating code for elf_linker | ||
+ | Generating code for StdClass | ||
+ | Generating code for StdString | ||
+ | B, C, F, I, P or R expected at line 255 (got | ||
+ | ) | ||
+ | cp: linker: No such file or directory | ||
+ | Compiling StdInt | ||
+ | Can't find StdInt.icl | ||
+ | make: *** [tools/elf_linker/linker] Error 1 | ||
</pre> | </pre> | ||
− | + | And this is the error the [[Clean2.2 on 64bit Xubuntu]] ends with, too. Help from the list is required here. | |
== Compiling cocl == | == Compiling cocl == |
Revision as of 13:28, 6 September 2010
This page is a work-in-progress for building Clean on recent Mac OS X systems. There is an official build for Clean on Mac, but it's 32-bit-PowerPC-based; a shame since the newest Macs are 64-bit-Intel-based.
A useful page for building Clean on recent Unices is the Clean2.2 on 64bit Xubuntu page, which ends in the same problems I end up with here.
I haven't started working with Clean itself yet, therefore I don't know very well all of its components; however I hope to find out what everything does and how it works together in the process.
This guide assumes basic knowledge of Terminal.app and the basics of UNIX. I am running on a MacBook Pro 2009 model running Mac OS X 10.6.4. Please report back in the Discussion above what your results are.
Downloading sources
Because a part of Clean is written in Clean, we need to take a 'bootstrap' package to build. This package contains some 'precompiled' Clean source (no machine-dependent object code, however). You can get it from the Download page (direct link).
Of course, the way of downloading and the place to download is up to you. I use wget and download to $HOME/clean.
~$ mkdir clean ~$ cd clean ~/clean$ wget http://clean.cs.ru.nl/download/Clean22/linux/Clean2.2_boot.tar.gz [...] 2010-09-05 14:10:41 (429 KB/s) - '`Clean2.2_boot.tar.gz'' opgeslagen [5651786/5651786]
And unpack it...
~/clean$ tar -xzf Clean2.2_boot.tar.gz
Download some of my patches, which will hopefully be merged (after which this guide will be updated):
~/clean$ wget http://files.dazjorz.com/clean/clean_mac_runtimesystem.patch ~/clean$ wget http://files.dazjorz.com/clean/clean_mac_codegenerator.patch ~/clean$ wget http://files.dazjorz.com/clean/clean_mac_stdenvinclusion.patch ~/clean$ wget http://files.dazjorz.com/clean/clean_mac_clm.patch ~/clean$ md5sum *.patch 3fda955b8801fd1da98a55ba09d6a795 clean_mac_clm.patch e23bacd27bc99e4c1c5ef90fda983a30 clean_mac_codegenerator.patch cb877dc83ecd1c0cd8d7307de255d22b clean_mac_runtimesystem.patch e8bf18f68d336ddf879c5c8e11eaec56 clean_mac_stdenvinclusion.patch
Building the RuntimeSystem
Because the standard Makefile assumes we are using Linux, we will build the RuntimeSystem ourselves.
~/clean$ patch -p0 <clean_mac_runtimesystem.patch patching file clean/src/RuntimeSystem/Makefile.macosx patching file clean/src/RuntimeSystem/Makefileprofile.macosx patching file clean/src/RuntimeSystem/iprofile.s patching file clean/src/RuntimeSystem/scon.c patching file clean/src/RuntimeSystem/ufileIO2.c ~/clean$ cd clean/src/RuntimeSystem ~/clean/clean/src/RuntimeSystem$ make -f Makefile.macosx [...] ~/clean/clean/src/RuntimeSystem$ file _startup.o _startup.o: Mach-O object i386 ~/clean/clean/src/RuntimeSystem$ make -f Makefileprofile.macosx [...] ~/clean/clean/src/RuntimeSystem$ file _startupProfile.o _startupProfile.o: Mach-O object i386
~/clean/clean/src/RuntimeSystem$ cd .. ~/clean/clean/src$ make ../stdenv/Clean\ System\ Files/_startup.o cp RuntimeSystem/_startup.o ../stdenv/Clean\ System\ Files/_startup.o ~/clean/clean/src$ make ../stdenv/Clean\ System\ Files/_startupProfile.o cp RuntimeSystem/_startupProfile.o ../stdenv/Clean\ System\ Files/_startupProfile.o ~/clean/clean/src$ cd ../.. ~/clean$
Building the Code Generator
In this section, we will build the 64 bit version of the CodeGenerator (while we up till now have forced the i386 version of the rest). This is because some weird compilation error occured later if we don't - having a 64-bit CodeGenerator apparantly solves this.
~/clean$ patch -p0 <clean_mac_codegenerator.patch [...] ~/clean$ cd clean/src/CodeGenerator ~/clean/clean/src/CodeGenerator$ mkdir o ~/clean/clean/src/CodeGenerator$ make -f Makefile.macosx_intel64 [...] ~/clean/clean/src/CodeGenerator$ file cg cg: Mach-O 64-bit executable x86_64
~/clean/clean/src/CodeGenerator$ cd .. ~/clean/clean/src$ make ../exe/cg cp CodeGenerator/cg ../exe/cg ~/clean/clean/src$ cd ../.. ~/clean$
Compiling the system libraries
~/clean$ cd stdenv/Clean\ System\ Files ~/clean/stdenv/Clean System Files$ ../../exe/cg _system ~/clean/stdenv/Clean System Files$ file _system.obj _system.obj: ACB archive data ~/clean/stdenv/Clean System Files$
Compiling patch_bin, clm and clms
We need to install patch_bin correctly first, before compiling clms. Clm will be built automatically while building patch_bin.
~/clean$ patch -p0 <clean_mac_clm.patch patching file clean/src/tools/clm/Makefile.macosx patching file clean/src/tools/clm/clm.c ~/clean$ cd clean/src/tools/clm ~/clean/clean/src/tools/clm$ make -f Makefile.macosx [...] ~/clean/clean/src/tools/clm$ file patch_bin clm patch_bin: Mach-O executable i386 clm: Mach-O executable i386 ~/clean/clean/src/tools/clm$ make -f Makefile.macosx clms [...] ~/clean/clean/src/tools/clm$ file clms clms: Mach-O executable i386 ~/clean/clean/src/tools/clm$ cd ../.. ~/clean/clean/src$ make ../bin/patch_bin cp tools/clm/patch_bin ../bin/patch_bin ~/clean/clean/src$ make ../bin/clm cp tools/clm/clm ../bin/clm [...] ~/clean/clean/src$ cd ../.. ~/clean$
Compiling the linker
~/clean$ patch -p0 <clean_mac_stdenvinclusion.patch Patching file clean/src/Makefile ~/clean$ cd clean/src ~/clean/clean/src$ cp ../exe/cg tools/elf_linker ~/clean/clean/src$ make tools/elf_linker/linker cd tools/elf_linker; \ ../clm/clms -nr -nt -h 20m -s 2m -I ia32 -I ../../libraries/ArgEnvUnix -I ../../compiler/main/Unix -I ../../../stdenv linker -o linker; \ cp linker ../../../exe/linker; \ ../../../bin/clm -nr -nt -h 20m -s 2m -I ia32 -I ../../libraries/ArgEnvUnix -I ../../compiler/main/Unix linker -o linker Generating code for linker Generating code for ArgEnv Generating code for set_return_code Generating code for elf_linker Generating code for StdClass Generating code for StdString B, C, F, I, P or R expected at line 255 (got ) cp: linker: No such file or directory Compiling StdInt Can't find StdInt.icl make: *** [tools/elf_linker/linker] Error 1
And this is the error the Clean2.2 on 64bit Xubuntu ends with, too. Help from the list is required here.
Compiling cocl
TODO
Compiling htoclean
TODO
Installing and wrapping up
TODO