RE: [Qt-root-l] Install QtRoot

From: Fine, Valeri <fine_at_bnl.gov>
Date: Sun, 21 Sep 2008 01:17:14 -0400


> Hi Valeri and everybody,

Hello Louis .  

I found your questions are going beyond QtROOT list scope and took liberty to forward my response to the ROOTTALK list as well. The issue mainly about "ROOT for Windows" rather about "QtROOT for Windows version of ROOT".  

> Thank you another time, I tried to install QtRoot changing the
> build_type=release. Now the release .exe (that uses qtroot or coin3d)
> works perfectly, but the debug not (it doesn't starts)!!!
 

 Thank you very much for your message.
  It made things a little bit more clear.  

> Remark: I think that it's a "problem" of Root's construction, not a
> QtRoot problem. I would like to highlight that every time, in the last 2
> years, when I install the root's packages for windows [the .msi files] ,
> and I use it in a win32 application or .Net Framework application, the
> debug .exe not work, only the release version works!
 

It is not problem of ROOT. It is a feature of the MS run-time / build environment.  

The bottom line:



ROOT is linked against of the "release" DLLs and your main application is linked against of "debug" DLLs (or versa verse) That creates the mess at run time because BOTH set of run-time DLL's are eventually loaded and clashes.
 

To solve the issue TrollTech, for example, builds all its DLLs twice. One for the "debug" mode and another one for "non-debug" and teach the "qmake" to distinguish things properly.

To see what I mean, please, look up you $QTDIR/bin  

$ ls *.dll

Qt3Support4.dll          QtCored4.dll                QtHelp4.dll      QtScriptd4.dll  QtWebKit4.dll
Qt3Supportd4.dll         QtDesigner4.dll             QtHelpd4.dll     QtSql4.dll      QtWebKitd4.dll
QtAssistantClient4.dll   QtDesignerComponents4.dll   QtNetwork4.dll   QtSqld4.dll     QtXml4.dll
QtAssistantClientd4.dll  QtDesignerComponentsd4.dll  QtNetworkd4.dll  QtSvg4.dll      QtXmlPatterns4.dll
QtCLucene4.dll           QtDesignerd4.dll            QtOpenGL4.dll    QtSvgd4.dll     QtXmlPatternsd4.dll
QtCLucened4.dll          QtGui4.dll                  QtOpenGLd4.dll   QtTest4.dll     QtXmld4.dll
QtCore4.dll              QtGuid4.dll                 QtScript4.dll    QtTestd4.dll
 
 

One can realize that each Qt4 package is present twice by 2 DLLs and 2 export libraries, one for the "release" mode and another to "debug". That means, if you want to build the "debug" version of your ROOT-based Qt-application you should be in possession of "debug" ROOT too AND link your application against of the "debug" version of Qt libraries as well. I.e. you have to link against of the libraries with the file name "<qt4_package>d4.lib" To build the "release" version you should be in possession of the ROOT release libraries and link it against of the Qt libraries with the file name "<qt4_package>4.lib"  

That's where the shell script helps.

It is essential for Windows platforms to compile **ALL** components "consistently". It is not what the current ROOT Makefile does. ROOT Makefile links the "qt-layer" against the Qt libraries those the ROOT "configure" discovered at the time.

Check your version of the $ROOTSYS/config/Makefile.config file for the definition of the QTLIB variable. The project built with Qt4 "qmake" utilities does everything properly as soon as Qt libraries are concern. ROOT binary (There is the Qt-based version from BNL) distributions contains only one version of ROOT DLL's for the "release" mode.  

That's why you have that trouble. ROOT is linked against of the "release" DLLs and your main application is linked against of "debug" DLLs (or versa verse) That may create a mess at run time because BOTH set of run-time DLL's are eventually loaded and clashes.  

What that really mean for ROOT Windows user, that means they have to build ROOT twice and provide 2 versions of ROOTSYS, one to debug application and one for the final release. They have to compile their own application twice and separate it also.  

> Questions:
>
> 1) When I wrote about compile a root application statically, I referred
> to include in the compilation only the root's .dll.
 

  You can NOT link the "so-called" WIN32 DLLs statically. It is another MS feature.   To create the "statically linked" Windows application one has to build the   object libraries - *.lib files
  As far as I know there is no Makefile rule in the ROOT Makefile to create   such libraries yet.  

> In other words I would like to know if it's possible to include root's
> .dll inside of my application (remove root's dependencies of my
> application),
 

  The answer is - "No, you can not include Windows DLLs into your application"  

> how can I do that [or maybe there is a compiler option to
> do that?
 

  The Microsoft solution is oulined here:    Visual C++ Concepts: Building a C/C++ Program  "Understanding Manifest Generation for C/C++ Programs"   http://msdn.microsoft.com/en-us/library/ms235542(VS.80).aspx  

Pay your attention to the  

http://msdn.microsoft.com/en-us/library/ms235591(VS.80).aspx <http://msdn.microsoft.com/en-us/library/ms235591(VS.80).aspx> "How to: Embed a Manifest Inside a C/C++ Application" chapter also.  

> For example coin3d have the preprocessor option COIN_NOT_DLL,
> or something like the /MT option for VC++ runtime libraries].
 

  I think one can not compare Coin3D vs ROOT.   Roughly say, the Coin3D is ONE single either DLL or object library.  

  ROOT is a huge "framework" that supplies about > 80 different packages   and the share libraries (DLLs)  

  That makes the difference.

> If it's possible, I think that the dimension of my application will be very Big,
> it's correctly ;-) ?
 

   Yes, it will be huge, it will take a lot of effort to make it work. It will    take enormous amount of time just (several hours) to link your executable.    You will need to spend these hours each time you    change a single line in your code.
   I believe it is too expansive to be practical.    What you should do is to learn the Microsoft tool:    http://msdn.microsoft.com/en-us/library/ms235542(VS.80).aspx <http://msdn.microsoft.com/en-us/library/ms235542(VS.80).aspx>  

> 2) What changes if I install QtRoot using a new Root version > 5.18.00
> (like 5.21).
 

  I believe there are very few things to be changed and it is simple.   However, I believe it is faster for me to answer you   in C-shell language rather in English,.   Please, wait my explanation in "C-shell." ;-)  

> 3) When I tried to compile all qtExemples I found different errors
> caused because Qt 4.4.1 classes are different of Qt3, so with you can
> please actualize it (you know, examples are the best things ;-)).
 

Yes, that's a correct comment. Please, pay your attention, that "qtExamples" contains subdirectory called "Qt4". This subdirectory contains Qt4-based "hello" examples. I still owe the Qt4 version of all current HelloWord tests. However, I have some excuse. The shape of those examples reflects the level of the user's demand. My first priority is to satisfy the orders coming from my STAR collaboration and from CERN ROOT team. If neither ask me to do something I have no ground to spend my paid time for that.

Of course, I'll appreciate if someone else will join to help adjusting these examples for Qt4. This is a "free software" after all      

> So, another time a big thanks for you, Valeri! Thanks for your help!
 

    You are welcome.

                Have a nice day, Valeri
 

________________________________

From: qt-root-l-bounces_at_lists.bnl.gov on behalf of Qt-Root integration project Sent: Sat 9/20/2008 12:31 PM
To: qt-root-l_at_lists.bnl.gov
Subject: [Qt-root-l] Install QtRoot

Hi Valeri and everybody,  

Thank you another time, I tried to install QtRoot changing the build_type=release. Now the release .exe (that uses qtroot or coin3d) works perfectly, but the debug not (it doesn't starts)!!!

Remark: I think that it's a "problem" of Root's construction, not a QtRoot problem. I would like to highlight that every time, in the last 2 years, when I install the root's packages for windows [the .msi files] , and I use it in a win32 application or .Net Framework application, the debug .exe not work, only the release version works!

Questions:

  1. When I wrote about compile a root application statically, I referred to include in the compilation only the root's .dll.

In other words I would like to know if it's possible to include root's .dll inside of my application (remove root's dependencies of my application), how can I do that [or maybe there is a compiler option to do that? For example coin3d have the preprocessor option COIN_NOT_DLL, or something like the /MT option for VC++ runtime libraries]. If it's possible, I think that the dimension of my application will be very Big, it's correctly ;-) ?

2) What changes if I install QtRoot using a new Root version > 5.18.00 (like 5.21).

3) When I tried to compile all qtExemples I found different errors caused because Qt 4.4.1 classes are different of Qt3, so with you can please actualize it (you know, examples are the best things ;-)).  

So, another time a big thanks for you, Valeri! Thanks for your help!

Cheers,

Louis Received on Sun Sep 21 2008 - 07:17:28 CEST

This archive was generated by hypermail 2.2.0 : Sun Sep 21 2008 - 23:50:02 CEST