|
From: Simon J. <ja...@ex...> - 2003-12-02 03:26:07
|
The problem was a missing -lnsl. Apparently, libgnutls (which libshishi
uses) uses -lnsl, and this forces everything that depend libgnutls to
specify -lnsl as well, otherwise valgrind barfs with the error below. I
guess -lnsl uses _init or does something weird with the dynamic linker.
Thanks for the help, on list and off list.
jas@latte:~$ gcc -o foo foo.c -lshishi
jas@latte:~$ cat foo.c
#include <stdio.h>
int main()
{
puts("foo");
}
jas@latte:~$ gcc -o foo foo.c -lshishi
jas@latte:~$ valgrind --num-callers=10 ./foo
==5091== Memcheck, a.k.a. Valgrind, a memory error detector for x86-linux.
==5091== Copyright (C) 2002-2003, and GNU GPL'd, by Julian Seward.
==5091== Using valgrind-20031012, a program supervision framework for
x86-linux.==5091== Copyright (C) 2000-2003, and GNU GPL'd, by Julian
Seward.
==5091== Estimated CPU clock rate is 2830 MHz
==5091== For more details, rerun with: -v
==5091==
foo
==5091== Invalid free() / delete / delete[]
==5091== at 0x4002CD17: free (vg_replace_malloc.c:231)
==5091== by 0x403ADAAB: (within /lib/libc-2.3.2.so)
==5091== by 0x403AD7F4: __libc_freeres (in /lib/libc-2.3.2.so)
==5091== by 0x4018B3C5: vgPlain___libc_freeres_wrapper
(vg_intercept.c:831)
==5091== by 0x402CD927: exit (in /lib/libc-2.3.2.so)
==5091== by 0x402B7DAD: __libc_start_main (in /lib/libc-2.3.2.so)
==5091== by 0x80483D0: ??? (start.S:102)
==5091== Address 0x40251D10 is not stack'd, malloc'd or free'd
==5091==
==5091== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
==5091== malloc/free: in use at exit: 0 bytes in 0 blocks.
==5091== malloc/free: 0 allocs, 1 frees, 0 bytes allocated.
==5091== For a detailed leak analysis, rerun with: --leak-check=yes
==5091== For counts of detected errors, rerun with: -v
jas@latte:~$ gcc -o foo foo.c -lshishi -lnsl
jas@latte:~$ valgrind --num-callers=10 ./foo
==5099== Memcheck, a.k.a. Valgrind, a memory error detector for x86-linux.
==5099== Copyright (C) 2002-2003, and GNU GPL'd, by Julian Seward.
==5099== Using valgrind-20031012, a program supervision framework for
x86-linux.==5099== Copyright (C) 2000-2003, and GNU GPL'd, by Julian
Seward.
==5099== Estimated CPU clock rate is 2826 MHz
==5099== For more details, rerun with: -v
==5099==
foo
==5099==
==5099== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==5099== malloc/free: in use at exit: 0 bytes in 0 blocks.
==5099== malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
==5099== For a detailed leak analysis, rerun with: --leak-check=yes
==5099== For counts of detected errors, rerun with: -v
jas@latte:~$
|