I need help building debug root .dll

I have recently moved from root 5.16/0 to 5.21/6 on vista. I built the root binaries from source using visual studio 2008. They all work fine. I have a user application (dll) that I build with the root binaries - I run it from root.exe using gROOT->Load(“myapp.dll”). It all works fine in release mode. However when I build myapp.dll in debug mode, the gROOT->Load() command gives a bunch of warnings[quote]Warning in TClassTable::Add: class XXX already in TClassTable
[/quote] where many of the classes XXX in myapp.dll are listed, but not all of them. In addition to warning messages, I get access violations when I try to do anything.

I did not have this trouble with debug dll in 5.16/0. I did change my user projects: I added libMathcore.lib to the library list and I added the compiler option -FI"w32pragma.h"

Any help would be appreciated. Thanks!

Ed

Hi Ed,

To build Root applications in debug mode, Root must also be built in debug mode. Microsoft doesn’t allow to mix debug/non-debug code in its STL implementation (some STL signature change between debug and release…)

Cheers,
Bertrand.

Hi Betrand,
So, this is a new feature of root? I need to keep debug root binaries if I want to run my application in debug mode?

Also, this version of root seems much more stable with respect to gdk issues on my dual quad-core machine than 5.16 - you may recall some of my posts from earlier this year. Did you fix something? Thanks!!

ed

Hi Ed,

Well, the new feature is that now Root uses the native MS implementation of STL, to avoid possible clash with applications using external libraries (e.g. using boost). Previously there was a special compiler flag to bypass this incompatibility… But we cannot force people to recompile all their other external libraries using this flag to force compatibility with Root…
And yes, we worked quite a lot to improve stability and usability (e.g. now when you resize a canvas, the graphics inside is updating while resizing :slight_smile:)
Glad to see you noticed the difference! :smiley:

Cheers,
Bertrand.

Bertrand,
Yes, the stability is awesome - gdk has not crashed yet…

Sadly my code is not so robust and I still depend upon the debugger… I build the root binaries (using export ROOTBUILD=debug in cygwin - and typing chmod 751 lib/* each time make crashes…) and built MyApp.dll using /MDd (debug multi-threaded dll runtime) instead of the usual /MD (multi-threaded dll) and I get the same warnings as before and a memory related access violation (deleting a string) - the traceback in far more detailed now, but alas, I cannot debug my app… Any other things Ishould be doing? Thanks

Ed

Hi Ed,

You should type “make distclean” and then configure with the option “–build=debug”.
This must work (I’m always using debug build fro development…)

Cheers,
Bertrand.

Bertrand,
I was able to build and run my applications debug w/ 5.21/06 (Windows Vista, C++2008) once I linked against debug root libraries.

However, I seem to have the same problem now with 5.22/0 - even with debug root libraries I get the “Warning in TClassTable::Add class XXX already in TClassTable” message as soon as do a gSystem->Load() and my application fails - all of my objects return 0 when IsA() is called. IS there anything else that occurred going from 5.21/06 and 5.22/0 that I should know about? I built the binaries from sources in the released tar file. Thanks
Ed

Hi Ed,

Would you be able to provide a complete running example reproducing this problem? The 2 potential suspect is that you are somehow creating twice the dictionary for the named classes and/or that there is an issue with rootmap files.

Cheers,
Philippe.

Hello Philippe,
I will attempt to produce a minimal project that demonstrates the problem - its not as easy as it sounds… In the mean time, can you share some of your thoughts? How could my dictionary be created more than once? Also, I do not use rootmap files - should I? (when I load and compile a script with .L script.cpp+, I notice that a rootmap file gets created. But there is no rootmap file associated with the build of my application) Also, the problem I have is only with debug code, not release.

Some other details:
I built root binaries from 5.22/0 source tar file using cygwin and VC++ 9 - all default settings, except debug build used ROOTBUILD=debug

I build my application (a dll) with Visual Studio 2008 (used VC++ 9) on Vista.

I’ve noticed that signal/slot is behaving oddly since going from 5.18 to 5.21 and 5.22: I use signal/slot to update status bar from within long compute loops - just to let user know something is happening. The status bar updates for a while, then freezes (though loops continue)

Thanks!
Ed

[quote]How could my dictionary be created more than once?[/quote]Because you ask for them (directly or indirectly via ACliC for example) … more seriously [quote] Also, the problem I have is only with debug code,[/quote] which is a bit weird but good because then you could attach a break point to TObject::Warning and ::Warning and see exactly where the 2nd definition comes from (by looking at the stack trace).

[quote]I build my application (a dll) with Visual Studio 2008 (used VC++ 9) on Vista[/quote].That does not sound related but support for STL container (especially in the debug build) was broken in v5.22 and was corrected yesterday on the svn trunk.

[quote]I’ve noticed that signal/slot is behaving oddly since going from 5.18 to 5.21 and 5.22: I use signal/slot to update status bar from within long compute loops - just to let user know something is happening. The status bar updates for a while, then freezes (though loops continue) [/quote]Please file a separate report (either in Forum or Savannah) so that Bertrand can take a look.

Cheers,
Philippe.

Philippe,
I could not make a stand-alone dll that behaves badly, but we were able to make a standalone .exe that behaves badly in debug. Attached is a Visual Studio 2008 project.

Thanks
Ed
testROOT.zip (13.3 KB)

Hi,

I was able to build your project, I ran the executable via both the project and via the command line: $ Debug/Tipsim1.exe

and did not see any output.

Note that in order to build a debug build of ROOT on windows, you must use the option --build=debug on the command line.

Cheers,
Philippe.