Hello,
I am writing a program that uses ncurses and I want to check it
with valgrind. My problem can be illustrated with a simple
hello-world program:
#include <ncurses.h>
int main() {
initscr();
printw("Hello World !!!");
refresh();
getch();
endwin();
return 0;
}
It works fine as long as I compile it with the normal lib:
gcc -o example example.c -lncurses
If I use the wide char lib:
gcc -o example example.c -lncursesw
valgrind produces the following error message and stops before
starting my program:
# valgrind ./example
==3435== Memcheck, a memory error detector
==3435== Copyright (C) 2002-2017, and GNU GPL'd, by Julian
Seward et al.
==3435== Using Valgrind-3.13.0 and LibVEX; rerun with -h for
copyright info
==3435== Command: ./example
==3435==
./example: relocation error:
/usr/lib/debug/libncursesw.so.5: symbol _tracecchar_t2 version
NCURSES_TINFO_5.4.20040208 not defined in file libtinfo.so.5
with link time reference
==3435== Jump to the invalid address stated on the next line
==3435== at 0x556: ???
==3435== by 0x401BA32: fatal_error (dl-error-skeleton.c:78)
==3435== by 0x401BAA1: _dl_signal_exception
(dl-error-skeleton.c:102)
==3435== by 0x401BB77: _dl_signal_cexception
(dl-error-skeleton.c:148)
==3435== by 0x400B3FC: _dl_lookup_symbol_x (dl-lookup.c:857)
==3435== by 0x400CAF8: elf_machine_rela (dl-machine.h:308)
==3435== by 0x400CAF8: elf_dynamic_do_Rela (do-rel.h:137)
==3435== by 0x400CAF8: _dl_relocate_object (dl-reloc.c:258)
==3435== by 0x4004306: dl_main (rtld.c:2190)
==3435== by 0x401ADCF: _dl_sysdep_start (dl-sysdep.c:253)
==3435== by 0x4002127: _dl_start_final (rtld.c:414)
==3435== by 0x4002127: _dl_start (rtld.c:521)
==3435== by 0x4001097: ??? (in
/lib/x86_64-linux-gnu/ld-2.27.so)
==3435== Address 0x556 is not stack'd, malloc'd or (recently)
free'd
==3435==
==3435==
==3435== Process terminating with default action of signal 11
(SIGSEGV)
==3435== Bad permissions for mapped region at address 0x556
==3435== at 0x556: ???
==3435== by 0x401BA32: fatal_error (dl-error-skeleton.c:78)
==3435== by 0x401BAA1: _dl_signal_exception
(dl-error-skeleton.c:102)
==3435== by 0x401BB77: _dl_signal_cexception
(dl-error-skeleton.c:148)
==3435== by 0x400B3FC: _dl_lookup_symbol_x (dl-lookup.c:857)
==3435== by 0x400CAF8: elf_machine_rela (dl-machine.h:308)
==3435== by 0x400CAF8: elf_dynamic_do_Rela (do-rel.h:137)
==3435== by 0x400CAF8: _dl_relocate_object (dl-reloc.c:258)
==3435== by 0x4004306: dl_main (rtld.c:2190)
==3435== by 0x401ADCF: _dl_sysdep_start (dl-sysdep.c:253)
==3435== by 0x4002127: _dl_start_final (rtld.c:414)
==3435== by 0x4002127: _dl_start (rtld.c:521)
==3435== by 0x4001097: ??? (in
/lib/x86_64-linux-gnu/ld-2.27.so)
==3435==
==3435== HEAP SUMMARY:
==3435== in use at exit: 0 bytes in 0 blocks
==3435== total heap usage: 0 allocs, 0 frees, 0 bytes
allocated
==3435==
==3435== All heap blocks were freed -- no leaks are possible
==3435==
==3435== For counts of detected and suppressed errors, rerun
with: -v
==3435== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0
from 0)
I am using Ubuntu 18.04 with:
libncursesw5-dev 6.1-1ubuntu1.18.04
libtinfo5-dbg 6.1-1ubuntu1.18.04
I am not sure if this is a ncurses problem or a problem of the
tinfo lib or a problem of packaging the right libs. I hope you can
help me.
Thanks in advance,
Volker