Can't cross-compile gdb with MinGW

Viewed 268

I'm trying to cross-compile gdb so I could debug my Windows version of program. My host system is Arch Linux(5.13.4-arch1-1 to be exact).

I'm using MinGW from the official repositories.

$ i686-w64-mingw32-gcc --version
i686-w64-mingw32-gcc (GCC) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I downloaded the source for gdb from https://ftp.gnu.org/gnu/gdb/ (gdb-10.2.tar.gz). I unpacked it, cd into dir and ran:

$ ./configure --host=i686-w64-mingw32
$ make

For long it compiled without any errors and then:

  CXX    source-cache.o
source-cache.c:37:10: fatal error: srchilite/sourcehighlight.h: No such file or directory
   37 | #include <srchilite/sourcehighlight.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

And also although compiler already compiled gdbserver and other different programs, I can't run them. Launching gdbserver.exe with wine gives:

$ wine gdbserver.exe
0024:err:module:import_dll Library libgcc_s_dw2-1.dll (which is needed by L"Z:\\home\\udalny\\.local\\build\\gdb\\gdb-10.2\\gdbserver\\gdbserver.exe") not found
0024:err:module:import_dll Library libstdc++-6.dll (which is needed by L"Z:\\home\\udalny\\.local\\build\\gdb\\gdb-10.2\\gdbserver\\gdbserver.exe") not found
0024:err:module:LdrInitializeThunk Importing dlls for L"Z:\\home\\udalny\\.local\\build\\gdb\\gdb-10.2\\gdbserver\\gdbserver.exe" failed, status c0000135

Is it not statically linked?

Does anybody know how to fix it?

1 Answers

You can avoid the problem with the configure flag --disable-source-highlight if you can do without sourxe highlighting.

Related