From 1bc1068a0c1a1a0fad09500c97edf88467de9be0 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Wed, 17 Dec 2014 20:09:02 +0100 Subject: [PATCH] Fix MinGW compilation On Sun, 14 Dec 2014 07:00:28 +0100, Yao Qi wrote: The build on mingw host is broken because mingw has no mkdtemp. ../../../git/gdb/compile/compile.c: In function 'get_compile_file_tempdir': ../../../git/gdb/compile/compile.c:194:3: error: implicit declaration of function 'mkdtemp' [-Werror=implicit-function-declaration] tempdir_name = mkdtemp (tname); ^ ../../../git/gdb/compile/compile.c:194:16: error: assignment makes pointer from integer without a cast [-Werror] tempdir_name = mkdtemp (tname); ^ cc1: all warnings being treated as errors In the end I have managed to test it by Wine myself: $ wine build_win32/gdb/gdb.exe -q build_win32/gdb/gdb.exe -ex start -ex 'compile code 1' -ex 'set confirm no' -ex quit [...] Temporary breakpoint 1, main (argc=1, argv=0x241418) at ../../gdb/gdb.c:29 29 args.argc = argc; Could not load libcc1.so: Module not found. Even if it managed to load libcc1.so (it needs host-dependent name libcc1.dll) then it would soon end up at least on: default_infcall_mmap: error (_("This target does not support inferior memory allocation by mmap.")); As currently there is only: linux-tdep.c: set_gdbarch_infcall_mmap (gdbarch, linux_infcall_mmap); While one could debug Linux targets from MS-Windows host I find it somehow overcomplicated now when we are trying to get it running at least on native Linux x86*. The 'compile' project needs a larger port effort to run on MS-Windows. gdb/ChangeLog 2014-12-17 Jan Kratochvil Fix MinGW compilation. * compile/compile.c (get_compile_file_tempdir): Call error if !HAVE_MKDTEMP. * config.in: Regenerate. * configure: Regenerate. * configure.ac (AC_CHECK_FUNCS): Add mkdtemp. gdb/testsuite/ChangeLog 2014-12-17 Jan Kratochvil Fix MinGW compilation. * gdb.compile/compile-ops.exp: Update untested message if !skip_compile_feature_tests. * gdb.compile/compile-setjmp.exp: Likewise. * gdb.compile/compile-tls.exp: Likewise. * gdb.compile/compile.exp: Likewise. * lib/gdb.exp (skip_compile_feature_tests): Check also "Command not supported on this host". --- gdb/ChangeLog | 9 +++++++++ gdb/compile/compile.c | 4 ++++ gdb/config.in | 3 +++ gdb/configure | 2 +- gdb/configure.ac | 2 +- gdb/testsuite/ChangeLog | 11 +++++++++++ gdb/testsuite/gdb.compile/compile-ops.exp | 2 +- gdb/testsuite/gdb.compile/compile-setjmp.exp | 2 +- gdb/testsuite/gdb.compile/compile-tls.exp | 2 +- gdb/testsuite/gdb.compile/compile.exp | 2 +- gdb/testsuite/lib/gdb.exp | 3 +++ 11 files changed, 36 insertions(+), 6 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b672dc3..42ace6d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2014-12-17 Jan Kratochvil + + Fix MinGW compilation. + * compile/compile.c (get_compile_file_tempdir): Call error if + !HAVE_MKDTEMP. + * config.in: Regenerate. + * configure: Regenerate. + * configure.ac (AC_CHECK_FUNCS): Add mkdtemp. + 2014-12-17 Doug Evans * valops.c (value_maybe_namespace_elt): Remove redundant call to diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c index 6d3d16e..414fc35 100644 --- a/gdb/compile/compile.c +++ b/gdb/compile/compile.c @@ -191,7 +191,11 @@ get_compile_file_tempdir (void) strcpy (tname, TEMPLATE); #undef TEMPLATE +#ifdef HAVE_MKDTEMP tempdir_name = mkdtemp (tname); +#else + error (_("Command not supported on this host.")); +#endif if (tempdir_name == NULL) perror_with_name (_("Could not make temporary directory")); diff --git a/gdb/config.in b/gdb/config.in index fb3c315..9d3f32d 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -231,6 +231,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H +/* Define to 1 if you have the `mkdtemp' function. */ +#undef HAVE_MKDTEMP + /* Define to 1 if you have a working `mmap' system call. */ #undef HAVE_MMAP diff --git a/gdb/configure b/gdb/configure index 8985230..7ff74ba 100755 --- a/gdb/configure +++ b/gdb/configure @@ -10496,7 +10496,7 @@ for ac_func in getrusage getuid getgid \ sigaction sigprocmask sigsetmask socketpair \ ttrace wborder wresize setlocale iconvlist libiconvlist btowc \ setrlimit getrlimit posix_madvise waitpid \ - ptrace64 sigaltstack + ptrace64 sigaltstack mkdtemp do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" diff --git a/gdb/configure.ac b/gdb/configure.ac index c933e3f..e972ac2 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -1317,7 +1317,7 @@ AC_CHECK_FUNCS([getrusage getuid getgid \ sigaction sigprocmask sigsetmask socketpair \ ttrace wborder wresize setlocale iconvlist libiconvlist btowc \ setrlimit getrlimit posix_madvise waitpid \ - ptrace64 sigaltstack]) + ptrace64 sigaltstack mkdtemp]) AM_LANGINFO_CODESET GDB_AC_COMMON diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 9e69efc..f749d2e 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2014-12-17 Jan Kratochvil + + Fix MinGW compilation. + * gdb.compile/compile-ops.exp: Update untested message if + !skip_compile_feature_tests. + * gdb.compile/compile-setjmp.exp: Likewise. + * gdb.compile/compile-tls.exp: Likewise. + * gdb.compile/compile.exp: Likewise. + * lib/gdb.exp (skip_compile_feature_tests): Check also "Command not + supported on this host". + 2014-12-16 Doug Evans * boards/stabs.exp: New file. diff --git a/gdb/testsuite/gdb.compile/compile-ops.exp b/gdb/testsuite/gdb.compile/compile-ops.exp index c295836..4fc950f 100644 --- a/gdb/testsuite/gdb.compile/compile-ops.exp +++ b/gdb/testsuite/gdb.compile/compile-ops.exp @@ -411,7 +411,7 @@ if ![runto func] { } if {[skip_compile_feature_tests]} { - untested "could not find libcc1 shared library" + untested "compile command not supported (could not find libcc1 shared library?)" return -1 } diff --git a/gdb/testsuite/gdb.compile/compile-setjmp.exp b/gdb/testsuite/gdb.compile/compile-setjmp.exp index 557c1f0..8f876e2 100644 --- a/gdb/testsuite/gdb.compile/compile-setjmp.exp +++ b/gdb/testsuite/gdb.compile/compile-setjmp.exp @@ -24,7 +24,7 @@ if ![runto_main] { } if {[skip_compile_feature_tests]} { - untested "could not find libcc1 shared library" + untested "compile command not supported (could not find libcc1 shared library?)" return -1 } diff --git a/gdb/testsuite/gdb.compile/compile-tls.exp b/gdb/testsuite/gdb.compile/compile-tls.exp index e9613f5..d95a351 100644 --- a/gdb/testsuite/gdb.compile/compile-tls.exp +++ b/gdb/testsuite/gdb.compile/compile-tls.exp @@ -27,7 +27,7 @@ if ![runto_main] then { } if {[skip_compile_feature_tests]} { - untested "could not find libcc1 shared library" + untested "compile command not supported (could not find libcc1 shared library?)" return -1 } diff --git a/gdb/testsuite/gdb.compile/compile.exp b/gdb/testsuite/gdb.compile/compile.exp index d0dd791..040b727 100644 --- a/gdb/testsuite/gdb.compile/compile.exp +++ b/gdb/testsuite/gdb.compile/compile.exp @@ -57,7 +57,7 @@ if ![runto_main] { } if {[skip_compile_feature_tests]} { - untested "could not find libcc1 shared library" + untested "compile command not supported (could not find libcc1 shared library?)" return -1 } diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 3a3a396..08087f2 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -2538,6 +2538,9 @@ proc skip_compile_feature_tests {} { "Could not load libcc1.*\r\n$gdb_prompt $" { set result 1 } + -re "Command not supported on this host\\..*\r\n$gdb_prompt $" { + set result 1 + } -re "\r\n$gdb_prompt $" { } } -- 2.7.4