* Problem/Bug with binutils-gdb and strsignal ?
@ 2021-10-24 6:26 Claudius Schnörr
2021-10-26 20:03 ` Corinna Vinschen
0 siblings, 1 reply; 2+ messages in thread
From: Claudius Schnörr @ 2021-10-24 6:26 UTC (permalink / raw)
To: cygwin
Hello,
when compiling binutils-gdb I got stuck with an error concerning the strsignal function.
This also occurs when trying to compile the insight gdb-frontend on cygwin64 that I tried to build.
* platform:
o cygwin 64bit on Win-10
o gcc (GCC) 11.2.0, g++ (GCC) 11.2.0
* commands submitted:
o git clone --recursive git://sourceware.org/git/binutils-gdb.git
o autoconf
o ./configure
o make
* Error message:
o event-top.c: In function ‘void handle_fatal_signal(int)’:
event-top.c:893:18: error: ‘strsignal’ was not declared in this
scope; did you mean ‘strsigno’?
893 | sig_write (strsignal (sig));
* comment:
o strsignal() is declared in string.h. However, including it
doesn't work.
Then I inspected string.h on cygwin64 in /usr/include and found
this:
o #ifndef DEFS_H /* Kludge to work around problem compiling in
gdb */
char *strsignal (int __signo);
#endif
o suggestion: undefining DEFS_H might be risky -> to be added at
line 55:
+ #ifndef DEFS_H
# include <string.h> /* for strsignal on
cygwin */
#else
char *strsignal (int __signo); /* see
/usr/include/string.h on cygwin */
#endif
o then it compiles, however a library is missed now:
+ x86_64-pc-cygwin/bin/ld:
event-top.o:.../insight/bundle/gdb/event-top.c:899:
undefined reference to `strsignal(int)'
collect2: error: ld returned 1 exit status
Hope this helps somehow.
Kind regards,
Claudius
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Problem/Bug with binutils-gdb and strsignal ?
2021-10-24 6:26 Problem/Bug with binutils-gdb and strsignal ? Claudius Schnörr
@ 2021-10-26 20:03 ` Corinna Vinschen
0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2021-10-26 20:03 UTC (permalink / raw)
To: Claudius Schnörr; +Cc: cygwin
On Oct 24 08:26, Claudius Schnörr via Cygwin wrote:
> o suggestion: undefining DEFS_H might be risky -> to be added at
> line 55:
> + #ifndef DEFS_H
> # include <string.h> /* for strsignal on
> cygwin */
> #else
> char *strsignal (int __signo); /* see
> /usr/include/string.h on cygwin */
> #endif
> o then it compiles, however a library is missed now:
> + x86_64-pc-cygwin/bin/ld:
> event-top.o:.../insight/bundle/gdb/event-top.c:899:
> undefined reference to `strsignal(int)'
> collect2: error: ld returned 1 exit status
Makes sense. The GDB build uses a c++ compiler. If you define strsignal
as above, c++ assumes it's a C++ symbol, so its name gets mangled per
the C++ mangling rules. Given the symbol is a plain C symbol, you'd
have to specify this explicitely, i. e.
extern "C" char *strsignal (int __signo);
Anyway, this needs fixing in the system header. There's a matching
thread on the newlib mailing list addressing this problem.
Thanks,
Corinna
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-26 20:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-24 6:26 Problem/Bug with binutils-gdb and strsignal ? Claudius Schnörr
2021-10-26 20:03 ` Corinna Vinschen
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).