Re: Statically link libwinpthread-1.dll in gdbserver

Pedro Alves <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
On 2022-05-02 18:54, Claude Robitaille wrote:
> This is what I get with make all-gdbserver
> 
>   CXX    alloc.o
> In file included from ../../binutils-gdb/gdbserver/../gdbsupport/common-defs.h:197,
>                  from ../../binutils-gdb/gdbserver/../gdb/alloc.c:37:
> ../../binutils-gdb/gdbserver/../gdbsupport/gdb_locale.h:27:11: fatal error: libintl.h: No such file or directory
>    27 | # include <libintl.h>
>       |           ^~~~~~~~~~~
> compilation terminated.
> 
> This is the complete configuration command line I was using
> 
> export CFLAGS=-static; export CXXFLAGS=-static; ../binutils-gdb/configure --enable-static --with-static-standard-libraries --disable-gdb --host=x86_64-w64-mingw32

Thanks.  I'm not setup to build gdb/gdbserver on mingw fully currently (Ubuntu 20.04's mingw gcc doesn't support
std::future), but I'm able to run that configure, and build alloc.o only, and I see the same:

$ make -C gdbserver alloc.o
make: Entering directory '/home/pedro/gdb/binutils-gdb/build-mingw-test/gdbserver'
  CXX    alloc.o
In file included from ../../src/gdbserver/../gdbsupport/common-defs.h:197,
                 from ../../src/gdbserver/../gdb/alloc.c:37:
../../src/gdbserver/../gdbsupport/gdb_locale.h:27:11: fatal error: libintl.h: No such file or directory
   27 | # include <libintl.h>
      |           ^~~~~~~~~~~
compilation terminated.
make: *** [Makefile:553: alloc.o] Error 1
make: Leaving directory '/home/pedro/gdb/binutils-gdb/build-mingw-test/gdbserver'


gdb_locale.h has:

 #ifdef ENABLE_NLS
 # include <libintl.h>
 # define _(String) gettext (String)
 # ifdef gettext_noop

so we should only include libint.h if ENABLE_NLS is defined.

I noticed that:

In build/intl/ I a fully built intl, including a intl/config.intl with the
expected values when using the in-tree intl:

 ...
 USE_NLS='yes'
 LIBINTL='-L${top_builddir}/../intl -lintl'
 LIBINTL_DEP='${top_builddir}/../intl/libintl.a'
 INCINTL='-I${top_builddir}/../intl'
 ...

however, gdbserver's Makefile ended up with the default/empty:

 # Where is the INTL library?  Typically in ../intl.
 INTL = 
 INTL_DEPS = 
 INTL_CFLAGS = 

Looking a bit deeper, I see I ended up with a mismatch between
gdbsupport and gdbserver, one thinks we're using intl, the other one doesn't:

 $ grep ENABLE_NLS gdbserver/config.h 
 /* #undef ENABLE_NLS */

 $ grep ENABLE_NLS gdbsupport/config.h 
 #define ENABLE_NLS 1

Sounds like that may be the problem.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.