DevIL icon indicating copy to clipboard operation
DevIL copied to clipboard

gcc5 build issue using restrict in C++ code

Open ilovezfs opened this issue 8 years ago • 1 comments

libtool: compile:  gcc-5 -DHAVE_CONFIG_H -I. -I../include/IL -I ./../src-IL/include -I ./../include -std=gnu99 -fgnu89-inline -msse -msse2 -msse3 -g -O2 -c ./../src-IL/src/il_bits.c -o libIL_la-il_bits.o >/dev/null 2>&1
In file included from ./../src-IL/src/il_exr.cpp:14:0:
./../src-IL/include/il_internal.h:230:54: error: expected ',' or '...' before 'FileName'
 ILboolean ilIsValidBmp(ILconst_string CONST_RESTRICT FileName);
                                                      ^
make[1]: *** [libIL_la-il_exr.lo] Error 1
make[1]: *** Waiting for unfinished jobs....

https://github.com/Homebrew/homebrew/issues/40442

Workaround found thanks to https://github.com/arpg/SceneGraph/issues/10#issuecomment-110850184

It seems that NetBSD has been patching this now for a while: http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/devel/devIL/patches/patch-include_IL_il.h http://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/devel/devIL/patches/patch-include_IL_il.h

The NetBSD patch works on OS X as well, allowing devil to build with gcc5.

Homebrew in-formula patch:

    inreplace "include/IL/il.h",
      "#ifdef RESTRICT_KEYWORD",
      "#if defined(RESTRICT_KEYWORD) && !defined(__cplusplus)"

ilovezfs avatar May 04 '16 15:05 ilovezfs

https://github.com/DentonW/DevIL/commit/290cdc1f4e1beb19709cc95689444115dcc52ce8#diff-e0a4fc9ac21e1aacac1a5c6ea223cc62R66

abma avatar Jan 24 '17 00:01 abma