valgrind asking for debuginfo libc6-dbg - valgrind

I have gone through the answers related to this error. However, my question is once I have debuginfo of libc, what is the location that i should place this library, in order for valgrind to see it?
I have downloaded valgrind and cross compiled for my target environment.
I tried all different combinations below:
I placed libc in /lib and debuginfo in /lib/debug
renamed debuginfo to libc.debug
exported VALGRIND_LIB to include /lib, /lib/debug
Last but not least, below is the actual error:
==29946== Memcheck, a memory error detector
==29946== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==29946== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==29946== Command: /bin/my_prog
==29946==
valgrind: Fatal error at startup: a function redirection
valgrind: which is mandatory for this platform-tool combination
valgrind: cannot be set up. Details of the redirection are:
valgrind:
valgrind: A must-be-redirected function
valgrind: whose name matches the pattern: strcmp
valgrind: in an object with soname matching: ld-linux-armhf.so.3
valgrind: was not found whilst processing
valgrind: symbols from the object with soname: ld-linux-armhf.so.3
valgrind:
valgrind: Possible fixes: (1, short term): install glibc's debuginfo
valgrind: package on this machine. (2, longer term): ask the packagers
valgrind: for your Linux distribution to please in future ship a non-
valgrind: stripped ld.so (or whatever the dynamic linker .so is called)
valgrind: that exports the above-named function using the standard
valgrind: calling conventions for this platform. The package you need
valgrind: to install for fix (1) is called
valgrind:
valgrind: On Debian, Ubuntu: libc6-dbg
valgrind: On SuSE, openSuSE, Fedora, RHEL: glibc-debuginfo
valgrind:
valgrind: Note that if you are debugging a 32 bit process on a
valgrind: 64 bit system, you will need a corresponding 32 bit debuginfo
valgrind: package (e.g. libc6-dbg:i386).
valgrind:
valgrind: Cannot continue -- exiting now. Sorry.

I encountered the same problem, here is how I resolve it:
Replace the ld-xx.so in /lib path with a debug build.
Here is my case. I'm using Yocto to build rootfs, so copy poky/build/tmp/work/xxxx/glibc/2.26-r0/image/lib/ld-2.26.so from your build path to Linux FS path /lib, to replace original /lib/ld-2.26.so(and ld-linux-armhf.so.3) of release build.
After doing this, valgrind works fine.
WARNING: Exchanging the loader on a running system can brick it! These steps work:
Upload new loader to target to a path outside /lib
mark new loader as executable (chmod 755)
copy (don't move!) old loader
copy new loader to /lib

If the target is glibc, you need to make sure that .symtab is not stripped from the dynamic loader (/lib/ld-linux-armhf.so.3). valgrind needs these symbols to work.

Related

How to fix libtool: undefined symbols not allowed in x86_64-pc-msys shared

I am trying to build heimdal package for msys2. To my dismay, during linking of the first constituent library, roken, dlls fail to be built, and that causes sort of a chain reaction further on.
The only message i get is:
libtool: undefined symbols not allowed in x86_64-pc-msys shared ... only static will be built
however, there is no information provided on what symbols are undefined. How can i find that out?
If i turn on output of commands wuth make V=1 i get libtool command that links from a large numbert of .lo files. If i try to run gcc over them (copying command from there), it does not recognize them as anything.
I am trying to follow instructions as outlined in msys2 package build script for heimdal.
On Windows building a shared library while allowing undefined symbols is not allowed.
Try to build with the -Wl,-no-undefined linker flag, for example by adding LDFLAGS="-Wl,-no-undefined" to the ./configure command.
If that didn't work try this after ./configure and before make:
sed -i.bak -e "s/\(allow_undefined=\)yes/\1no/" libtool
If you already had a failed build earlier you should also clean up any .la files like this before running make again:
rm $(find -name '*.la')

CMake Error: Remove failed on file System Error: Device or resource busy

When trying to cmake a CGAL example, I get
CMake Error: Remove failed on file:
/cgal/example/CMakeFiles/CMakeTmp/cmTC_9e180.exe: System Error: Device or resource busy
Working under Win10 + Msys2.
CGAL was obtained via pacman (local/mingw-w64-x86_64-cgal 4.13-1).
Since I did not find the CGAL examples in any Msys2 package,
it was copied from file /usr/share/doc/libcgal13/examples.tar.gz, which was obtained in an Ubuntu system with
$ sudo apt-get install libcgal-demo
The example is reconstruction_surface_mesh.cpp from examples/Advancing_front_surface_reconstruction.
I wouldn't know if the origin of the error is specific to my CMakeLists.txt, or else.
Related, but AFAICT not providing the answer:
https://cmake.org/pipermail/cmake-developers/2010-November/012619.html
https://gitlab.kitware.com/cmake/cmake/issues/17566
https://github.com/TadasBaltrusaitis/OpenFace/issues/634
CMake: how to use INTERFACE_INCLUDE_DIRECTORIES with ExternalProject?
https://www.google.com/search?safe=off&q=CMake+Error+in+CMakeLists.txt%3A+++Imported+target+includes+non-existent+path+in+its+INTERFACE_INCLUDE_DIRECTORIES.++Possible+reasons+include

install valgrind, Fatal error at startup

I am installing Valgrind but encounter some problems. The info of my platform:
Linux xx-ThinkPad-X61 3.2.0-39-generic-pae #62-Ubuntu SMP Wed Feb 27 22:25:11 UTC 2013 i686 i686 i386 GNU/Linux
I follows the installation instruction of the README file in the valgrind folder.
./configure ->make -> sudo make install.
I can't understand the following reminder in the README file, I just overlooked it.
Important! Do not move the valgrind installation into a place
different from that specified by --prefix at build time. This will
cause things to break in subtle ways, mostly when Valgrind handles
fork/exec calls.
after typing "valgrind ls -l", error appears:
xx#xx-ThinkPad-X61:~/Downloads/valgrind-3.8.1$ valgrind ls -l
==7674== Memcheck, a memory error detector
==7674== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==7674== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==7674== Command: ls -l
==7674==
valgrind: Fatal error at startup: a function redirection
valgrind: which is mandatory for this platform-tool combination
valgrind: cannot be set up. Details of the redirection are:
valgrind:
valgrind: A must-be-redirected function
valgrind: whose name matches the pattern: strlen
valgrind: in an object with soname matching: ld-linux.so.2
valgrind: was not found whilst processing
valgrind: symbols from the object with soname: ld-linux.so.2
valgrind:
valgrind: Possible fixes: (1, short term): install glibc's debuginfo
valgrind: package on this machine. (2, longer term): ask the packagers
valgrind: for your Linux distribution to please in future ship a non-
valgrind: stripped ld.so (or whatever the dynamic linker .so is called)
valgrind: that exports the above-named function using the standard
valgrind: calling conventions for this platform. The package you need
valgrind: to install for fix (1) is called
valgrind:
valgrind: On Debian, Ubuntu: libc6-dbg
valgrind: On SuSE, openSuSE, Fedora, RHEL: glibc-debuginfo
valgrind:
valgrind: Cannot continue -- exiting now. Sorry.
Could someone give some suggestions?
thanks!
I also faced this error, but finally resolved in below manner.
I am having 64 bit Ubuntu 14.04, and my executable is 32 bit. When I run my 32 bit executable with valgrind I got this same error. This error was not resolved even after installing libc6-dbg (using command apt-get install libc6-dbg).
Later I found like whatever libc6-dbg present in my machine was 64 bit and valgrind requires a 32 bit libc6-dbg to run my 32 bit executable. After installing 32 bit libc6-dbg (using the command apt-get install libc6-dbg:i386) it started working.
Valgrind indicates it cannot work because it is missing the libc debug info,
and it indicates which package has to be installed to solve that.
In your case (Ubuntu), you must install
libc6-dbg
apt install -y libc6-dbg
It worked for me. (Note: without :i386.)
A hunch is that Valgrind might have upgraded to 64-bit since the answer
by rashok was written.

gdb does not find any symbols when analysing a coredump since a migration to cmake compilation chain

I have a project that compiled an executable with codeblocks. I have modified the compilation chain to use CMAKE. The compilation and execution works well.
The problem is that when a coredump is generated after a crash. I analyse it with gdb with the command: gdb myapp --core=core.1222
If I runs gdb on the computer where executable has been generated, I get all symbols and I can explore threads and local variables.
The problem is when I try to run gdb on another computer, it does not manage to get any symbol. I got the following warning:
BFD: Warning: /home/.../core.1222 is truncated: expected core file size >= 307032064, found: 307027968
"info threads" in gdb display ?? instead function name.
My CMakeLists.txt contains:
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ../bin )
SET(CMAKE_USE_RELATIVE_PATHS ON)
SET(CMAKE_VERBOSE_MAKEFILE ON)
SET(CMAKE_CXX_COMPILER g++)
SET(CMAKE_BUILD_STRIP FALSE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
I had compare the invoked make command used by codeblocks and cmake. There are quite similarly except the option -o:
with cmake
-o CMakeFiles/monappilcation.dir/home/.../main.cpp.o
and with codeblock:
-o obj/Release/.../main.cpp.o
The command nm -a display all the symbols correctly.
My questions are:
How does gdb compute the expected size?
How can I retrieve the symbol by using cmake compilation tool chain?
Any of your suggestions will be welcome.

How to compile rabbitmq-c library on Mac OS X?

I'm failing to compiled the rabbitmq-c library on Mac OS 10.6.6
I intend to build the php-ampq extension against it.
I've tried both the latest branch of rabbitmq-c and rabbitmq-codegen according to the instructions here and the specific branches according to the instructions here.
Running autoreconf -i as per instructions I get:
glibtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
glibtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
glibtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
configure.ac:12: installing `./config.sub'
configure.ac:12: required file `./ltmain.sh' not found
configure.ac:3: installing `./missing'
configure.ac:3: installing `./install-sh'
configure.ac:12: installing `./config.guess'
examples/Makefile.am: installing `./depcomp'
autoreconf: automake failed with exit status: 1
Running simply autoconf I get:
configure.ac:3: error: possibly undefined macro: AM_INIT_AUTOMAKE
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:12: error: possibly undefined macro: AM_PROG_LIBTOOL
configure.ac:90: error: possibly undefined macro: AM_CONDITIONAL
Most of what I can find by searching online suggests I don't have libtool or automake. I have both.
I'm afraid I'm out of my depth with autoconf, so I don't know how/where to alter configure.ac, or whether the warning is anything do with the missing ltmain.sh file.
I solved the same problem by installing pkg-config:
sudo port install pkgconfig