OpenSceneGraphのコンパイル中にエラーが発生した。
エラー内容は以下の通り
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
[ 80%] Building CXX object src/osgPlugins/jp2/CMakeFiles/osgdb_jp2.dir/ReaderWriterJP2.o In file included from /usr/include/jasper/jasper.h:77:0, from /home/packages/OpenSceneGraph/src/osgPlugins/jp2/ReaderWriterJP2.cpp:20: /usr/include/jasper/jas_math.h: 関数 ‘bool jas_safe_size_mul(size_t, size_t, size_t*)’ 内: /usr/include/jasper/jas_math.h:143:15: エラー: ‘SIZE_MAX’ was not declared in this scope if (x && y > SIZE_MAX / x) { ^ /usr/include/jasper/jas_math.h: 関数 ‘bool jas_safe_size_add(size_t, size_t, size_t*)’ 内: /usr/include/jasper/jas_math.h:170:10: エラー: ‘SIZE_MAX’ was not declared in this scope if (y > SIZE_MAX - x) { ^ make[2]: *** [src/osgPlugins/jp2/CMakeFiles/osgdb_jp2.dir/ReaderWriterJP2.o] エラー 1 make[1]: *** [src/osgPlugins/jp2/CMakeFiles/osgdb_jp2.dir/all] エラー 2 make: *** [all] エラー 2 [root@localhost OpenSceneGraph]# make ] make: *** ターゲット `]' を make するルールがありません. 中止. |
調べてみると、どうも/usr/include/jasper/jas_math.hに問題があるらしい。
jas_math.hファイルを一部修正することで解決するらしい。
修正内容は以下の通り。
89行目あたりの以下の部分を修正する。
こちらが修正前
1 2 3 |
#ifdef __cplusplus extern "C" { #endif |
こちらが修正後
1 2 3 4 5 6 |
#ifdef __cplusplus extern "C" { #ifndef SIZE_MAX #define SIZE_MAX ((size_t) - 1) #endif #endif |
これでコンパイルが通るようになった。
焦った〜(^^;