LoginSignup
2
2

More than 3 years have passed since last update.

OpenPoseのビルドで#error -- unsupported GNU version!が出たときの対処法

Last updated at Posted at 2020-08-24

状況

私はOpenPoseをビルドしようとしたときにこのエラーに遭遇しました。その時どのように対処したかについてこの記事にまとめます。

なお、この記事ではOpenPoseのビルドの仕方については説明しません

環境

環境 バージョン
OS Linux(Pop_OS) 20.04
CUDA 10.2

エラー文の内容

OpenPoseをビルドするために次のようにコマンドを実行しました。

# 予めcloneしておく
$ mkdir build && cd build
$ ccmake .. # ここでどのようにビルドするか設定します。公式ではguiを使っていた気がします。
$ make -j`nproc`

すると、次のようなエラーが出るようになりました。

/usr/lib/cuda/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!
      |  ^~~~~

これは、gccのバージョンが新しすぎると起きるエラーのようです。
今回は「gcc-8までしかサポートしていませんよ」というふうに表示されています。

私の環境ではgcc-9が使われていたのでそれが問題だとわかりました。

対処法

予めgcc-8をインストールし、ビルドするとき次のように実行します。

$ CC=gcc-8 CXX=g++-8 ccmake .. # ここでどのようにビルドするか設定します。公式ではguiを使っていた気がします。
$ make CC=gcc-8 CXX=g++-8 -j`nproc`

こうしておくと自動的にコンパイルにgcc-8が使われるようになり、コンパイルができるようになります。

参考文献

CUDA incompatible with my gcc version
https://stackoverflow.com/questions/6622454/cuda-incompatible-with-my-gcc-version

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