MATLAB can only work with GCC6.3.0 ( https://in.mathworks.com/matlabcentral/answers/407502-incompatible-gcc-version-with-mex), so I hope to get this working, if possible. I applied the changes to file sanitizer_platform_limits_posix.cc as per the patch, and now the error is: In file included from /home/mohana/gccbuild/../gcc-6.3.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc:192:0: /home/mohana/gccbuild/../gcc-6.3.0/libsanitizer/sanitizer_common/sanitizer_internal_defs.h:254:72: error: size of array ‘assertion_failed__1142’ is negative typedef char IMPL_PASTE(assertion_failed_##_, line)[2*(int)(pred)-1] ^ /home/mohana/gccbuild/../gcc-6.3.0/libsanitizer/sanitizer_common/sanitizer_internal_defs.h:248:30: note: in expansion of macro ‘IMPL_COMPILER_ASSERT’ #define COMPILER_CHECK(pred) IMPL_COMPILER_ASSERT(pred, __LINE__) ^~~~~~~~~~~~~~~~~~~~ /home/mohana/gccbuild/../gcc-6.3.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h:1410:3: note: in expansion of macro ‘COMPILER_CHECK’ COMPILER_CHECK(sizeof(((__sanitizer_##CLASS *) NULL)->MEMBER) == \ ^~~~~~~~~~~~~~ /home/mohana/gccbuild/../gcc-6.3.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc:1142:1: note: in expansion of macro ‘CHECK_SIZE_AND_OFFSET’ CHECK_SIZE_AND_OFFSET(ipc_perm, mode); ^~~~~~~~~~~~~~~~~~~~~ make[4]: *** [Makefile:477: sanitizer_platform_limits_posix.lo] Error 1 make[4]: Leaving directory '/home/mohana/gccbuild/x86_64-pc-linux-gnu/libsanitizer/sanitizer_common' libtool: link: (cd ".libs" && rm -f "libatomic.so" && ln -s "libatomic.so.1.2.0" "libatomic.so") make[3]: *** [Makefile:466: all-recursive] Error 1 I hope I applied the patch correctly, just removed the lines with (-) and added ones with (+). On Tue, Aug 18, 2020 at 6:45 PM Jonathan Wakely <jwakely.gcc@xxxxxxxxx> wrote: > On Tue, 18 Aug 2020 at 12:07, Mohana <s18002@xxxxxxxxxxxxxxxxxxxxxxx> > wrote: > > > > I made the changes and this error doesn't occur anymore, but the > following happens now: > > > > > /home/mohana/gccbuild/../gcc-6.3.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc:158:23: > fatal error: sys/ustat.h: No such file or directory > > #include <sys/ustat.h> > > ^ > > compilation terminated. > > make[4]: *** [Makefile:477: sanitizer_platform_limits_posix.lo] Error 1 > > make[4]: *** Waiting for unfinished jobs.... > > > > It seems ustat is deprecated. How can this be fixed? > > Why are you building gcc 6.3.0 and not 6.5.0, which already has the > fix for both these problems? > > The patch for this error was > https://gcc.gnu.org/g:2cd244789bc75ecdf65824f831986969049a1647 > specifically > https://gcc.gnu.org/git/?p=gcc.git;a=blobdiff;f=libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc;h=98825b584d24912df76f9982c2319419c7815bf8;hp=6992f2cd8ac56bcd5102f7440d71137b4458871d;hb=2cd244789bc75ecdf65824f831986969049a1647;hpb=6376168efb4c45d621fbec6472f8c9e84a24e940 > > But you should just use gcc-6.5.0 instead. >