pdftoppmでPDF→画像にする

PDFファイルのサムネイル画像を作りたいときとか、今までだと、Imagemagickのconvertコマンドで作れていたのだが、最近のバージョンでは convertコマンドの脆弱性対応で、設定ファイルを変更しないと使えなくなってしまっている。なので、手軽な別な手段が必要になるのだが、画像変換するだけならpdftoppmコマンドが使えそうである。

pdftoppmコマンドを利用するために

$ sudo apt install xpdf

という感じで、xpdfをインストールする。あとは

$ pdftoppm -png test.pdf test

のようにすると、test-1.pngのようなファイルが生成される。

nvccでgccのバージョンエラー

nvccがgccのバージョンに依存しているので、新しいgccを使っていたりすると、cudaのバージョンによっては以下のような感じのエラーになる。

$ nvcc -o add_cuda add.cu
In file included from /usr/local/cuda/bin/../targets/x86_64-linux/include/cuda_runtime.h:83,
from :
/usr/local/cuda/bin/../targets/x86_64-linux/include/crt/host_config.h:138:2: error: #error -- unsupported GNU version! gcc versions later than 8 are not supported!
138 | #error -- unsupported GNU version! gcc versions later than 8 are not supported!

この場合だと、

$ sudo apt install g++-8

として、gcc 8をインストールして、nvccコマンドを以下のように実行すればコンパイルできる。

$ nvcc -o add_cuda add.cu -ccbin g++-8