いろいろ動かなくて面白い。
導入方法などは Build 14316 と同じ。こちらの記事で
In future builds, you’ll be asked to create a user account when installing Bash. You’ll then be able to use sudo to elevate your rights within the Linux filesystem/environment
と予言?されていたように、最初にアカウントを作るように求められた。
kyanny@NAGAE_Y:~$ groups kyanny kyanny : kyanny adm cdrom sudo dip plugdev
sudo
グループが sudo 権限 (ALL) つき。
いくつかプログラミング言語を動かしたりしてみた。
go1.6.2
kyanny@NAGAE_Y:~$ go version go version go1.6.2 linux/amd64 kyanny@NAGAE_Y:~$ cat main.go package main import "fmt" func main() { fmt.Println("Hello, World!") } kyanny@NAGAE_Y:~$ go run main.go # command-line-arguments runtime: failed to create new OS thread (have 2 already; errno=22) fatal error: newosproc runtime stack: runtime.throw(0x853790, 0x9) /usr/local/go/src/runtime/panic.go:547 +0x90 runtime.newosproc(0xc82002a000, 0xc820039fc0) /usr/local/go/src/runtime/os1_linux.go:149 +0x18c runtime.newm(0x8c6290, 0x0) /usr/local/go/src/runtime/proc.go:1516 +0x135 runtime.main.func1() /usr/local/go/src/runtime/proc.go:125 +0x2c runtime.systemstack(0xd76300) /usr/local/go/src/runtime/asm_amd64.s:291 +0x79 runtime.mstart() /usr/local/go/src/runtime/proc.go:1051 goroutine 1 [running]: runtime.systemstack_switch() /usr/local/go/src/runtime/asm_amd64.s:245 fp=0xc820024770 sp=0xc820024768 runtime.main() /usr/local/go/src/runtime/proc.go:126 +0x62 fp=0xc8200247c0 sp=0xc820024770 runtime.goexit() /usr/local/go/src/runtime/asm_amd64.s:1998 +0x1 fp=0xc8200247c8 sp=0xc8200247c0 kyanny@NAGAE_Y:~$
Mac OSX El Capitan 上で gox でクロスコンパイルしたバイナリを持っていって実行してみても同じだった(Vagrant/VirtualBox で作った Ubuntu 14.04 上では実行できたバイナリ)
kyanny@NAGAE_Y:~$ ./go-cross-compile/ go-cross-compile_darwin_386 go-cross-compile_netbsd_386 go-cross-compile_darwin_amd64 go-cross-compile_netbsd_amd64 go-cross-compile_freebsd_386 go-cross-compile_netbsd_arm go-cross-compile_freebsd_amd64 go-cross-compile_openbsd_386 go-cross-compile_freebsd_arm go-cross-compile_openbsd_amd64 go-cross-compile_linux_386 go-cross-compile_windows_386.exe go-cross-compile_linux_amd64 go-cross-compile_windows_amd64.exe go-cross-compile_linux_arm run.sh kyanny@NAGAE_Y:~$ ./go-cross-compile/run.sh ./go-cross-compile/run.sh: line 3: ./go-cross-compile_darwin_386: No such file or directory ./go-cross-compile/run.sh: line 4: ./go-cross-compile_darwin_amd64: No such file or directory ./go-cross-compile/run.sh: line 5: ./go-cross-compile_freebsd_386: No such file or directory kyanny@NAGAE_Y:~/go-cross-compile$ ./run.sh ./run.sh: line 3: ./go-cross-compile_darwin_386: cannot execute binary file: Exec format error ./run.sh: line 4: ./go-cross-compile_darwin_amd64: cannot execute binary file: Exec format error ./run.sh: line 5: ./go-cross-compile_freebsd_386: cannot execute binary file: Exec format error ./run.sh: line 6: 77 Segmentation fault (core dumped) ./go-cross-compile_freebsd_amd64 ./run.sh: line 7: ./go-cross-compile_freebsd_arm: cannot execute binary file: Exec format error ./run.sh: line 8: ./go-cross-compile_linux_386: cannot execute binary file: Exec format error runtime: failed to create new OS thread (have 2 already; errno=22) fatal error: newosproc runtime stack: runtime.throw(0x50b5d0, 0x9) /usr/local/Cellar/go/1.5.1/libexec/src/runtime/panic.go:527 +0x90 runtime.newosproc(0xc82002a000, 0xc820039fc0) /usr/local/Cellar/go/1.5.1/libexec/src/runtime/os1_linux.go:150 +0x1ab runtime.newm(0x538f70, 0x0) /usr/local/Cellar/go/1.5.1/libexec/src/runtime/proc1.go:1105 +0x130 runtime.main.func1() /usr/local/Cellar/go/1.5.1/libexec/src/runtime/proc.go:48 +0x2c runtime.systemstack(0x594ae0) /usr/local/Cellar/go/1.5.1/libexec/src/runtime/asm_amd64.s:262 +0x79 runtime.mstart() /usr/local/Cellar/go/1.5.1/libexec/src/runtime/proc1.go:674 goroutine 1 [running]: runtime.systemstack_switch() /usr/local/Cellar/go/1.5.1/libexec/src/runtime/asm_amd64.s:216 fp=0xc820024770 sp=0xc820024768 runtime.main() /usr/local/Cellar/go/1.5.1/libexec/src/runtime/proc.go:49 +0x62 fp=0xc8200247c0 sp=0xc820024770 runtime.goexit() /usr/local/Cellar/go/1.5.1/libexec/src/runtime/asm_amd64.s:1696 +0x1 fp=0xc8200247c8 sp=0xc8200247c0 ./run.sh: line 10: ./go-cross-compile_linux_arm: cannot execute binary file: Exec format error ./run.sh: line 11: ./go-cross-compile_netbsd_386: cannot execute binary file: Exec format error ./run.sh: line 12: 83 Segmentation fault (core dumped) ./go-cross-compile_netbsd_amd64 ./run.sh: line 13: ./go-cross-compile_netbsd_arm: cannot execute binary file: Exec format error ./run.sh: line 14: ./go-cross-compile_openbsd_386: cannot execute binary file: Exec format error ./run.sh: line 15: 86 Segmentation fault (core dumped) ./go-cross-compile_openbsd_amd64 ./run.sh: line 16: ./go-cross-compile_windows_386.exe: cannot execute binary file: Exec format error ./run.sh: line 17: ./go-cross-compile_windows_amd64.exe: cannot execute binary file: Exec format error kyanny@NAGAE_Y:~/go-cross-compile$
rust1.8.0 (stable)
Linux 64bit 用のを curl | sh でインストールしてみたが、 rustc
が segfault して何もできなかった。
kyanny@NAGAE_Y:~$ rustc Segmentation fault (core dumped)
python2.7.6 (builtin)
Go を実行したときのエラーメッセージをみて、 OS スレッドが作れないという制限はほかの言語でもあるのか?と気になったので最初から Bash 環境内にインストール済みだった Python 2.7.6 でマルチスレッドプログラムを走らせてみる。ちなみに Perl 5.8.12 もインストール済みだった。
kyanny@NAGAE_Y:~$ python -V Python 2.7.6 kyanny@NAGAE_Y:~$ cat t.py # -*- coding: utf-8 -*- import threading import time import datetime class TestThread(threading.Thread): def __init__(self): threading.Thread.__init__(self) def run(self): print " === start sub thread ===" for i in range(5): time.sleep(5) print " sub thread : " + str(datetime.datetime.today()) print " === end sub thread ===" if __name__ == "__main__": th = TestThread() th.start() th2 = TestThread() th2.start() th3 = TestThread() th3.start() time.sleep(1) print "=== start main thread ===" for i in range(5): time.sleep(10) print "main thread : " + str(datetime.datetime.today()) print "=== end main thread ===" kyanny@NAGAE_Y:~$ python t.py === start sub thread === === start sub thread === === start sub thread === === start main thread === sub thread : 2016-05-01 15:01:57.477265 sub thread : 2016-05-01 15:01:57.482722 sub thread : 2016-05-01 15:01:57.483245 sub thread : 2016-05-01 15:02:02.479006 sub thread : 2016-05-01 15:02:02.484028 sub thread : 2016-05-01 15:02:02.486608 main thread : 2016-05-01 15:02:03.484343 sub thread : 2016-05-01 15:02:07.481971 sub thread : 2016-05-01 15:02:07.485194 sub thread : 2016-05-01 15:02:07.487769 sub thread : 2016-05-01 15:02:12.483610 sub thread : 2016-05-01 15:02:12.486361 sub thread : 2016-05-01 15:02:12.488906 main thread : 2016-05-01 15:02:13.484920 sub thread : 2016-05-01 15:02:17.485255 === end sub thread === sub thread : 2016-05-01 15:02:17.487762 === end sub thread === sub thread : 2016-05-01 15:02:17.490164 === end sub thread === main thread : 2016-05-01 15:02:23.486541 main thread : 2016-05-01 15:02:33.488207 main thread : 2016-05-01 15:02:43.489786 === end main thread ===
うまくいってしまった。 Python 2.7.6 のスレッドは OS スレッドを使ってないとかそういう事情があるのか?と思ったが、 Ruby と同じく GIL はあるもののちゃんと普通のスレッドのようだ。
node4.4.3
kyanny@NAGAE_Y:~$ ./node-v4.4.3-linux-x64/bin/node -v v4.4.3 kyanny@NAGAE_Y:~$ cat n.js console.log("Hello world"); kyanny@NAGAE_Y:~$ ./node-v4.4.3-linux-x64/bin/node n.js fs.js:549 return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode); ^ Error: Unknown system error -25: Unknown system error -25, open '/home/kyanny/n.js' at Error (native) at Object.fs.openSync (fs.js:549:18) at Object.fs.readFileSync (fs.js:397:15) at Object.Module._extensions..js (module.js:415:20) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Function.Module.runMain (module.js:441:10) at startup (node.js:139:18) at node.js:968:3 kyanny@NAGAE_Y:~$ ./node-v4.4.3-linux-x64/bin/node > Error: Could not open history file. REPL session history will not be persisted. > console.log("Hello world"); Hello world undefined
ファイルは実行できないが REPL は実行できた。
ruby2.3.1
zlib を configure するところでエラーで止まる。マシンが非力なのか configure に時間がかかって待ちが長いのであまり深追いしていない。 mruby1.2.0 もエラーでコンパイルできず。