Io言語をインストールするには

「7つの言語 7つの世界」第3章の学習のために、Io(イオ、アイオー)言語をインストールします。

"Io"で検索すると、ヒット数が多すぎるよ

"Io言語"や"Io Language"で検索してみて

7つの言語 7つの世界

  • Ruby
  • Io
  • Prolog
  • Scala
  • Erlang
  • Cloijure
  • Haskell

公式サイト

io language

Windows 10

公式サイトのzip(v. 20110905)

公式サイトのbinariesページから、Windows Intelのzipをダウンロードします。iobin-win32-current.zip です。

右クリックして「すべて展開(T)...」をクリックします。

展開先の場所を指定して、展開します。

iobin-win32-currentフォルダ下の様子です。IoLanguage-2013.11.05-win32.exeをダブルクリックします。7zipの自己解凍ファイルです。

iobin-win32-currentフォルダ下に、IoLanguageフォルダができました。

iobin-win32-current\libgcc_s_dw2-1.dll を、IoLanguage\binへコピーします。

コマンドプロンプトを起動します。バージョンは v. 20110905でした。

C:> Downloads\iobin-win32-current\IoLanguage\bin\io --version
Io Programming Language, v. 20110905

C:> cd Downloads\iobin-win32-current\IoLanguage\bin
C:> io --version
Io Programming Language, v. 20110905

C:> io
Io 20110905
Io>Code language: DOS .bat (dos)

Ioインタープリタを終了するときは、exitです。

Io> exit
C:>Code language: DOS .bat (dos)

macOS(Mac OS X) 10.15.4

homebrew (v. 20151111)

homebrewでインストールできます。

$ brew info io
io: stable 2017.09.06 (bottled), HEAD
Small prototype-based programming language
http://iolanguage.com/
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/io.rb
==> Dependencies
Build: cmake ✘, pkg-config ✔
==> Options
--HEAD
	Install HEAD version
==> Analytics
install: 34 (30 days), 190 (90 days), 1,035 (365 days)
install-on-request: 32 (30 days), 182 (90 days), 806 (365 days)
build-error: 0 (30 days)

$ brew install ioCode language: Bash (bash)

バージョンは v. 20151111 でした。

$ io --version
Io Programming Language, v. 20151111

$ which io
/usr/local/bin/ioCode language: Bash (bash)

Ioインタープリタを終了するときは、exitです。

Io> exit
$Code language: DOS .bat (dos)

公式サイトのzip (32bitアプリのため動かない)

公式サイトのbinariesページから、OSXのzipをダウンロードして、解凍します。

$ wget http://iobin.suspended-chord.info/mac/iobin-mac-current.zip

$ unzip iobin-mac-current.zip 
Archive:  iobin-mac-current.zip
  inflating: fixio.sh                
  inflating: IoLanguage-20131105-Mac.dmg  
  inflating: license.txt             
  inflating: README.txt              Code language: Bash (bash)

FinderでIoLanguage-20131105-Mac.dmgを表示して、ダブルクリックします。

IoLanguage-20131105-Mac.pkgが表示されるので、ダブルクリックします。

インストーラがスタートするので、表示にしたがって、操作します。

ターミナルを起動して、バージョンを確認します。しかし「Bad CPU type in executable」エラーが。おそらく

$ io --version
-bash: /usr/local/bin/io: Bad CPU type in executableCode language: Bash (bash)

fileで調べると、32bitアプリケーションでした。32bitアプリが動くのは、10.13 High Sierraまでで、10.14 Mojaveからは32bitアプリは動きません。zipファイルからのインストールはできませんでした。

$ file /usr/local/bin/io
/usr/local/bin/io: Mach-O executable i386Code language: Bash (bash)

アンインストールするには

$ pkgutils --forget com.IoLanguage.pkg.IoLanguage

$ rm /usr/local/bin/io
$ rm /usr/local/bin/io2c
$ rm /usr/local/bin/io_static

$ rm '/usr/local/lib/libbasekit.dylib'
$ rm '/usr/local/lib/libcoroutine.dylib'
$ rm '/usr/local/lib/libgarbagecollector.dylib'
$ rm '/usr/local/lib/libiovmall.dylib'
Code language: Bash (bash)

Ubuntu 18.04

公式サイトのzip (v. 20110905)

公式サイトのbinariesページから、Linux x64debのzipをダウンロードして、解凍します。

$ wget http://iobin.suspended-chord.info/linux/iobin-linux-x64-deb-current.zip

$ unzip iobin-linux-x64-deb-current.zip 
Archive:  iobin-linux-x64-deb-current.zip
  inflating: IoLanguage-2013.11.04-Linux-x64.deb  
  inflating: license.txt             
  inflating: README.txt     
Code language: Bash (bash)

aptでインストールします。

$ sudo apt install ./IoLanguage-2013.11.04-Linux-x64.debCode language: Bash (bash)

バージョンは v. 20110905 でした。

$ io --version
Io Programming Language, v. 20110905

$ which io
/usr/local/bin/io
Code language: Bash (bash)

Ioインタープリタを終了するときは、exitです。

Io> exit
$Code language: DOS .bat (dos)

アンインストールするとき、パッケージ名は、iolanguageです。

$ sudo apt remove iolanguage
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています                
状態情報を読み取っています... 完了
以下のパッケージは「削除」されます:
  iolanguage
アップグレード: 0 個、新規インストール: 0 個、削除: 1 個、保留: 0 個。
この操作後に 19.5 MB のディスク容量が解放されます。
続行しますか? [Y/n] Y
(データベースを読み込んでいます ... 現在 266936 個のファイルとディレクトリがインストールされています。)
iolanguage (2013.11.04) を削除しています ...
dpkg: 警告: iolanguage の削除中、ディレクトリ '/usr/local/bin' が空でないため削除できませんでした
dpkg: 警告: iolanguage の削除中、ディレクトリ '/usr/local/lib' が空でないため削除できませんでした
Code language: Bash (bash)

ソースビルド(最終commit 2019-12-17)

https://github.com/IoLanguage/io#linux-build-instructions にしたがって、ソースビルドします。

githubからgit cloneします。

$ git clone --recursive git@github.com:IoLanguage/io.git
Code language: Bash (bash)

cmakeします。

$ cd io/

$ mkdir build

$ cd build/

$ cmake ..
-- The C compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuration set to: DebugFast
-- Performing Test HAVE_POSITIVE_NAN
-- Performing Test HAVE_POSITIVE_NAN - Success
-- rpmbuild binary not found, not building rpm package
-- Configuring done
-- Generating done
-- Build files have been written to: /home/aoki/projects/github/IoLanguage/io/build
Code language: Bash (bash)

buildディレクトリで、makeします。

$ makeCode language: Bash (bash)

make installします。

$ sudo make install
(省略)
Install the project...
-- Install configuration: "DebugFast"
-- Installing: /usr/local/lib/libcoroutine.so
-- Installing: /usr/local/include/io/386-ucontext.h
-- Installing: /usr/local/include/io/Coro.h
-- Installing: /usr/local/include/io/amd64-ucontext.h
-- Installing: /usr/local/include/io/power-ucontext.h
-- Installing: /usr/local/include/io/taskimpl.h
-- Installing: /usr/local/lib/libbasekit.so
-- Installing: /usr/local/include/io/BStream.h
-- Installing: /usr/local/include/io/BStreamTag.h
-- Installing: /usr/local/include/io/Base.h
-- Installing: /usr/local/include/io/CHash.h
-- Installing: /usr/local/include/io/CHash_inline.h
-- Installing: /usr/local/include/io/Common.h
-- Installing: /usr/local/include/io/Common_inline.h
-- Installing: /usr/local/include/io/Date.h
-- Installing: /usr/local/include/io/Duration.h
-- Installing: /usr/local/include/io/DynLib.h
-- Installing: /usr/local/include/io/Hash_fnv.h
-- Installing: /usr/local/include/io/Hash_murmur.h
-- Installing: /usr/local/include/io/Hash_superfast.h
-- Installing: /usr/local/include/io/List.h
-- Installing: /usr/local/include/io/List_inline.h
-- Installing: /usr/local/include/io/MainArgs.h
-- Installing: /usr/local/include/io/PointerHash.h
-- Installing: /usr/local/include/io/PointerHash_inline.h
-- Installing: /usr/local/include/io/PointerHash_struct.h
-- Installing: /usr/local/include/io/PortableGettimeofday.h
-- Installing: /usr/local/include/io/PortableSorting.h
-- Installing: /usr/local/include/io/PortableStdint.h
-- Installing: /usr/local/include/io/PortableStrlcpy.h
-- Installing: /usr/local/include/io/PortableStrptime.h
-- Installing: /usr/local/include/io/PortableTruncate.h
-- Installing: /usr/local/include/io/PortableUsleep.h
-- Installing: /usr/local/include/io/RandomGen.h
-- Installing: /usr/local/include/io/Stack.h
-- Installing: /usr/local/include/io/Stack_inline.h
-- Installing: /usr/local/include/io/UArray.h
-- Installing: /usr/local/include/io/UArray_character.h
-- Installing: /usr/local/include/io/UArray_format.h
-- Installing: /usr/local/include/io/UArray_math.h
-- Installing: /usr/local/include/io/UArray_path.h
-- Installing: /usr/local/include/io/UArray_stream.h
-- Installing: /usr/local/include/io/UArray_string.h
-- Installing: /usr/local/include/io/UArray_utf.h
-- Installing: /usr/local/include/io/cdecode.h
-- Installing: /usr/local/include/io/cencode.h
-- Installing: /usr/local/include/io/utf8.h
-- Installing: /usr/local/include/io/utf8internal.h
-- Installing: /usr/local/include/io/utf_convert.h
-- Installing: /usr/local/lib/libgarbagecollector.so
-- Set runtime path of "/usr/local/lib/libgarbagecollector.so" to ""
-- Installing: /usr/local/include/io/Collector.h
-- Installing: /usr/local/include/io/CollectorMarker.h
-- Installing: /usr/local/include/io/CollectorMarker_inline.h
-- Installing: /usr/local/include/io/Collector_inline.h
-- Installing: /usr/local/lib/libiovmall.so
-- Set runtime path of "/usr/local/lib/libiovmall.so" to ""
-- Installing: /usr/local/include/io/IoBlock.h
-- Installing: /usr/local/include/io/IoCFunction.h
-- Installing: /usr/local/include/io/IoCall.h
-- Installing: /usr/local/include/io/IoCollector.h
-- Installing: /usr/local/include/io/IoCompiler.h
-- Installing: /usr/local/include/io/IoConfig.h
-- Installing: /usr/local/include/io/IoContext.h
-- Installing: /usr/local/include/io/IoCoroutine.h
-- Installing: /usr/local/include/io/IoDate.h
-- Installing: /usr/local/include/io/IoDebugger.h
-- Installing: /usr/local/include/io/IoDirectory.h
-- Installing: /usr/local/include/io/IoDuration.h
-- Installing: /usr/local/include/io/IoDynLib.h
-- Installing: /usr/local/include/io/IoError.h
-- Installing: /usr/local/include/io/IoFile.h
-- Installing: /usr/local/include/io/IoFile_stat.h
-- Installing: /usr/local/include/io/IoInstallPrefix.h
-- Installing: /usr/local/include/io/IoLexer.h
-- Installing: /usr/local/include/io/IoList.h
-- Installing: /usr/local/include/io/IoMap.h
-- Installing: /usr/local/include/io/IoMessage.h
-- Installing: /usr/local/include/io/IoMessage_inline.h
-- Installing: /usr/local/include/io/IoMessage_opShuffle.h
-- Installing: /usr/local/include/io/IoMessage_parser.h
-- Installing: /usr/local/include/io/IoNumber.h
-- Installing: /usr/local/include/io/IoObject.h
-- Installing: /usr/local/include/io/IoObject_flow.h
-- Installing: /usr/local/include/io/IoObject_inline.h
-- Installing: /usr/local/include/io/IoObject_struct.h
-- Installing: /usr/local/include/io/IoProfiler.h
-- Installing: /usr/local/include/io/IoSandbox.h
-- Installing: /usr/local/include/io/IoSeq.h
-- Installing: /usr/local/include/io/IoSeq_immutable.h
-- Installing: /usr/local/include/io/IoSeq_inline.h
-- Installing: /usr/local/include/io/IoSeq_mutable.h
-- Installing: /usr/local/include/io/IoSeq_vector.h
-- Installing: /usr/local/include/io/IoState.h
-- Installing: /usr/local/include/io/IoState_callbacks.h
-- Installing: /usr/local/include/io/IoState_coros.h
-- Installing: /usr/local/include/io/IoState_debug.h
-- Installing: /usr/local/include/io/IoState_eval.h
-- Installing: /usr/local/include/io/IoState_exceptions.h
-- Installing: /usr/local/include/io/IoState_inline.h
-- Installing: /usr/local/include/io/IoState_symbols.h
-- Installing: /usr/local/include/io/IoSystem.h
-- Installing: /usr/local/include/io/IoTag.h
-- Installing: /usr/local/include/io/IoTag_inline.h
-- Installing: /usr/local/include/io/IoToken.h
-- Installing: /usr/local/include/io/IoVM.h
-- Installing: /usr/local/include/io/IoVMApi.h
-- Installing: /usr/local/include/io/IoVersion.h
-- Installing: /usr/local/include/io/IoWeakLink.h
-- Installing: /usr/local/include/io/PHash.h
-- Installing: /usr/local/include/io/PHash_inline.h
-- Installing: /usr/local/include/io/PHash_struct.h
-- Installing: /usr/local/bin/io
-- Set runtime path of "/usr/local/bin/io" to "/usr/local/lib"
-- Installing: /usr/local/bin/io_static
-- Set runtime path of "/usr/local/bin/io_static" to "/usr/local/lib"
------------Installing Eerie------------
Configuring for [markdown]
checking the C compiler (cc -fPIC) oh ick, it looks like gcc
Looking for cpp (using $CC -E as a cpp pipeline)
looking for install (/usr/bin/install)
Checking __attribute__((__destructor__)) (yes)
looking for ar (/usr/bin/ar)
looking for ranlib (/usr/bin/ranlib)
looking for pkg-config (/usr/bin/pkg-config)
checking for "volatile" keyword (found)
checking for "const" keyword (found)
Checking for "inline" keyword (found)
defining WORD & DWORD scalar types (using standard types in <inttypes.h>)
looking for a reentrant basename (found)
looking for header libgen.h (found)
looking for header stdlib.h (found)
looking for the alloca function (found in alloca.h)
looking for header sys/types.h (found)
looking for header pwd.h (found)
looking for the getpwuid function (found)
looking for header sys/stat.h (found)
looking for the stat function (found)
special file macros in sys/stat.h: S_ISSOCK S_ISCHR S_ISFIFO.
looking for the srandom function (found)
looking for the memset function (found)
looking for the random function (found)
looking for the strcasecmp function (found)
looking for the strncasecmp function (found)
looking for the fchdir function (found)
looking for header malloc.h (found)
looking for find (/usr/bin/find)
looking for "ln -s" (/bin/ln)
looking for ar (/usr/bin/ar)
looking for ranlib (/usr/bin/ranlib)
looking for sed (/bin/sed)
generating Makefile
generating version.c
generating mkdio.h
generating libmarkdown.pc
-> Install Eerie
 - Fetching Eerie
 - Resolving dependencies for Eerie
-> Install Kano
 - Fetching Kano
 - Resolving dependencies for Kano
 - Installing Kano...
-> Install Docio
 - Fetching Docio
 - Resolving dependencies for Docio
-> Install Markdown
 - Fetching Markdown
 - Resolving dependencies for Markdown
 - Installing Markdown...
 - Compiling source files...
mkdir -p _build/headers
mkdir -p _build/lib
mkdir -p _build/dll
 - Installing Docio...
 - Installing Eerie...
----
Make sure to update your shell's environment variables before using Eerie.
Here's a sample code you could use:
# Eerie config
EERIEDIR=/home/aoki/.eerie
PATH=$PATH:$EERIEDIR/base/bin:$EERIEDIR/activeEnv/bin
export EERIEDIR PATH
# End Eerie config
 --- Done! --- 

Code language: HTML, XML (xml)

インストールメッセージの最後に、環境変数EERIEDIR、PATHを設定してください、と表示されています。.bashrc の最後に追加して、ターミナルを閉じて、開きます。

# Eerie config
EERIEDIR=/home/aoki/.eerie
PATH=$PATH:$EERIEDIR/base/bin:$EERIEDIR/activeEnv/bin
export EERIEDIR PATH
# End Eerie config
Code language: Bash (bash)

~/.eerie がroot:rootで、後ほどのRandomライブラリのインストール時に書き込み権限がないので、インストールできません。所有者とグループを自身に変更します。

$ sudo chown --recursive $(whoami):$(whoami) ~/.eerie/
Code language: JavaScript (javascript)

バージョンは「v. 20170906」と表示されました。

$ which io
/usr/local/bin/io

$ io --version
Io Programming Language, v. 20170906

$ io
Io 20170906
Io> Code language: Bash (bash)

gitのmasterブランチを見ると、最新commitは2019-12-17、Releaseの2019.05.22-alphaタグも含まれていました。20170906以降、正式リリースがないので、IoVersion.hのIO_VERSION_STRINGが"20170906"のままなんですね。

$ cat ./libs/iovm/source/IoVersion.h
#ifndef IO_VERSION_STRING
#define IO_VERSION_STRING "20170906"
#endif
Code language: Bash (bash)

Ioインタープリタを終了するときは、exitです。

Io> exit
$Code language: DOS .bat (dos)

アンインストール用スクリプト、io_uninstall.shとして保存します。

#!/bin/bash -eux

rm -rf /usr/local/lib/libcoroutine.so
rm -rf /usr/local/lib/libbasekit.so
rm -rf /usr/local/lib/libgarbagecollector.so
rm -rf /usr/local/lib/libiovmall.so
rm -rf /usr/local/include/io
rm -rf /usr/local/bin/io
rm -rf /usr/local/bin/io_static
Code language: Bash (bash)
$ chmod +x io_uninstall.sh
$ sudo io_uninstall.shCode language: Bash (bash)

Randomオブジェクトや、URLオブジェクトは使えないのかな?

eerieパッケージマネージャでインストールします。

まず、Randomライブラリをインストールします。p62のセルフスタディ2日目の8問目、1〜100のランダム数の生成でRandomオブジェクトを使います。

$ eerie install https://github.com/IoLanguage/Random.gitCode language: Bash (bash)

次に、Socketライブラリをインストールします。p69で、URLオブジェクトを使います。

$ eerie install https://github.com/IoLanguage/Socket.git
Code language: Bash (bash)

"Protocol 'https' unsupported"エラーだよ

httpsをfetchすると、"Protocol 'https' unsupported"となってしまいます。Socketオブジェクトは、httpsに対応していないようです。

Io> s := URL with("https://www.ninton.co.jp") fetch
==>  Error_0x55dd601486b0:
  location         = "/home/aoki/.eerie/activeEnv/addons/Socket/io/URL.io:232"
  message          = "Protocol 'https' unsupported"
Code language: Bash (bash)

http://iolanguage.com で試しましょう。

Io> s := URL with("http://iolanguage.com") fetch
==> <!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<title>io language</title>
(省略)Code language: Bash (bash)

Socketライブラリをインストールしようとしたら、Process 25598 has lock. Waiting for process to finish… ばかりで、先に進まないんだけど

まず、何回かCtrl + Cを入力して中止してください。次に、~/.eerie/.transaction_lockを削除してから、インストールしてみてください。

$ eerie install https://github.com/IoLanguage/Socket.git
 ! [2020-06-12 02:55:02 JST] Process 25598 has lock. Waiting for process to finish...
 ! [2020-06-12 02:55:07 JST] Process 25598 has lock. Waiting for process to finish...
^C
IOVM:
	Received signal. Setting interrupt flag.
 - Reverting config before interrupt.
 ! [2020-06-12 02:55:11 JST] Process 25598 has lock. Waiting for process to finish...
^C
IOVM:
	Received signal. Setting interrupt flag.
^C
IOVM:
	Second signal received before first was handled. 
	Assuming control is stuck in a C call and isn't returning
	to Io so we're exiting without stack trace.

$ rm ~/.eerie/.transaction_lock

$ eerie install https://github.com/IoLanguage/Socket.git
-> Install Socket
 - Fetching Socket
 - Resolving dependencies for Socket
 - Installing Socket...
 - Compiling source files...
mkdir -p _build/headers
mkdir -p _build/lib
mkdir -p _build/dll

Code language: Bash (bash)
タイトルとURLをコピーしました