Debugging when plugins are enabled

Feel free to ask any question here
Post Reply
vinayan
Posts: 27
Joined: Thu Nov 03, 2016 4:11 pm

Debugging when plugins are enabled

Post 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 5651 times
console.png
console.png (34.47 KiB) Viewed 5651 times
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Debugging when plugins are enabled

Post by daniel »

Pretty weird indeed... Is the main application actually compiled with Qt debug libraries?
Daniel, CloudCompare admin
vinayan
Posts: 27
Joined: Thu Nov 03, 2016 4:11 pm

Re: Debugging when plugins are enabled

Post by vinayan »

I installed Qt actually. Did not compile it.
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Debugging when plugins are enabled

Post by daniel »

In the title bar of the main window, what do you read?
Daniel, CloudCompare admin
vinayan
Posts: 27
Joined: Thu Nov 03, 2016 4:11 pm

Re: Debugging when plugins are enabled

Post 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 5623 times
thank you for the time.
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Debugging when plugins are enabled

Post 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?!
Daniel, CloudCompare admin
vinayan
Posts: 27
Joined: Thu Nov 03, 2016 4:11 pm

Re: Debugging when plugins are enabled

Post 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()
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Debugging when plugins are enabled

Post 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.
Daniel, CloudCompare admin
Post Reply