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@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@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@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@manjaro quicktest]$ c++ -g main.cpp [eschnigma@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
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake