Thread: Profiler Valgrind

  1. #1
    Registered User
    Join Date
    Jul 2008

    Profiler Valgrind

    Hi everyone,

    I'm having trouble with this Valgrind to profile a program I built. I get the following error:

    valgrind: vg_libpthread.c:2331 (open64): Assertion `open64_ptr != ((void *)0) && open64_ptr != open64' failed.

    ==6403== Please report this bug at:

    I am running linux 64bits and valgrind-2.2.0. Anyone know how to fix this or what might be the problem?



  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Looks like you need a later version of Valgrind.

    2.2.0 is really old. I have 3.3.1.

    [edit] I should probably mention that you likely won't have to get the source from CVS by now. Just download 3.3.0 or 3.3.1 or something and everything should be all right.

    If you're using Linux, you might want to use a package manager to upgrade the version on your system. [/edit]
    Last edited by dwks; 07-16-2008 at 02:59 PM.

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell

    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ:

    My website:
    Projects: codeform, xuni, atlantis, nort, etc.

  3. #3
    Registered User
    Join Date
    Jul 2008


    Hi dwks,

    Thank you for your reply. I'm trying to install the latest version, by following the instructions in the README file.
    I configured first

     ./configure --prefix=/usr/local/bin 
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    checking for gawk... gawk
    checking whether make sets $(MAKE)... yes
    checking whether to enable maintainer-specific portions of Makefiles... no
    checking whether ln -s works... yes
    checking for gcc... gcc
    checking for C compiler default output file name... a.out
    checking whether the C compiler works... yes
    checking whether we are cross compiling... no
    checking for suffix of executables...
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether gcc accepts -g... yes
    checking for gcc option to accept ANSI C... none needed
    checking for style of include used by make... GNU
    checking dependency style of gcc... gcc3
    checking how to run the C preprocessor... gcc -E
    checking for g++... g++
    checking whether we are using the GNU C++ compiler... yes
    checking whether g++ accepts -g... yes
    checking dependency style of g++... gcc3
    checking for ranlib... ranlib
    checking for perl... /usr/bin/perl
    checking for gdb... /usr/bin/gdb
    checking for a supported version of gcc... ok (gcc (GCC) 3.4.4 20050721 (Red Hat  3.4.4-2))
    checking build system type... x86_64-unknown-linux
    checking host system type... x86_64-unknown-linux
    checking for a supported CPU... ok (x86_64)
    checking for use as an inner Valgrind... no
    checking for a 64-bit only build... no
    checking for a 32-bit only build... no
    checking for a supported OS... ok (linux)
    checking for the kernel version... 2.6 family (2.6.9-22.ELsmp)
    checking for 32 bit build support... yes
    checking for a supported CPU/OS combination... ok (x86_64-linux)
    checking for egrep... grep -E
    checking the libc version... 2.3 family
    checking for X... libraries /usr/X11R6/lib64, headers /usr/X11R6/include
    checking if gcc accepts -m32... yes
    checking if gcc accepts -maix32... no
    checking if gcc accepts -m64... yes
    checking if gcc accepts -maix64... no
    checking if gcc accepts -mmmx... yes
    checking if gcc accepts -msse... yes
    checking if gcc accepts -mpreferred-stack-boundary... no
    checking if gcc accepts -Wno-pointer-sign ... no
    checking if gcc accepts -Wdeclaration-after-statement ... yes
    checking if gcc accepts -fno-stack-protector ... no
    checking if gcc supports __builtin_expect... yes
    checking if ppc32/64 as supports mtocrf/mfocrf... no
    checking if x86/amd64 assembler speaks SSE3... yes
    checking for TLS support... yes
    checking for ANSI C header files... yes
    checking for sys/types.h... yes
    checking for sys/stat.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for memory.h... yes
    checking for strings.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for unistd.h... yes
    checking sys/endian.h usability... no
    checking sys/endian.h presence... no
    checking for sys/endian.h... no
    checking endian.h usability... yes
    checking endian.h presence... yes
    checking for endian.h... yes
    checking mqueue.h usability... yes
    checking mqueue.h presence... yes
    checking for mqueue.h... yes
    checking for uid_t in sys/types.h... yes
    checking for off_t... yes
    checking for size_t... yes
    checking whether time.h and sys/time.h may both be included... yes
    checking for working memcmp... yes
    checking for stdlib.h... (cached) yes
    checking for unistd.h... (cached) yes
    checking for getpagesize... yes
    checking for working mmap... yes
    checking return type of signal handlers... void
    checking for floor... no
    checking for memchr... yes
    checking for memset... yes
    checking for mkdir... yes
    checking for strchr... yes
    checking for strdup... yes
    checking for strpbrk... yes
    checking for strrchr... yes
    checking for strstr... yes
    checking for semtimedop... yes
    checking primary target for usable MPI2-compliant C compiler and mpi.h... yes, m picc
    checking secondary target for usable MPI2-compliant C compiler and mpi.h... no
    configure: creating ./config.status
    config.status: creating Makefile
    config.status: creating valgrind.spec
    config.status: creating valgrind.pc
    config.status: creating docs/Makefile
    config.status: creating docs/lib/Makefile
    config.status: creating docs/images/Makefile
    config.status: creating docs/internals/Makefile
    config.status: creating docs/xml/Makefile
    config.status: creating tests/Makefile
    config.status: creating tests/vg_regtest
    config.status: creating perf/Makefile
    config.status: creating perf/vg_perf
    config.status: creating include/Makefile
    config.status: creating include/vki/Makefile
    config.status: creating auxprogs/Makefile
    config.status: creating coregrind/Makefile
    config.status: creating memcheck/Makefile
    config.status: creating memcheck/tests/Makefile
    config.status: creating memcheck/tests/amd64/Makefile
    config.status: creating memcheck/tests/ppc32/Makefile
    config.status: creating memcheck/tests/ppc64/Makefile
    config.status: creating memcheck/tests/x86/Makefile
    config.status: creating memcheck/docs/Makefile
    config.status: creating cachegrind/Makefile
    config.status: creating cachegrind/tests/Makefile
    config.status: creating cachegrind/tests/amd64/Makefile
    config.status: creating cachegrind/tests/ppc32/Makefile
    config.status: creating cachegrind/tests/ppc64/Makefile
    config.status: creating cachegrind/tests/x86/Makefile
    config.status: creating cachegrind/docs/Makefile
    config.status: creating cachegrind/cg_annotate
    config.status: creating callgrind/Makefile
    config.status: creating callgrind/callgrind_annotate
    config.status: creating callgrind/callgrind_control
    config.status: creating callgrind/tests/Makefile
    config.status: creating callgrind/docs/Makefile
    config.status: creating helgrind/Makefile
    config.status: creating helgrind/tests/Makefile
    config.status: creating helgrind/docs/Makefile
    config.status: creating massif/Makefile
    config.status: creating massif/tests/Makefile
    config.status: creating massif/perf/Makefile
    config.status: creating massif/docs/Makefile
    config.status: creating massif/ms_print
    config.status: creating lackey/Makefile
    config.status: creating lackey/tests/Makefile
    config.status: creating lackey/docs/Makefile
    config.status: creating none/Makefile
    config.status: creating none/tests/Makefile
    config.status: creating none/tests/amd64/Makefile
    config.status: creating none/tests/ppc32/Makefile
    config.status: creating none/tests/ppc64/Makefile
    config.status: creating none/tests/x86/Makefile
    config.status: creating none/docs/Makefile
    config.status: creating exp-omega/Makefile
    config.status: creating exp-omega/tests/Makefile
    config.status: creating exp-omega/docs/Makefile
    config.status: creating exp-drd/Makefile
    config.status: creating exp-drd/docs/Makefile
    config.status: creating exp-drd/tests/Makefile
    config.status: creating config.h
    config.status: executing depfiles commands
       Primary build target: AMD64_LINUX
     Secondary build target: X86_LINUX
         Default supp files: xfree-3.supp xfree-4.supp glibc-2.34567-NPTL-helgrind.supp glibc-2.3.supp
    but when I try to make, I get this error:
    make  all-recursive
    make[1]: Entering directory `/home/ed/valgrind-3.3.1'
    Making all in include
    make[2]: Entering directory `/home/ed/valgrind-3.3.1/include'
    Making all in vki
    make[3]: Entering directory `/home/ed/valgrind-3.3.1/include/vki'
    make[3]: Nothing to be done for `all'.
    make[3]: Leaving directory `/home/ed/valgrind-3.3.1/include/vki'
    make[3]: Entering directory `/home/ed/valgrind-3.3.1/include'
    make[3]: Nothing to be done for `all-am'.
    make[3]: Leaving directory `/home/ed/valgrind-3.3.1/include'
    make[2]: Leaving directory `/home/ed/valgrind-3.3.1/include'
    Making all in coregrind
    make[2]: Entering directory `/home/ed/valgrind-3.3.1/coregrind'
    make  all-am
    make[3]: Entering directory `/home/ed/valgrind-3.3.1/coregrind'
    make -C ../VEX CC="gcc" AR="ar" pub/libvex_guest_offsets.h
    make[4]: Entering directory `/home/ed/valgrind-3.3.1/VEX'
    make[4]: `pub/libvex_guest_offsets.h' is up to date.
    make[4]: Leaving directory `/home/ed/valgrind-3.3.1/VEX'
    for f in    ; do \
      p=`echo $f | sed -e 's/^[^-]*-//' -e 's/\..*$//'`; \
      n=`echo $f | sed -e 's/-[^-]\{1,\}-[^-.]\{1,\}//'`; \
      mkdir -p ../.in_place/$p; \
      rm -f ../.in_place/$p/$n; \
      ln -f -s ../../coregrind/$f ../.in_place/$p/$n; \
    make[3]: Leaving directory `/home/ed/valgrind-3.3.1/coregrind'
    make[2]: Leaving directory `/home/ed/valgrind-3.3.1/coregrind'
    Making all in .
    make[2]: Entering directory `/home/ed/valgrind-3.3.1'
    mkdir -p ./.in_place
    rm -f ./.in_place/default.supp ./.in_place/glibc-2.2.supp ./.in_place/glibc-2.3.supp ./.in_place/glibc-2.4.supp ./.in_place/glibc-2.5.supp ./.in_place/glibc-2.6.supp ./.in_place/glibc-2.7.supp ./.in_place/glibc-2.8.supp ./.in_place/aix5libc.supp ./.in_place/xfree-3.supp ./.in_place/xfree-4.supp ./.in_place/glibc-2.34567-NPTL-helgrind.supp ./.in_place/glibc-2.2-LinuxThreads-helgrind.supp ./.in_place/glibc-2.X-drd.supp
    ln -s ../default.supp ./.in_place
    ln -s .././glibc-2.2.supp .././glibc-2.3.supp .././glibc-2.4.supp .././glibc-2.5.supp .././glibc-2.6.supp .././glibc-2.7.supp .././glibc-2.8.supp .././aix5libc.supp .././xfree-3.supp .././xfree-4.supp .././glibc-2.34567-NPTL-helgrind.supp .././glibc-2.2-LinuxThreads-helgrind.supp .././glibc-2.X-drd.supp ./.in_place
    make[2]: Leaving directory `/home/ed/valgrind-3.3.1'
    Making all in tests
    make[2]: Entering directory `/home/ed/valgrind-3.3.1/tests'
    make[2]: Nothing to be done for `all'.
    make[2]: Leaving directory `/home/ed/valgrind-3.3.1/tests'
    Making all in perf
    make[2]: Entering directory `/home/ed/valgrind-3.3.1/perf'
    make[2]: Nothing to be done for `all'.
    make[2]: Leaving directory `/home/ed/valgrind-3.3.1/perf'
    Making all in auxprogs
    make[2]: Entering directory `/home/ed/valgrind-3.3.1/auxprogs'
    mpicc -g -O -fno-omit-frame-pointer -Wall -fpic -shared -m64 \
            -I../include \
            -o libmpiwrap.c
    /usr/bin/ld: /usr/lib64/libmpi.a(laminit.o): relocation R_X86_64_32S against `lam_mpi_comm_world' can not be used when making a shared object; recompile with -fPIC
    /usr/lib64/libmpi.a: could not read symbols: Bad value
    collect2: ld returned 1 exit status
    mpicc: No such file or directory
    make[2]: *** [] Error 1
    make[2]: Leaving directory `/home/ed/valgrind-3.3.1/auxprogs'
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory `/home/ed/valgrind-3.3.1'
    make: *** [all] Error 2
    Do I need to install something else before I install valgrind-3.3.1 ?

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    What Linux distro are you using? Looks like Fedora. I can't believe that it doesn't provide a valgrind package. That would be a lot easier than compiling your own.
    For example, here's one for valgrind 3.2.1.

    As for the error, that is due to trying to link against the static libmpi. I don't know why mpicc would do that - either you don't have a dynamic version installed, or perhaps it stupidly tries to link against the static library directly.
    All the buzzt!

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  5. #5
    Registered User
    Join Date
    Jul 2008
    Thank you for your help.

    A friend here helped me install it with.
    yum search valgrind,
    and then yum install.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Bug hunting with Valgrind
    By Smjert in forum C Programming
    Replies: 8
    Last Post: 11-06-2008, 04:21 AM
  2. Code profiler?
    By h3ro in forum Tech Board
    Replies: 5
    Last Post: 04-07-2008, 09:16 AM
  3. Replies: 1
    Last Post: 12-01-2007, 02:06 AM
  4. Is valgrind always right?
    By g4j31a5 in forum Linux Programming
    Replies: 3
    Last Post: 07-16-2007, 10:39 PM
  5. How can I make a .NET profiler?
    By honeysting in forum C# Programming
    Replies: 0
    Last Post: 03-26-2006, 06:30 AM