bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* Re: Missing functions of fchdir.c in libpoke.a
       [not found] ` <59808933.3108113.1707854367599@mail.yahoo.com>
@ 2024-02-13 20:48   ` Hannes Domani
  2024-02-14 16:46     ` Bruno Haible
  0 siblings, 1 reply; 7+ messages in thread
From: Hannes Domani @ 2024-02-13 20:48 UTC (permalink / raw)
  To: poke-devel@gnu.org; +Cc: mnabipoor@gnu.org, bug-gnulib@gnu.org

 As requested, I'm CC'ing bug-gnulib.


Am Dienstag, 13. Februar 2024 um 21:00:51 MEZ hat Hannes Domani via poke-devel <poke-devel@gnu.org> Folgendes geschrieben:

Hello



When I was trying the gdb poke integration, I already failed in the configure step.
The configure test was this file:
```
char pk_register_iod ();
int
main ()
{
return pk_register_iod ();
  ;
  return 0;
}
```

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'
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-fstat.o): in function `rpl_fstat':
C:\src\repos\poke\poke.git-build\gl-libpoke/../../../poke.git/gl-libpoke/fstat.c:73: undefined reference to `_gl_directory_name'
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-open.o): in function `rpl_open':
C:\src\repos\poke\poke.git-build\gl-libpoke/../../../poke.git/gl-libpoke/open.c:171: undefined reference to `_gl_register_fd'
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-dup2.o): in function `rpl_dup2':
C:\src\repos\poke\poke.git-build\gl-libpoke/../../../poke.git/gl-libpoke/dup2.c:186: undefined reference to `_gl_register_dup'
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-fcntl.o): in function `dupfd':
C:\src\repos\poke\poke.git-build\gl-libpoke/../../../poke.git/gl-libpoke/fcntl.c:164: undefined reference to `_gl_register_dup'
collect2.exe: error: ld returned 1 exit status


All of these function calls are inside an #if REPLACE_FCHDIR block, but
fchdir.c itself was not compiled into libpoke.a.


Regards
Hannes




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Missing functions of fchdir.c in libpoke.a
  2024-02-13 20:48   ` Missing functions of fchdir.c in libpoke.a Hannes Domani
@ 2024-02-14 16:46     ` Bruno Haible
  2024-02-14 16:50       ` Hannes Domani
  0 siblings, 1 reply; 7+ messages in thread
From: Bruno Haible @ 2024-02-14 16:46 UTC (permalink / raw)
  To: poke-devel, bug-gnulib, Hannes Domani; +Cc: mnabipoor

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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Missing functions of fchdir.c in libpoke.a
  2024-02-14 16:46     ` Bruno Haible
@ 2024-02-14 16:50       ` Hannes Domani
  2024-02-14 16:56         ` Bruno Haible
  0 siblings, 1 reply; 7+ messages in thread
From: Hannes Domani @ 2024-02-14 16:50 UTC (permalink / raw)
  To: poke-devel@gnu.org, bug-gnulib@gnu.org, Bruno Haible; +Cc: mnabipoor@gnu.org

 Am Mittwoch, 14. Februar 2024 um 17:46:11 MEZ hat Bruno Haible <bruno@clisp.org> Folgendes geschrieben:

> 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.

Is there some reason why the 'fchdir' module isn't automatically imported
if REPLACE_FCHDIR set set?


Hannes


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Missing functions of fchdir.c in libpoke.a
  2024-02-14 16:50       ` Hannes Domani
@ 2024-02-14 16:56         ` Bruno Haible
  2024-02-14 17:00           ` Hannes Domani
  0 siblings, 1 reply; 7+ messages in thread
From: Bruno Haible @ 2024-02-14 16:56 UTC (permalink / raw)
  To: poke-devel@gnu.org, bug-gnulib, Hannes Domani; +Cc: mnabipoor

Hannes Domani wrote:
> Is there some reason why the 'fchdir' module isn't automatically imported
> if REPLACE_FCHDIR set set?

There are two gnulib-tool invocation in poke; both affect the same
poke/config.h. It is impossible for the gnulib-tool invocation for
libpoke to know about the effects that the gnulib-tool invocation for
poke has done or will be doing.

Bruno





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Missing functions of fchdir.c in libpoke.a
  2024-02-14 16:56         ` Bruno Haible
@ 2024-02-14 17:00           ` Hannes Domani
  2024-02-14 17:06             ` Bruno Haible
  0 siblings, 1 reply; 7+ messages in thread
From: Hannes Domani @ 2024-02-14 17:00 UTC (permalink / raw)
  To: poke-devel@gnu.org, bug-gnulib@gnu.org, Bruno Haible; +Cc: mnabipoor@gnu.org

 Am Mittwoch, 14. Februar 2024 um 17:56:40 MEZ hat Bruno Haible <bruno@clisp.org> Folgendes geschrieben:

> Hannes Domani wrote:
> > Is there some reason why the 'fchdir' module isn't automatically imported
> > if REPLACE_FCHDIR set set?
>
> There are two gnulib-tool invocation in poke; both affect the same
> poke/config.h. It is impossible for the gnulib-tool invocation for
> libpoke to know about the effects that the gnulib-tool invocation for
> poke has done or will be doing.

In this case only libpoke was linked into gdb, not poke.


Hannes


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Missing functions of fchdir.c in libpoke.a
  2024-02-14 17:00           ` Hannes Domani
@ 2024-02-14 17:06             ` Bruno Haible
  2024-02-14 17:17               ` Hannes Domani
  0 siblings, 1 reply; 7+ messages in thread
From: Bruno Haible @ 2024-02-14 17:06 UTC (permalink / raw)
  To: poke-devel@gnu.org, bug-gnulib, Hannes Domani; +Cc: mnabipoor

Hannes Domani wrote:
> > > Is there some reason why the 'fchdir' module isn't automatically imported
> > > if REPLACE_FCHDIR set set?
> >
> > There are two gnulib-tool invocation in poke; both affect the same
> > poke/config.h. It is impossible for the gnulib-tool invocation for
> > libpoke to know about the effects that the gnulib-tool invocation for
> > poke has done or will be doing.
> 
> In this case only libpoke was linked into gdb, not poke.

Yes, but what I am saying is:
1. The gnulib-tool invocation for poke has activated the fchdir module
   (most likely implicitly, through Gnulib modules such as openat, fstatat,
   etc.).
2. This configuration has the effect of defining REPLACE_FCHDIR to 1
   in poke/config.h.
3. libpoke was compiled with this poke/config.h. Thus libpoke needs the
   _gl_unregister_fd symbol.

Bruno





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Missing functions of fchdir.c in libpoke.a
  2024-02-14 17:06             ` Bruno Haible
@ 2024-02-14 17:17               ` Hannes Domani
  0 siblings, 0 replies; 7+ messages in thread
From: Hannes Domani @ 2024-02-14 17:17 UTC (permalink / raw)
  To: poke-devel@gnu.org, bug-gnulib@gnu.org, Bruno Haible; +Cc: mnabipoor@gnu.org

 Am Mittwoch, 14. Februar 2024 um 18:06:23 MEZ hat Bruno Haible <bruno@clisp.org> Folgendes geschrieben:

> Hannes Domani wrote:
> > > > Is there some reason why the 'fchdir' module isn't automatically imported
> > > > if REPLACE_FCHDIR set set?
> > >
> > > There are two gnulib-tool invocation in poke; both affect the same
> > > poke/config.h. It is impossible for the gnulib-tool invocation for
> > > libpoke to know about the effects that the gnulib-tool invocation for
> > > poke has done or will be doing.
> >
> > In this case only libpoke was linked into gdb, not poke.
>
> Yes, but what I am saying is:
> 1. The gnulib-tool invocation for poke has activated the fchdir module
>   (most likely implicitly, through Gnulib modules such as openat, fstatat,
>   etc.).
> 2. This configuration has the effect of defining REPLACE_FCHDIR to 1
>   in poke/config.h.
> 3. libpoke was compiled with this poke/config.h. Thus libpoke needs the
>   _gl_unregister_fd symbol.

Ooooh, libpoke uses poke/config.h, that was what I was missing.
Yes, then it makes sense.


Hannes


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-02-14 17:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <59808933.3108113.1707854367599.ref@mail.yahoo.com>
     [not found] ` <59808933.3108113.1707854367599@mail.yahoo.com>
2024-02-13 20:48   ` Missing functions of fchdir.c in libpoke.a Hannes Domani
2024-02-14 16:46     ` Bruno Haible
2024-02-14 16:50       ` Hannes Domani
2024-02-14 16:56         ` Bruno Haible
2024-02-14 17:00           ` Hannes Domani
2024-02-14 17:06             ` Bruno Haible
2024-02-14 17:17               ` Hannes Domani

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).