Subject: bug#37852: Build failure on MSYS2 (undefined reference to _chk functions)

From: Eli Zaretskii <[email-masked]>
Date: Mon, 21 Oct 2019 19:36:17 +0300

> From: Andy Moreton <[email-masked]>
> Date: Mon, 21 Oct 2019 17:05:35 +0100
> 
> > So do we need to add that library to the link command under some
> > conditions?  IOW, is FORTIFY_SOURCE something that comes out of our
> > configure script (in which case I'm missing something, because I
> > didn't find it in the configure script), or is this an option you
> > added manually?  In the latter case, would configuring with LIBS=-lssp
> > be an okay solution?
> 
> See GNULIB_PORTCHECK_FORTIFY_SOURCE in configure.ac - the relevant macro
> is _FORTIFY_SOURCE.

Thanks, I indeed missed that.

> Building with -D_FORTIFY_SOURCE=0 also works, but your suggestion to add
> the missing library is a better workaround than disabling the checks.

The problem with using -lssp unconditionally is that some
installations might not have it, and then the linker will barf.  So I
think we should better disable GNULIB_PORTCHECK on MinGW (I can hardly
imagine someone using that platform for those portability checks, and
I'm not sure I understand why this gets defined by default on other
platforms).