[patch] compile: Fix MinGW build [Re: [mingw rfc] Add mkdtemp to gdb/gnulib/]

Jan Kratochvil
2014-12-15T22:28:20Z

[-- Attachment #1: Type: text/plain, Size: 1147 bytes --]

On Mon, 15 Dec 2014 19:57:28 +0100, Eli Zaretskii wrote:
> > On Mon, 15 Dec 2014 04:15:43 +0100, Yao Qi wrote:
> > # or maybe we have to use win32 api, such as GetTempPath and GetRandomFileName.
>
> If you write it, I can test it.

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.

OK for check-in?

Thanks,
Jan

[-- Attachment #2: 1 --]
[-- Type: text/plain, Size: 627 bytes --]

gdb/ChangeLog
2014-12-15 Jan Kratochvil <jan.kratochvil@redhat.com>

Fix MinGW compilation.
* compile/compile.c (get_compile_file_tempdir): Call error on _WIN32.

--- ./gdb/compile/compile.c 2014-12-14 02:48:38.000000000 +0100
+++ ./gdb/compile/compile.c 2014-12-15 23:21:28.788716340 +0100
@@ -191,7 +191,11 @@ get_compile_file_tempdir (void)

strcpy (tname, TEMPLATE);
#undef TEMPLATE
+#ifdef _WIN32
+ error (_("mkdtemp needs to be implemented for MS-Windows hosts"));
+#else
tempdir_name = mkdtemp (tname);
+#endif
if (tempdir_name == NULL)
perror_with_name (_("Could not make temporary directory"));