LoginSignup
2
1

More than 5 years have passed since last update.

Denite file_rec でマッチャーが機能しない | nixprime/cpsmのビルド方法

Last updated at Posted at 2017-11-29

序章

NeoVimでDenite file_recをしてる時にcpsmマッチャーがうまく機能していないっぽかったので、手動でcpsmのビルドを試みてみた。というおはなし。

原因がcpsmだと分かったきっかけ

:messageをしたらcpsmが原因っぽいエラー出力があった。
何事もverboseなログ出力コマンドは知っておくべきですね。

解決手順

まずは普通にinstall.shを用いて手動ビルドを試す。

sh
cd /path/to/cpsm
./install.sh

エラー。

エラー出力
PY3 not specified; 
inferring Python version from vim script: 
    cannot set signal handler: 
        Function not implemented script: 
            cannot set signal handler: Function not implemented
                ./install.sh: line 26: [: : integer expression expected
                ./install.sh: line 29: [: : integer expression expected
ERROR: No Python support detected

PY3が特定できなかったのでvim scriptから推測?
期待されていない整数?
Pythonのサポートが検知されない?
「知らんけどPY3って文字見たことあるな...そう言えばPY3=ONってdein_lazy.tomlに書いたわ。なるほど?まぁ、よくわからんが大文字だけの変数らしきものって大抵環境変数なんだよね~」
...とアホな推理をしてexport PY3=ON && ./install.shとかすると、ダメな選択な癖して先に進めてしまうので、どんどん泥沼にハマっていってしまいます。

正解は、envコマンドです。
envコマンドとは、環境を変更してコマンドを実行するコマンドです。

使い方
env [env_name]=[value] [command]

今回はこのコマンドを使用して、Python3を使用した環境ですよ~と伝えた状態で./install.shしてみましょう。

env PY3=ON ./install.sh

すると、またエラーがでてきます。
しかも今度は量がめちゃくちゃあります。

こういう時はとある定石がひとつあります。
それは、READMEを読むことです。

README大事。ホントに。

README
Requirements
------------

- Vim 7.4, compiled with the `+python` flag.

- A C++ compiler supporting C++11.

- Boost (Ubuntu: package `libboost-all-dev`).

- CMake (Ubuntu: package `cmake`).

- Python headers (Ubuntu: package `python-dev`).

- Optional, required for Unicode support: ICU (Ubuntu: package `libicu-dev`).

Pyenv users on Mac OS X: cpsm requires dynamic Python libraries, which pyenv
does not build by default. If CMake indicates that it's using static libraries,
e.g.:

\```
-- Found PythonLibs: /Users/<username>/.pyenv/versions/3.5.2/lib/python3.5/config-3.5m/libpython3.5m.a
\```

Rebuild with dynamic library support by running `env
PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install <version>`.

Python 3 Support
----------------

If your Vim is compiled against Python 3 instead (`+python3` flag) the install
script should detect this in most cases and everything should just work. You may
need different python headers installed (e.g. `python3-dev` on Ubuntu).

If the detection does not work for any reason you can set `PY3=ON` or `PY3=OFF`
as appropriate when running `./install.sh` to override it.

どうやら今回はBoostというものが足りてなかったみたいです。(地味にちゃんとPY3=ONの話も書いてありますね。env PY3=ONと書かれていないのは不親切な気もしますが。)
なので、それを入れてからもう一度試してみましょう。

apt -y install libboost-all-dev
env PY3=ON ./install.sh

成功しました!
ちゃんとマッチャーとして機能していますね!
わーい!

2
1
0

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
2
1