I am trying to build ROOT 5.06 on alpha OSF1 V5.1 with support for QT 3.4.4. QT was built succesfully on the platform (I have tested it).
I succeeded in building ROOT without qt suport, using the platform “alphacxx6” when when I tried to add QT layer support, I got a bunch of error messages like the followings:
cxx -O -tlocal -D__osf__ -D__alpha -Iinclude -long_double_size 64 -DQT_DLL -DQT_THREAD_SUPPORT -I. -I/home/is102438/guillo/QT/QT3/OSF1/include -o qt/src/GQtGUI.o -c qt/src/GQtGUI.cxx
cxx: Error: /usr/lib/cmplrs/cxx/V6.5-014/include/cxx/iosfwd, line 139:
redefinition of default argument
template<class T, class charT = char, class traits=char_traits >
or,
cxx: Error: include/Riosfwd.h, line 25: “istream” has already been declared in the current scope using std::istream;
I am not sure where the confusion comes from. To debug this you would need to look at the preprocessed output to see where (and why) the double definition/declaration is coming from.
I.e. you would run:cxx -E -O -tlocal -D__osf__ -D__alpha -Iinclude -long_double_size 64 -DQT_DLL -DQT_THREAD_SUPPORT -I. -I/home/is102438/guillo/QT/QT3/OSF1/include qt/src/GQtGUI.cxx > GQtGUI.EIn the file GQtGUI.E you would look for where istream is declared twice and you would look at the series of line like #line 123 (or #123) filename to see where those file where included from. You also need to go back to the original file to see which #ifdef lead to this situation.
I am trying to build ROOT 5.06 on alpha OSF1 V5.1 with support for QT 3.4.4. QT was built succesfully on the platform (I have tested it).
I succeeded in building ROOT without qt suport, using the platform “alphacxx6” when when I tried to add QT layer support, I got a bunch of error messages like the followings:
cxx -O -tlocal -D__osf__ -D__alpha -Iinclude -long_double_size 64 -DQT_DLL -DQT_THREAD_SUPPORT -I. -I/home/is102438/guillo/QT/QT3/OSF1/include -o qt/src/GQtGUI.o -c qt/src/GQtGUI.cxx
cxx: Error: /usr/lib/cmplrs/cxx/V6.5-014/include/cxx/iosfwd, line 139:
redefinition of default argument
template<class T, class charT = char, class traits=char_traits >
or,
cxx: Error: include/Riosfwd.h, line 25: “istream” has already been declared in the current scope using std::istream;
I would like to mention that Qt layer does not use at all .
( Did you build your Qt with “stl” support ? )
This suggests, you faced some “side effect”. The problem comes from some clash between iostream defined somewhere inside of Qt and ROOT include files.
You may want to play with the
Yes, I did buid Qt with stl support, just because I like to use STL (std::string instead of QString and the STL containers over QT containers).
I tried to install the QT-Layer from BNL as you suggested, applied qmake and… had the same error messages.
I believe that you are right about the Riostream.h answer and will try it right away.
and at compilation time I had some errors about the std::cout not being in the iostream file.
Now, if I add the macro " -D__USE_STD_IOSTREAM " on the compilation command line then everything is fine.
I tried to add this to the “EXTRA_CXXFLAGS” in the config/Makefile.alphacxx6 but then CINT would not compile! (cf root.cern.ch/root/Cint.phtml?faq) due to the fact that it doesn’t use standard iostream.
My next move is to build everything as before (no QT support), and after it finishes, modifie the EXTRA_CXXFLAGS to add the “-D__USE_STD_IOSTREAM”, rerun configure with QT support and see if it compiles.
This affects also the new Minuit2 package as well as OpenGL support.
I will check that QT uses the _USE_STD_IOSTREAM. I am not quite sure, I thought that using the “-stl” flag with configure would do it.
However there is a problem with ROOT somehow: I checked that in the sources I have downloaded (version 5.06) I have the RConfig.h you described. Nethertheless I seemes that when QT support is used, it doesn’t use it. When I force the macro to be defined on the command line, everything works fine!
May be RConfig.h is not used in the qt and qtroot packages and hence the macro _USE_STD_IOSTREAM is not defined?
For now, my problem is fixed, but I had to used the trick I told you: build everything normally without QT support, and then modify the EXTRA_CXXFLAGS Mafefile.alphacxx6 to define _USE_STD_IOSTREAM.
May be RConfig.h is not used in the qt and qtroot packages and hence the macro _USE_STD_IOSTREAM is not defined?
[/quote]
May I ask you for a favor?
Can you add explicitly
#include "RConfig.h"
as the very fist statement of GQtGUI.cxx followed by all other “includes”? If that that provies a remedy I’ll patch the “root/qt”
On the other hand I expected “qmake” to add this option to the compilation rule. I.e. the sequence “qmake”/ “make” should provide the proper compilation option. The compilation optios are defined by
Can you “grep” the “Makefile” “qmake” creates for the CPP flag in question. If the proper flag is not there then you should have filed the Qt bug report also
Hi Valeri.
Yes, it does provide a remedy. But I had to do this on every single .cxx file under qt/
[quote/]
On the other hand I expected “qmake” to add this option to the compilation rule. I.e. the sequence “qmake”/ “make” should provide the proper compilation option. The compilation optios are defined by
$QTDIR/mkspecs/tru64-cxx/qmake.conf
Can you “grep” the “Makefile” “qmake” creates for the CPP flag in question. If the proper flag is not there then you should have filed the Qt bug report also [/quote]
I checked that qmake doesn’t create the flag for using STD iostream. That’s bad I will report the bug to the QT team.
Even if you fix the qt package, there is still the problem of OpenGL support wich can be fixed the way I did for QT (not convinent but it works) and the Minuit2 package which has its own configure and for wich I don’t have a solution right now.
[quote=“matthieuguillo”]Hi Valeri.
Yes, it does provide a remedy. But I had to do this on every single .cxx file under qt
[/quote]
No, you do not. All Qt sources have to contain (directly indirectly ) “TQtRConfig.h”. It must be sifficient. So what you found is my bug to be fixed.
I would appreciate you apply the patch below to see whether your problem still persists. The patch is just to move the include “TQtRConfig.h” to the very first position.
Thank you
The fix succeeded to compile GQtGUI.cxx failed on but then failed on GQtGUIThread.cxx. I am not sure to understand why.[/quote]
Mt guess, this is because the first include in GQtGUIThread.cxx is
include <qapplication.h> followded by #include “TQtThread.h”. One shoudle invert the order. I.e insated of
[code]#include <qapplication.h>
#include “TQtThread.h”[/code]
try
#include "TQtThread.h"
#include <qapplication.h>
to make sure “TQtRConfig” goes first, before any Qt header file is read.