bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* Multiple definition errors when linking libpoke into gdb
       [not found] <480198541.3664126.1707924796027.ref@mail.yahoo.com>
@ 2024-02-14 15:33 ` Hannes Domani
  2024-02-14 16:26   ` Bruno Haible
  0 siblings, 1 reply; 4+ messages in thread
From: Hannes Domani @ 2024-02-14 15:33 UTC (permalink / raw)
  To: poke-devel, bug-gnulib

Hello


When I'm trying to (statically) link libpoke into gdb, I get the following errors:

c:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/src/repos/poke/inst/lib/libpoke.a(libgnu_la-xmalloc.o): in function `xmalloc':
C:\src\repos\poke\poke.git-build\gl-libpoke/../../../poke.git/gl-libpoke/xmalloc.c:44: multiple definition of `xmalloc'; alloc.o:C:/src/repos/binutils-gdb.git/gdb/alloc.c:49: first defined here
c:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/src/repos/poke/inst/lib/libpoke.a(libgnu_la-xmalloc.o): in function `xrealloc':
C:\src\repos\poke\poke.git-build\gl-libpoke/../../../poke.git/gl-libpoke/xmalloc.c:65: multiple definition of `xrealloc'; alloc.o:C:/src/repos/binutils-gdb.git/gdb/alloc.c:66: first defined here
c:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/src/repos/poke/inst/lib/libpoke.a(libgnu_la-xmalloc.o): in function `xcalloc':
C:\src\repos\poke\poke.git-build\gl-libpoke/../../../poke.git/gl-libpoke/xmalloc.c:297: multiple definition of `xcalloc'; alloc.o:C:/src/repos/binutils-gdb.git/gdb/alloc.c:86: first defined here
c:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/src/repos/poke/inst/lib/libpoke.a(libgnu_la-xmalloc.o): in function `xmemdup':
C:\src\repos\poke\poke.git-build\gl-libpoke/../../../poke.git/gl-libpoke/xmalloc.c:313: multiple definition of `xmemdup'; C:/gdb/build64/gdb-git-python3/libctf/../libiberty/libiberty.a(xmemdup.o):C:/src/repos/binutils-gdb.git/libiberty/xmemdup.c:36: first defined here
c:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/src/repos/poke/inst/lib/libpoke.a(libgnu_la-xmalloc.o): in function `xstrdup':
C:\src\repos\poke\poke.git-build\gl-libpoke/../../../poke.git/gl-libpoke/xmalloc.c:338: multiple definition of `xstrdup'; C:/gdb/build64/gdb-git-python3/libctf/../libiberty/libiberty.a(xstrdup.o):C:/src/repos/binutils-gdb.git/libiberty/xstrdup.c:32: first defined here

Both gdb and gl-libpoke define these x* allocation functions, and I'm not sure how to fix this.


Regards
Hannes


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

* Re: Multiple definition errors when linking libpoke into gdb
  2024-02-14 15:33 ` Multiple definition errors when linking libpoke into gdb Hannes Domani
@ 2024-02-14 16:26   ` Bruno Haible
  2024-02-14 16:52     ` Jose E. Marchesi
  0 siblings, 1 reply; 4+ messages in thread
From: Bruno Haible @ 2024-02-14 16:26 UTC (permalink / raw)
  To: poke-devel, bug-gnulib; +Cc: Hannes Domani

Hannes Domani wrote:
> When I'm trying to (statically) link libpoke into gdb, I get the following errors:
> 
> ... gl-libpoke/xmalloc.c:44: multiple definition of `xmalloc'; alloc.o
> ... gdb/alloc.c:49: first defined here
> 
> Both gdb and gl-libpoke define these x* allocation functions, and I'm not sure how to fix this.

The most reliable way to do this is to rename the said functions at the
source code level, in the scope of poke. That is, in some .h file that
all poke files see but that gdb does not see (such as poke/config.h),
add definitions such as
  #define xmalloc libpoke_xmalloc
  #define xstrdup libpoke_xstrdup.
Most gnulib modules respect such definitions in config.h. If you find
a module that doesn't, please report it here.

For a fixed list of symbols, this can be done through an AH_VERBATIM
invocation in poke's configure.ac.

Bruno





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

* Re: Multiple definition errors when linking libpoke into gdb
  2024-02-14 16:26   ` Bruno Haible
@ 2024-02-14 16:52     ` Jose E. Marchesi
  2024-02-14 17:19       ` Bruno Haible
  0 siblings, 1 reply; 4+ messages in thread
From: Jose E. Marchesi @ 2024-02-14 16:52 UTC (permalink / raw)
  To: Bruno Haible; +Cc: poke-devel, bug-gnulib, Hannes Domani


> Hannes Domani wrote:
>> When I'm trying to (statically) link libpoke into gdb, I get the following errors:
>> 
>> ... gl-libpoke/xmalloc.c:44: multiple definition of `xmalloc'; alloc.o
>> ... gdb/alloc.c:49: first defined here
>> 
>> Both gdb and gl-libpoke define these x* allocation functions, and I'm not sure how to fix this.
>
> The most reliable way to do this is to rename the said functions at the
> source code level, in the scope of poke. That is, in some .h file that
> all poke files see but that gdb does not see (such as poke/config.h),
> add definitions such as
>   #define xmalloc libpoke_xmalloc
>   #define xstrdup libpoke_xstrdup.
> Most gnulib modules respect such definitions in config.h. If you find
> a module that doesn't, please report it here.
>
> For a fixed list of symbols, this can be done through an AH_VERBATIM
> invocation in poke's configure.ac.

I think in this case it is better to not use the xalloc module in
libpoke at all.



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

* Re: Multiple definition errors when linking libpoke into gdb
  2024-02-14 16:52     ` Jose E. Marchesi
@ 2024-02-14 17:19       ` Bruno Haible
  0 siblings, 0 replies; 4+ messages in thread
From: Bruno Haible @ 2024-02-14 17:19 UTC (permalink / raw)
  To: Jose E. Marchesi; +Cc: poke-devel, bug-gnulib, Hannes Domani

Jose E. Marchesi wrote:
> I think in this case it is better to not use the xalloc module in
> libpoke at all.

This looks feasible: There are not many references to functions like
xmalloc in libpoke.

pkl-ast.c:116:  PKL_AST_STRING_POINTER (new) = xstrdup (str);
pkl-ast.c:131:  PKL_AST_IDENTIFIER_POINTER (id) = xstrdup (str);
pkl-ast.c:653:               ? xstrdup (PKL_AST_STRUCT_TYPE_FIELD_CONSTRAINT_SRC (t))
pkl-ast.c:1847:    PKL_AST_DECL_SOURCE (decl) = xstrdup (source);
pkl-ast.c:2358:  PKL_AST_SRC_FILENAME (src) = filename ? xstrdup (filename) : NULL;
pkl-ast.c:2406:    bool added = gl_set_add (visitations, ptr); \
pkl-ast.c:2426:  added = gl_set_add (visitations, ast);
pkl-ast.c:2852:  gl_set_t visitations = gl_set_create_empty (GL_LINKEDHASH_SET,
pkl-fold.c:153:  char *res = xmalloc (strlen (op1) * op2 + 1);
pvm-program.c:339:  expanded = xmalloc (expanded_size + 1);
pvm-program.c:367:      char *invalid_token = xstrdup (err->error_token_text);
pkl-trans.c:268:        = xstrdup (PKL_AST_IDENTIFIER_POINTER (name));
pkl-trans.c:402:  new_string_pointer = xmalloc (string_length + 1);
pkl-trans.c:991:            char *class = xmalloc (strlen (fmt) + 1);
pkl-trans.c:1040:            new_style_class = end_sc ? xstrdup (class) : class;
pkl-trans.c:1058:            PKL_AST_FORMAT_ARG_SUFFIX (new_arg) = xstrdup ("%");
pvm-val.c:1298:      str_printable = xmalloc (printable_size + 1);

Bruno





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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <480198541.3664126.1707924796027.ref@mail.yahoo.com>
2024-02-14 15:33 ` Multiple definition errors when linking libpoke into gdb Hannes Domani
2024-02-14 16:26   ` Bruno Haible
2024-02-14 16:52     ` Jose E. Marchesi
2024-02-14 17:19       ` Bruno Haible

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