SML#をMacにインストールした時のメモ †SML#とは †SML#は東北大学天気通信研究所が開発を進めているプログラミング言語。 SML#ではStandard MLとの後方互換性, C言事の直接連携, マルチコアCPU上のネイティブスレッドサポートなどの特徴があるプログラミング言語。バックエンドにLLVMを使用している。 SML#のインストール †SML#のインストールには 32bitのGMP(https://gmplib.org )とLLVM3.4(http://llvm.org/releases )が必要 GMPの32bit版インストール †% ./configure ABI=32 --prefix=インストール先 % make -j % make install 既存のGMPライブラリとの衝突を防ぐために --prefix オプションをつけると良い. LLVM3.4の32bit版インストール †configure時に % ./configure CC='gcc -m32' CXX='g++ -m32' ..... とつけるそれ以外は基本的にLLVM を参照 SML#のインストール †% ./configure CC='gcc -m32' CXX='g++ -m32' LD='ld -m elf_i386' LDFLAG="-L/インストールしたGMPのlibへのPATH" --prefix= % make -j % make install でprefix先に bin, libが出来る % prefix/bin/smlsharp でsml#の対話モードが立ち上がる % prefix/bin/smlsharp example.sml でsml#プログラムをコンパイルできる lldbで追う(Cで書かれている部分だけ) †SML#のコンパイラはSML#で書かれているため、lldbでは追うことができない。 ランタイムLibraryはCで書かれているためそれは追うことが可能。 % lldb prefix/bin/smlsharp int.sml (lldb) target create "../build/bin/smlsharp" maiCurrent executable set to '../build/bin/smlsharp' (i386). (lldb) settings set -- target.run-args "int.sml" (lldb) b main Breakpoint 1: where = smlsharp`main + 12 at main.c:16, address = 0x0000270c (lldb) r Process 1939 launched: '../build/bin/smlsharp' (i386) Process 1939 stopped * thread #1: tid = 0x1dcb20, 0x0000270c smlsharp`main(argc=2, argv=0xbffff9fc) + 12 at main.c:16, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1 frame #0: 0x0000270c smlsharp`main(argc=2, argv=0xbffff9fc) + 12 at main.c:16 13 int 14 main(int argc, char **argv) 15 { -> 16 sml_init(argc, argv); 17 _SMLmain(); 18 sml_finish(); 19 return 0; |