Hannes Domani wrote:
> Compiling fails like this:
> 
> $ gcc -o conftest.exe -g -O2 -I/gdb/gdb-libs64/include conftest.c 
> -L/gdb/gdb-libs64/lib -lpoke -lgc
> c:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
>  C:/gdb/gdb-libs64/lib/libpoke.a(libgnu_la-close.o): in function `rpl_close':
> C:\src\repos\poke\poke.git-build\gl-libpoke/../../../poke.git/gl-libpoke/close.c:71:
>  undefined reference to `_gl_unregister_fd'
> ...
> 
> All of these function calls are inside an #if REPLACE_FCHDIR block, but
> fchdir.c itself was not compiled into libpoke.a.

The technical explanation of the cause is:

poke uses some gnulib modules which make uses of the Unix idiom that
it is possible to open() a directory and get a file descriptor. This
idiom requires extra Gnulib code, conditionalized by REPLACE_FCHDIR.

It could be that poke (the program) opens a directory descriptor in
this way and libpoke needs to close it; that's the reason for the
_gl_unregister_fd in gl-libpoke/close.c.

Linking gdb (which does not use the Gnulib 'fchdir' module) with
libpoke thus produces this undefined symbol.

The easiest workaround/fix is probably that libpoke imports the
Gnulib 'fchdir' module.

Bruno




Reply via email to