Bug 30882 - sim: m32c/opc2c.c: MinGW: undefined reference to `getline'
Summary: sim: m32c/opc2c.c: MinGW: undefined reference to `getline'
Status: ASSIGNED
Alias: None
Product: gdb
Classification: Unclassified
Component: sim (show other bugs)
Version: 13.1
: P2 normal
Target Milestone: ---
Assignee: Mike Frysinger
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-24 11:27 UTC by Orgad Shaneh
Modified: 2024-03-03 11:25 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed: 2023-10-15 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Orgad Shaneh 2023-09-24 11:27:38 UTC
When building with gdb on MinGW64 with simulators enabled, I get the following warning:

../../gdb-13.2/sim/m32c/opc2c.c: In function 'main':
../../gdb-13.2/sim/m32c/opc2c.c:541:10: warning: implicit declaration of function 'getline' [-Wimplicit-function-declaration]
  541 |   while (getline (&linebuf, &len, in) >= 0)
      |          ^~~~~~~

And it fails to link:

ld.exe: m32c/opc2c.o:opc2c.c:(.text.startup+0x123): undefined reference to `getline'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [Makefile:3343: m32c/opc2c.exe] Error 1
Comment 1 Orgad Shaneh 2023-09-24 11:33:34 UTC
Reported initially in https://sourceware.org/bugzilla/show_bug.cgi?id=28476.

Still present in 13.2.
Comment 2 Mike Frysinger 2023-10-15 17:19:09 UTC
the top-level configurey already supports building subdirs for the --build system.  so i posted some patches to leverage that and link them in to our build-time tools.

https://sourceware.org/pipermail/gdb-patches/2023-October/203256.html
https://sourceware.org/pipermail/gdb-patches/2023-October/203257.html
https://sourceware.org/pipermail/gdb-patches/2023-October/203258.html
Comment 3 Orgad Shaneh 2024-03-03 11:25:43 UTC
As of 14.1, this is still broken.