LoginSignup
1
0

More than 3 years have passed since last update.

Termux上でvimをコンパイルしたかった

Posted at

お気持ちの経緯

Termuxはandroid系で動く仮想LinuxCUI環境みたいなもの、どんな中身をしているかは未だによくわからん。
「Androidでvim動かせる幸せ~」みたいな空気吸って生きてるけどtermuxで配ってるvimはluaやrubyがコンパイルされていないからふと欲しいと思ったプラグインが動かなかったりする。
そこでtermux上でvimのコンパイルをしてみたい。書きながら試しているので出来なかったらお蔵入りします。

つまり何をするのか

termux上でvim --version | grep rubyと叩いたときに

+cscope            +localmap          -ruby              +wildmenu

って表示される人のうち、-ruby+rubyに直したい人。

vimのソースコードをインストール

まずはここから。
svnとかwgetとかでソースコードをインストールできるがこの場合vimのバージョンを指定しないといけない。そういうのはめんどくさい。
gitコマンドでインストールすると自動で最新のバージョン(今日の時点だと8.1)を入れてくれるのでそれに頼る。古いバージョンでやりたいという人は他のコマンドでやればいいと思う。

$cd .vim
$git clone https://github.com/vim/vim.git

./configureする

インストールされたファイル群にconfigureという名前の実行ファイルがある。これに好きな引数を渡してやると渡した引数に関連する言語がvimにコンパイルされる(らしい)。

$./configure --with-features=huge --enbale-multibyte --enable-rubyinterp

これが終わったらmakeをコマンド、その後make installを実行するとうまく行くらしい。簡単ですね

$make
$make install

うまくいかない

なんで

clang-8: error: linker command failed with exit code 1 (use -v to see invocation)
link.sh: Linking failed
make[1]: *** [Makefile:2084: vim] Error 1
make[1]: Leaving directory '/data/data/com.termux/files/home/.vim/vim/src'
make: *** [Makefile:29: first] Error 2

まったくわからん.記事を読み漁るとruby-develが必要みたいなことが書いてあったので入れてみる.

ruby-develなんてないぞ!!!!!!どうなってんだ!!!!!!!

termux上でapt-get install ruby-develを叩くと

$ apt-get install ruby-devel
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package ruby-devel

って言われる.「ruby-devだよ~」っていう記事を見かけたのでそっちを打ち直すと

$ apt-get install ruby-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package ruby-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  ruby

E: Package 'ruby-dev' has no installation candidate

とのこと.termux上だとruby-develがパッケージとして存在しないのかな?詰んだ.

試しに他の言語で試してみる,perlみたいな

やっぱり信頼できるのはperlですよ.なので同じことをperlでもやってみる.
./configure --features=huge --enable-multibyte --enable-perlinterpを叩いてみる.これがまた時間がかかる.
なんかスムーズにいったのでmakemake installを叩いてみる.

結果

$ make install
Starting make in the src directory.
If there are problems, cd to the src directory and run make there
cd src && make install
make[1]: Entering directory '/data/data/com.termux/files/home/.vim/vim/src'
/bin/sh install-sh -c -d /usr/local
mkdir: can't create directory '/usr/': Read-only file system
mkdir: can't create directory '/usr/': Read-only file system
make[1]: *** [Makefile:2668: /usr/local] Error 1
make[1]: Leaving directory '/data/data/com.termux/files/home/.vim/vim/src'
make: *** [Makefile:39: install] Error 2

???????????????????????????????????????????????????????????????
指示通り./srcに入ってからもう一回makeを叩いてみる

$ pwd
/data/data/com.termux/files/home/.vim/vim/src
$ make
$ make install
/bin/sh install-sh -c -d /usr/local
mkdir: can't create directory '/usr/': Read-only file system
mkdir: can't create directory '/usr/': Read-only file system
make: *** [Makefile:2668: /usr/local] Error 1

?????????????????????????????????????????????????????????????????????????????????????????????????????????????
'/usr/'って/data/data/com/termux/files/usrのこと??????????そこ755にしてもできないんですけど??????

termux一生分からん

1
0
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0