Libtool gdb

From Sidvind
Jump to: navigation, search

When using libtool you cannot directly execute gdb or other tools as the executable is hidden until installed, instead you are presented with:

 # gdb ./executable
 "/path/to/executable": not in executable format: File format not recognized

Libtool uses a small wrapper shellscript to setup LD_LIBRARY_PATH for you so you don't have to do it manually or worse run against the wrong version of the library (e.g. system version). The real executable is usually located in .libs/executable. However using gdb .libs/executable is not recommended. Instead ask libtool to execute the application for you:

libtool --mode=execute gdb ./executable
libtool --mode=execute valgrind ./executable
libtool --mode=execute whatever ./executable