Page 1 of 1

Debugging when plugins are enabled

Posted: Fri Nov 04, 2016 7:31 am
by vinayan
hi,

First of all, I have to say that this is an awesome project. Just started playing around with cloudcompare. I hope to get myself familiar with the API in a few weeks. I would be glad to contribute small bug fixes. I have some experience having contributed to the QGIS project.

I built cc on Windows 7 using QtCreator(Qt 5.7.0 Msvc 2015 x64). Everything looked fine but I am not able to debug the plugins. In debug mode the plugins menu is disabled. As shown below, only QSRA plugin is enabled. Use_LIBLAS is OFF(i had doubt whether this was causing issue).

Any idea why this happens? When i look at the console, it has this message there.

Code: Select all

[12:54:19] [Plugin] File 'QSRA_PLUGINd.dll' doesn't seem to be a valid plugin	(The plugin 'E:/CloudCompare/install2015/debug/CloudCompare/plugins/QSRA_PLUGINd.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.))
build.png
build.png (18.52 KiB) Viewed 5620 times
console.png
console.png (34.47 KiB) Viewed 5620 times

Re: Debugging when plugins are enabled

Posted: Fri Nov 04, 2016 6:26 pm
by daniel
Pretty weird indeed... Is the main application actually compiled with Qt debug libraries?

Re: Debugging when plugins are enabled

Posted: Sat Nov 05, 2016 4:31 am
by vinayan
I installed Qt actually. Did not compile it.

Re: Debugging when plugins are enabled

Posted: Sat Nov 05, 2016 5:19 am
by daniel
In the title bar of the main window, what do you read?

Re: Debugging when plugins are enabled

Posted: Thu Nov 10, 2016 12:53 pm
by vinayan
hi,

It is 2.8 beta as shown below. Anyway , I am getting around without debugging using old school logging.
titlebar.png
titlebar.png (34.87 KiB) Viewed 5592 times
thank you for the time.

Re: Debugging when plugins are enabled

Posted: Fri Nov 11, 2016 10:22 am
by daniel
I just wanted to make sure that the application was compiled in DEBUG mode... But this is puzzling, because it implies that the plugins are compiled in release mode?!

Re: Debugging when plugins are enabled

Posted: Mon Nov 14, 2016 11:21 am
by vinayan
I got it to work in debug mode by doing the below change in CMakePluginTpl.cmake. Commented out the QT_NO_DEBUG
My knowledge of CMake system is below basic so I dont know what this is even doing ;)

Now I can run the application from install location and then use QTCreator's "attach to running application". hits my plugin breakpoint.

Code: Select all

# Plugins need the QT_NO_DEBUG preprocessor in release!
if( NOT CMAKE_CONFIGURATION_TYPES )
    #set_property( TARGET ${PROJECT_NAME} APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_DEBUG )
    set_property( TARGET ${PROJECT_NAME} APPEND PROPERTY COMPILE_DEFINITIONS )
else()

Re: Debugging when plugins are enabled

Posted: Mon Nov 14, 2016 7:53 pm
by daniel
Interesting! Thanks for the feedback.

I never went through this part of the code. When working in 'single configuration' mode, how do you specify to CMake that you are building in Debug mode? We should be able to detect that and use this information to enable or disable the QT_NO_DEBUG macro.