大学の課題がPDFで渡されるのでEmacsで見ながらC言語かけたらいいなーって思ってpdf-tools入れたら時間かかったのでメモ。
環境
OSX Yosemite
バージョン 10.10.1
入れてみる
Github:axot/pdf-tools
を参考にしつつpdf-tools入れようとしたらコケた
依存関係にあるものをHomebrewで入れていざコンパイル
...
...
...
poppler周りでコケる。
export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig
上のコマンドで解決するらしいので、再びコンパイル
$ cd /path/to/pdf-tools
$ ./autogen.sh
(省略)
$ ./congiure
(省略)
$ make
Making all in src
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-am
gcc -DHAVE_CONFIG_H -I. -I/usr/local/Cellar/glib/2.42.1/include/glib-2.0 -I/usr/local/Cellar/glib/2.42.1/lib/glib-2.0/include -I/usr/local/opt/gettext/include -D_REENTRANT -I/opt/X11/include/cairo -I/opt/X11/include/pixman-1 -I/opt/X11/include -I/opt/X11/include/freetype2 -I/opt/X11/include/libpng15 -I/opt/X11/include -I/usr/local/Cellar/poppler/0.29.0/include/poppler/glib -I/usr/local/Cellar/poppler/0.29.0/include/poppler -I/usr/local/Cellar/glib/2.42.1/include/glib-2.0 -I/usr/local/Cellar/glib/2.42.1/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/poppler/0.29.0/include/poppler -w -g -O2 -MT epdfinfo.o -MD -MP -MF .deps/epdfinfo.Tpo -c -o epdfinfo.o epdfinfo.c
In file included from epdfinfo.c:33:
./epdfinfo.h:121:13: error: conflicting types for 'poppler_annot_set_rectangle'
extern void poppler_annot_set_rectangle (PopplerAnnot*, PopplerRectangle);
^
/usr/local/Cellar/poppler/0.29.0/include/poppler/glib/poppler-annot.h:189:31: note:
previous declaration is here
void poppler_annot_set_rectangl...
^
epdfinfo.c:1887:44: error: passing 'PopplerRectangle' (aka 'struct
_PopplerRectangle') to parameter of incompatible type 'PopplerRectangle *'
(aka 'struct _PopplerRectangle *'); remove *
poppler_annot_set_rectangle (pannot, *area);
^~~~~
/usr/local/Cellar/poppler/0.29.0/include/poppler/glib/poppler-annot.h:190:29: note:
passing argument to parameter 'poppler_rect' here
...PopplerRectangle *poppler_rect);
^
2 errors generated.
make[2]: *** [epdfinfo.o] Error 1
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1
エラーが大量(涙目)
仕方なくネットの海を彷徨うこと数時間...
解決方法を見つけました
ここを参考にファイルを編集
そしたら無事にコンパイル通りました。一件落着。
PDF表示できるようになりました。
ただ、pdf-misc-auto-fit-minor-modeが上手く動作しないようでウィンドウサイズにPDFが合わされず、ウィンドウ分割すると見難い(悲しい)