Please ignore this patch, It still get failed. Thanks.

Lianbo

On Tue, Feb 15, 2022 at 10:11 PM Lianbo Jiang <lijiang@redhat.com> wrote:
The build_data.c is dynamically generated by configure, sometimes the
data may not be synchronized to the file build_data.c, as a result,
it will break the compilation process with the following error:

$ for i in {1..50} ; do make clean ; rm -rf gdb-10.2/ ; make warn ;\
[ $? -ne 0 ] && echo "TRY $i" && break ; done

...
ar: creating crashlib.a
  CXXLD  gdb
/usr/bin/ld: ../../crashlib.a(main.o): in function `dump_build_data':
/home/crash/main.c:1829: undefined reference to `build_command'
/usr/bin/ld: /home/crash/main.c:1830: undefined reference to `build_data'
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:1872: gdb] Error 1
make[3]: *** [Makefile:10072: all-gdb] Error 2
make[2]: *** [Makefile:860: all] Error 2
crash build failed

The fflush() will help flush the data into the build_data.c.

Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
---
 configure.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.c b/configure.c
index 51888519c18c..41d096bc56ca 100644
--- a/configure.c
+++ b/configure.c
@@ -1337,6 +1337,7 @@ make_build_data(char *target)
         pclose(fp1);
         pclose(fp2);
         pclose(fp3);
+       fflush(fp4);
        fclose(fp4);
 }

--
2.20.1