LoginSignup
0
1

More than 5 years have passed since last update.

jqをmakeする

Last updated at Posted at 2017-04-19

はじめに

jqを apt-get install jqでインストールしようとしたらそんなものはいないと怒られた。

# apt-get install jq
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package jq

はい。

Debianのリポジトリをチェックしてみると存在はしてそう( https://packages.debian.org/jessie/jq )。
(おそらく)Debianのバージョンが低いとかその辺で問題が起こっていそう(確証なし)。

makeします。

環境

Debian 7.8

手順

基本的に公式( https://stedolan.github.io/jq/download/ )の「From source on Linux, OS X, Cygwin, and other POSIX-like operating systems」の項目に従えば良いのですが、たまにライブラリが足りなかったりとエラーが出るので適宜追加していきます。

# apt-get update
(略)
# git clone https://github.com/stedolan/jq.git
(略)
# cd jq
(略)
# autoconf -i
-bash: autoconf: command not found

はい。

autoconfを入れましょう。
下記サイトを参照しました。
https://askubuntu.com/questions/265471/autoreconf-not-found-error-during-making-qemu-1-4-0/490839

# apt-get install autoconf
(略)
# autoconf -i
configure.ac:17: installing `config/ar-lib'
configure.ac:26: installing `config/compile'
configure.ac:15: installing `config/install-sh'
configure.ac:15: installing `config/missing'
Makefile.am:48: Libtool library used but `LIBTOOL' is undefined
Makefile.am:48:   The usual way to define `LIBTOOL' is to add `LT_INIT'
Makefile.am:48:   to `configure.ac' and run `aclocal' and `autoconf' again.
Makefile.am:48:   If `LT_INIT' is in `configure.ac', make sure
Makefile.am:48:   its definition is in aclocal's search path.
Makefile.am: installing `config/depcomp'
configure.ac: installing `config/ylwrap'
autoreconf: automake failed with exit status: 1

はい。

autoconfが使うLIBTOOLが入っていないみたいです(全然わかっていない)。
入れましょう。

# apt-get install libtool
(略)
# autoconf -i
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `config'.
libtoolize: copying file `config/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `config/m4'.
libtoolize: copying file `config/m4/libtool.m4'
libtoolize: copying file `config/m4/ltoptions.m4'
libtoolize: copying file `config/m4/ltsugar.m4'
libtoolize: copying file `config/m4/ltversion.m4'
libtoolize: copying file `config/m4/lt~obsolete.m4'
configure.ac:25: installing `config/config.guess'
configure.ac:25: installing `config/config.sub'

# ./configure --disable-maintainer-mode
(略)
checking oniguruma.h presence... no
checking for oniguruma.h... no
configure: Oniguruma was not found. Will use the packaged oniguruma.
configure: creating ./config.status
config.status: creating Makefile
config.status: executing depfiles commands
config.status: executing libtool commands

onigurumaが見つからないなどと不穏なことを言っている気がしますが、気にせず make しちゃいましょう。

# make
  GEN    src/builtin.inc
  GEN    src/version.h
make  all-recursive
make[1]: Entering directory `/foobar/jq'
Making all in modules/oniguruma
make[2]: Entering directory `/foobar/jq/modules/oniguruma'
make[2]: *** No rule to make target `all'.  Stop.
make[2]: Leaving directory `/foobar/jq/modules/oniguruma'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/foobar/jq'
make: *** [all] Error 2

はい。

onigurumaが無いと怒ってますね。気にしてあげましょう。

# apt-get install libonig-dev
(略)

入りましたね! 間髪入れずに make しましょう!

# make
  GEN    src/builtin.inc
  GEN    src/version.h
make  all-recursive
make[1]: Entering directory `/foobar/jq'
Making all in modules/oniguruma
make[2]: Entering directory `/foobar/jq/modules/oniguruma'
make[2]: *** No rule to make target `all'.  Stop.
make[2]: Leaving directory `/foobar/jq/modules/oniguruma'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/foobar/jq'
make: *** [all] Error 2

駄目ですね! 間髪を入れてあげましょう、具体的には # ./configure --disable-maintainer-mode を再実行します。

# ./configure --disable-maintainer-mode
(略)
checking oniguruma.h usability... yes
checking oniguruma.h presence... yes
checking for oniguruma.h... yes
(略)

oniguruma周りでエラーが出なくなっていますね、うまくいってそうです。
make しましょう。

# make
(略)
# make install
(略)
# jq --version
jq-1.5rc2-233-g4b4cf78

jq コマンドが使えるようになりました!
お疲れ様でした。ゆっくり休みましょう。

参考資料

主に以下のページを参考にしました。ありがとうございます。
http://blog.pg1x.com/entry/2014/11/09/232916
http://qiita.com/momosuke4989/items/1fa5b7e908fe4d6947cb

以上。

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