C library(glibc)由来のヘッダファイル(/usr/includeおよび/usr/include/sys)の定義とカーネルヘッダ(/usr/include/linux)のヘッダファイルの定義が衝突するとき。たとえば、以下のようなエラーがでる。
In file included from /usr/include/stdlib.h:438, from ethlinkstat.c:10: /usr/include/sys/types.h:62: error: conflicting types for 'dev_t' /usr/include/linux/types.h:27: error: previous declaration of 'dev_t' was here /usr/include/sys/types.h:72: error: conflicting types for 'mode_t' /usr/include/linux/types.h:33: error: previous declaration of 'mode_t' was here /usr/include/sys/types.h:77: error: conflicting types for 'nlink_t' /usr/include/linux/types.h:36: error: previous declaration of 'nlink_t' was here In file included from /usr/include/sys/types.h:133, from /usr/include/stdlib.h:438, from ethlinkstat.c:10: /usr/include/time.h:105: error: conflicting types for 'timer_t' /usr/include/linux/types.h:45: error: previous declaration of 'timer_t' was here In file included from /usr/include/sys/types.h:220, from /usr/include/stdlib.h:438, from ethlinkstat.c:10: /usr/include/sys/select.h:78: error: conflicting types for 'fd_set' /usr/include/linux/types.h:24: error: previous declaration of 'fd_set' was here In file included from /usr/include/stdlib.h:438, from ethlinkstat.c:10: /usr/include/sys/types.h:235: error: conflicting types for 'blkcnt_t' /usr/include/linux/types.h:158: error: previous declaration of 'blkcnt_t' was here
私の場合は int64_tの定義が stdint.h, linux/types.h, sys/types.h の間で衝突して、コンパイルができなくなっていた。
で、上のリンクへのコメントのとおりにしたら、うまく言った。具体的には、stdint.hとsys/types.hの呼び出しをlinux/types.hの前に行うこと。注意点は、いくつかのヘッダファイルを経由してlinux/types.hが呼び出される場合があるのでそれも留意すること。
Bug #144205 [1] should be of interest here. Basically you need to include
before .