qtcreator cannot debug with cmake debug-build
-
Platform: openSUSE linux 15.2
cmake-3.17.0
g++-7.5.0
Qt Creator 4.12.0 Based on Qt 5.12.7 (GCC 7.5.0, 64 bit)I'm using qtcreator to debug my c++ program build by cmake. I'm sure it's a debug version and verified debug by gdb.
However, everytime I press debug button, the process started, the cursor stopped on the first breakpoint, but the output was something wrong like this:can't find linker symbol for virtual table for
CFieldClassifier' value found
std::allocator<char>::~allocator()@got.plt' instead
can't find linker symbol for virtual table forCFieldClassifier' value found
std::allocator<char>::~allocator()@got.plt' instead
can't find linker symbol for virtual table forCMaskEngine' value can't find linker symbol for virtual table for
CMaskEngine' value
can't find linker symbol for virtual table forCOpticalFilm' value can't find linker symbol for virtual table for
COpticalFilm' value
can't find linker symbol for virtual table forCSificAppl' value can't find linker symbol for virtual table for
CSificAppl' value
can't find linker symbol for virtual table forCFieldClassifier' value found
std::allocator<char>::~allocator()@got.plt' instead
can't find linker symbol for virtual table forCFieldClassifier' value found
std::allocator<char>::~allocator()@got.plt' insteadGDB doesn't produce this kind of output and the debug progress is fluent.
I created a trial c++ project with cmake build in qtcreator. Then the debug is ok.
It may be some wrong configuration in my CMakeLists.txt, but debug works well with manual GDB, with kdevelop and vs code. I cannot figure why and looking for help.Following is my CMakeLists.txt content:
cmake_minimum_required(VERSION 3.5) project(f4_library) ############################################################ # Create a library: Olambda ############################################################ set(lib_SOURCES boostwrappers.cpp basicgeometry.cpp copticalnumerics.cpp engines/cilluminationengine.cpp engines/cmaskengine.cpp engines/cfilmstackengine.cpp engines/cprojectionengine.cpp engines/cchemicalengine.cpp engines/copticssolver.cpp mathOL.cpp engines/cvariationengine.cpp applications/ccalibappl.cpp applications/csificappl.cpp engines/cfilmstacksolution.cpp geometryOL.cpp engines/celectricalengine.cpp applications/copcappl.cpp engines/cresistengine.cpp engines/cetchingengine.cpp engines/clithoengine.cpp engines/cexposureengine.cpp oltree.cpp optimizers.cpp polynomials.cpp cpageandbookt.cpp basictypes.cpp cvectorandfieldt.cpp cvarvar.cpp cdpmanager.cpp cambitzone.cpp olenv.cpp engines/cenginebase.cpp applications/capplbase.cpp engines/cshapeengines.cpp cfiledatabitmap.cpp engines/cmaterialsliceengine.cpp ccontours.cpp engines/cmaterialdomainengine.cpp cioport.cpp cgeometryprocessor.cpp engines/ccirsymcvs2vtrvv.cpp cappandengbase.cpp cvsformt.cpp engines/cpebperturb.cpp cfieldclassifier.cpp clayoutpaintpage.cpp engines/cpebengine.cpp engines/cdeveloperengine.cpp cpockettester.cpp gdsio.cpp engines/cpagengine.cpp EulerPEB.cpp FastMarch.cpp ) add_library(Olambda SHARED ${lib_SOURCES}) set_target_properties(Olambda PROPERTIES PREFIX "") #add_compile_options(-M -MT -ftemplate-depth-100) target_include_directories(Olambda PUBLIC ${PROJECT_SOURCE_DIR} PUBLIC ${PROJECT_SOURCE_DIR}/engines PUBLIC /usr/include/python3.6m PUBLIC /usr/local/include PUBLIC /usr/local/include/klayout PUBLIC /usr/local/include/freeglut ) target_link_libraries(Olambda PUBLIC m PUBLIC pthread PUBLIC fftw3f PUBLIC python3.6m PUBLIC boost_python36 PUBLIC boost_system PUBLIC klayout_drc PUBLIC klayout_db ) target_compile_definitions(Olambda PRIVATE HAVE_CONFIG_H FFTW_IN_FLOAT PIC) set_target_properties(Olambda PROPERTIES LINK_FLAGS "-Bdynamic") # copy olambda to python-app directory add_custom_command(TARGET Olambda POST_BUILD COMMAND $(CMAKE_COMMAND) -E copy $<TARGET_FILE:Olambda> ${PROJECT_SOURCE_DIR}/../../f4-python COMMENT "Olambda is copied" ) add_library(Olambda_static STATIC ${lib_SOURCES}) target_compile_definitions(Olambda_static PRIVATE HAVE_CONFIG_H FFTW_IN_FLOAT PIC) set_target_properties(Olambda_static PROPERTIES LINK_FLAGS "-Bdynamic") target_include_directories(Olambda_static PUBLIC ${PROJECT_SOURCE_DIR} PUBLIC ${PROJECT_SOURCE_DIR}/engines PUBLIC /usr/include/python3.6m PUBLIC /usr/local/include PUBLIC /usr/local/include/klayout PUBLIC /usr/local/include/freeglut ) target_link_libraries(Olambda_static PUBLIC m PUBLIC pthread PUBLIC fftw3f PUBLIC python3.6m PUBLIC boost_python36 PUBLIC boost_system PUBLIC klayout_drc PUBLIC klayout_db ) ############################################################ # Create a app: sific ############################################################ add_executable(sific executable/do_sific.cpp) #add_compile_options( -MT ) target_include_directories(sific PUBLIC ${PROJECT_SOURCE_DIR} PUBLIC ${PROJECT_SOURCE_DIR}/engines PUBLIC /usr/include/python3.6m PUBLIC /usr/local/include PUBLIC /usr/local/include/klayout PUBLIC /usr/local/include/freeglut ) target_compile_definitions(sific PRIVATE HAVE_CONFIG_H FFTW_IN_FLOAT PIC) target_link_libraries(sific PUBLIC klayout_tl PUBLIC Olambda ) # copy olambda to python-app directory add_custom_command(TARGET sific POST_BUILD COMMAND $(CMAKE_COMMAND) -E copy $<TARGET_FILE:sific> ${PROJECT_SOURCE_DIR}/../../f4-python COMMENT "sific is copied" ) ############################################################ # Create a app: resist ############################################################ add_executable(resist executable/do_resist.cpp) #add_compile_options(-MT -M -ftemplate-depth-100) target_include_directories(resist PUBLIC ${PROJECT_SOURCE_DIR} PUBLIC ${PROJECT_SOURCE_DIR}/engines PUBLIC /usr/include/python3.6m PUBLIC /usr/local/include PUBLIC /usr/local/include/klayout PUBLIC /usr/local/include/freeglut ) target_compile_definitions(resist PRIVATE HAVE_CONFIG_H FFTW_IN_FLOAT PIC) set_target_properties(resist PROPERTIES LINK_FLAGS "-Bdynamic") target_link_libraries(resist PUBLIC klayout_tl PRIVATE Olambda_static # PUBLIC Olambda ) add_custom_command(TARGET sific POST_BUILD COMMAND $(CMAKE_COMMAND) -E copy $<TARGET_FILE:resist> ${PROJECT_SOURCE_DIR}/../../f4-python COMMENT "resist is copied" )***