[CMake] No debugging symbols found when using -DCMAKE_BUILD_TYPE=Debug
Esch Nigma
eschnigma at openmailbox.org
Wed Jun 1 08:10:41 EDT 2016
Hello all,
I just registered to this mailing list, my apologies if this was already discussed.
I'm experiencing an issue where I'm unable to debug my code when the project is
configured with CMake. When running gdb on the final binary, it mentions that no
debugging symbols are found. I tried this via the command line, and through QT Creator.
After asking on StackOverflow, I was given a workaround - Cmake fails to figure out the
compiler identification automatically. Adding -DCMAKE_CXX_COMPILER_ID:STRING=GNU
makes it all work just fine. However, it should still detect it automatically.
I've built an empty Hello world to display this:
[eschnigma at manjaro quicktest]$ cat main.cpp #include<iostream> using namespace
std;
int main(){ cout << "Hello there"; }
When I build into a subdirectory and try to debug, this is the output:
[eschnigma at manjaro build]$ cmake .. -DCMAKE_BUILD_TYPE:STRING="Debug"
*Scanning dependencies of target qtest*
[100%] Building CXX object CMakeFiles/qtest.dir/main.cpp.o
*Linking CXX executable qtest*
[100%] Built target qtest
[eschnigma at manjaro build]$ gdb qtest GNU gdb (GDB) 7.11 Copyright (C) 2016 Free
Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/
licenses/gpl.html> This is free software: you are free to change and redistribute it. There is
NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty"
for details. This
GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details. For bug reporting instructions, please
see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other
documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>.
For help, type "help". Type "apropos word" to search for commands related to "word"...
Reading symbols from qtest...(no debugging symbols found)...done. (gdb)
However - when I compile manually, it works fine:
[eschnigma at manjaro quicktest]$ c++ -g main.cpp [eschnigma at manjaro quicktest]$
gdb a.out GNU gdb (GDB) 7.11 Copyright (C) 2016 Free Software Foundation, Inc. License
GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free
software: you are free to change and redistribute it. There is NO WARRANTY, to the extent
permitted by law. Type "show copying" and "show warranty" for details. This GDB was
configured as "x86_64-pc-linux-gnu". Type "show configuration" for configuration details.
For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at: <http://www.gnu.org/
software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for
commands related to "word"... Reading symbols from a.out...done. (gdb) quit
I have tested this on cmake version 2.8.11.2 and 3.5.2.
This problem started happening a few days ago, on two different machines, both running
Manjaro Linux.
I'll be able to continue coding for now, but I wanted to report on this anyway - as far as I
know, it should all be automatic.
Thanks,
Esch
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160601/ab6c626f/attachment-0001.html>
More information about the CMake
mailing list