Fatal error in Windows binary of root version 5.19/02

Dear Rooters

After some effort I could finally port my program to Windows where I can compile it with MS Visual C++.
For this purpose I had installed on WinXP the binary version of ROOT “root_v5.18.00.win32.msi”.

Since the current recommended Windows binary version is “root_v5.19.02.win32.msi”, I have just
removed the old version and installed the new binary.

Sadly, trying to compile my program with the new version results in following error:

C:\home\Rabbitus\CRAN\xps\src>NMAKE /f "Makefile.win32" CFG="Release"

Microsoft (R) Program Maintenance Utility Version 9.00.21022.08
Copyright (C) Microsoft Corporation.  All rights reserved.

        cl  -D_MT -D_DLL -MDd -EHsc -nologo -GR -DWIN32  -DVISUAL_CPLUSPLUS -D_WINDOWS -Ic
:\root/include -D_CRT_SECURE_NO_DEPRECATE -O2 -MD -c TMLMath.cxx
cl : Command line warning D9025 : overriding '/MDd' with '/MD'
TMLMath.cxx
c:\root\include\RConfig.h(480) : fatal error C1189: #error :  Missing #include of %ROOTSYS
%\include\w32pragma.h!
NMAKE : fatal error U1077: '"C:\Programme\Microsoft Visual Studio 9.0\VC\BIN\cl.EXE"' : re
turn code '0x2'
Stop.

Comparing RConfig.h for root version 5.18/00 and 5.19/02 revealed that the following lines were
added in version 5.19/02 after “ifdef _MSC_VER”:

#   if !defined(__CINT__) && !defined(ROOT_w32pragma)
      /* needed for compatibility with ROOT's STL usage */
#     error Missing #include of %ROOTSYS%\include\w32pragma.h!
#   endif

Trying to delete these lines in RConfig.h did not help, probably because I have installed the
binary version of ROOT for Windows.

Is this an error in the new root version?
Is there a workaround, which I could use in my Makefile.win?

Thank you in advance
Best regards
Christian

Hi Christian,

Please add -FIw32pragma.h (force include of w32pragma.h) in the compilation flags (note this has been fixed in svn head).

Cheers, Bertrand.

Dear Bertrand

Thank you for this workaround, do you mean that instead of

	cl /I"${ROOTSYS}/include" /MT /EHsc /Ox /D "MSVC" /D "WIN32" /c TMLMath.cxx

I should write:

	cl /I"${ROOTSYS}/include" /FIw32pragma.h /MT /EHsc /Ox /D "MSVC" /D "WIN32" /c TMLMath.cxx

see my “Makefile.win” for VC++ in topic: root.cern.ch/phpBB2/viewtopic.php?t=6342

Best regards
Christian

Hi Christian,

Yes, just try like this, it should work…

Best, Bertrand.

Dear Bertrand

Thank you, I will try it once I have re-installed the new binary, because at the moment I have downgraded to 5.18/00.

Best regards
Christian

Hi Rooters,
I also have issues with the requirement in RConfig.h to use w32pragma.h. There are four conflicts with the settings in my project. (see the attached file). I think the binary is not built with debugging support. I can measure a 50% vector speed penalty with _HAS_ITERATOR_DEBUGGING defined as 1! However, it must be defined as 1 when I use the VC++ IDE debugger (and I am an IDE debugger addict).
I have attached a modified w32pragma file that I will use temporarily as a local include. It prevents conflicts that run as deep in MFC as tolower.c and strftime.c. VC++ is, in my opinion, not stable enough to allow me to build the entire framework for each release and to be sure that it matches the binary from Cern.
Perhaps the RConfig.h error could apply to Root framework builds but not to user projects?
Cheers,
Steve
w32pragma.h (3.28 KB)

P.S.
Regarding the above post - I include the local w32pragma.h just before Windows4Root.h and after windows specific includes.
Cheers,
Steve

Hi,

the whole point of issuing the Rconfig.h error is to force the user code to include w32pragma.h. It is already included in all of ROOT. The include by user code is needed to pick up a compatible version of MS’s STL library. Ideally you should compile all your sources with -FI:w32pragma.h

I use MSDev with w32pragma.h (and thus _HAS_ITERATOR_DEBUGGING != 1) in debug mode without problems.

Cheers, Axel.

Axel,
Some of my libraries are from other “pure” MFC projects. Building them with “/D _SECURE_SCL=0” allows the -FIw32pragma.h (no colon) approach to work. Thanks.
Cheers,
Steve

Dear Bertrand

Finally, I have re-installed the root binary 5.19/02 to test my Makefile with -FIw32pragma.h as you said.
Although I can now compile the different headers, I get the following linker error:

--- most compilation messages deleted ---

        "C:\Programme\Microsoft Visual Studio 9.0\VC\bin/cl" /I"c:\root/include" /FIw32pragma.h /MT /EHsc /Ox /D "MSVC" /D "WIN32" /c rwrapper.cxx
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

rwrapper.cxx
Generating dictionary xpsDict.cxx...
        "C:\Programme\Microsoft Visual Studio 9.0\VC\bin/cl" /I"c:\root/include" /FIw32pragma.h /MT /EHsc /Ox /D "MSVC" /D "WIN32" /c xpsDict.cxx
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

xpsDict.cxx
        "C:\Programme\Microsoft Visual Studio 9.0\VC\bin/link" /dll /def:xps.def /out:xps.dll fp10.obj  -opt:noref  -nologo -include:_G__cpp_setupG__Hist  -include:_G__cpp_setupG__Graf1 -include:_G__cpp_setupG__G3D  -include:_G__cpp_setupG__GPad -include:_G__cpp_setupG__Tree  -include:_G__cpp_setupG__Rint -include:_G__cpp_setupG__PostScript  -include:_G__cpp_setupG__Matrix -include:_G__cpp_setupG__Physics "c:\root/lib/libCore.lib"  "c:\root/lib/libCint.lib" "c:\root/lib/libHist.lib"  "c:\root/lib/libGraf.lib" "c:\root/lib/libGraf3d.lib"  "c:\root/lib/libGpad.lib" "c:\root/lib/libTree.lib"  "c:\root/lib/libRint.lib" "c:\root/lib/libPostscript.lib"  "c:\root/lib/libMatrix.lib" "c:\root/lib/libPhysics.lib"  "c:\root/lib/libNet.lib" "c:\root/lib/libRIO.lib" "c:\root/lib/libGui.lib" "c:\root/lib/libGraf.lib"  "c:\root/lib/libGpad.lib" *.obj
   Creating library xps.lib and object xps.exp
StatUtils.obj : error LNK2019: unresolved external symbol "double __cdecl TMath::LnGamma(double)" (?LnGamma@TMath@@YANN@Z) referenced in function "public: static double __cdecl TStat::LnFact(int)" (?LnFact@TStat@@SANH@Z)xpsDict.obj : error LNK2001: unresolved external symbol "double __cdecl TMath::LnGamma(double)" (?LnGamma@TMath@@YANN@Z)
TStat.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class TRandom * gRandom" (__imp_?gRandom@@3PAVTRandom@@A) referenced in function "public: static void __cdecl TStat::Sample(int,int,int *)" (?Sample@TStat@@SAXHHPAH@Z)
TStat.obj : error LNK2019: unresolved external symbol "double __cdecl TMath::Gaus(double,double,double,bool)" (?Gaus@TMath@@YANNNN_N@Z) referenced in function "public: static void__cdecl TStat::Kernelize(int,double *,double,char const *)" (?Kernelize@TStat@@SAXHPANNPBD@Z)
XPSHybridizer.obj : error LNK2001: unresolved external symbol "double __cdecl TMath::Gaus(double,double,double,bool)" (?Gaus@TMath@@YANNNN_N@Z)
XPSUtils.obj : error LNK2001: unresolved external symbol "double __cdecl TMath::Log2(double)" (?Log2@TMath@@YANN@Z)
XPSAnalysis.obj : error LNK2019: unresolved external symbol "double __cdecl TMath::Log2(double)" (?Log2@TMath@@YANN@Z) referenced in function "public: virtual int __thiscall XAnalySet::CopyExprTrees(int,class TTree * *,class TTree * *,int,int *,int,bool)" (?CopyExprTrees@XAnalySet@@UAEHHPAPAVTTree@@0HPAHH_N@Z)
XPSData.obj : error LNK2001: unresolved external symbol "double __cdecl TMath::Log2(double)" (?Log2@TMath@@YANN@Z)
XPSHybridizer.obj : error LNK2001: unresolved external symbol "double __cdecl TMath::Log2(double)" (?Log2@TMath@@YANN@Z)
XPSNormalizer.obj : error LNK2001: unresolved external symbol "double __cdecl TMath::Log2(double)" (?Log2@TMath@@YANN@Z)
XPSHybridizer.obj : error LNK2019: unresolved external symbol "double __cdecl TMath::Freq(double)" (?Freq@TMath@@YANN@Z) referenced in function "private: void __thiscall XRMABackground::Adjust(int,double *,double *)" (?Adjust@XRMABackground@@AAEXHPAN0@Z)
xps.dll : fatal error LNK1120: 5 unresolved externals
NMAKE : fatal error U1077: '"C:\Programme\Microsoft Visual Studio 9.0\VC\bin/link.EXE"' :
return code '0x460'
Stop.

There seems to be a problem with TMath.
I am attaching the “MakefileR.win” which works fine with root 5.18/00.
Do you know what the current problem might be?

Best regards
Christian
MakefileR.win.txt (5.8 KB)

Hi Christian,

Just add “$(ROOTSYS)/lib/libMathCore.lib” in the ROOTLIBS list.

Best, Bertrand.

Dear Bertrand

Thank you, this was a fast reply!

I have already tested it and it solved my problem, nevertheless I have two questions:
1, I assume and hope that this addition works also for root 5.18/00.
2, Since TMath is still located in root/math and not in root/mathcore my question is: why do I need to add libMathCore? Did I miss something?

Best regards
Christian

Hi Christian,

  1. I think it should be OK with 5.18.00 (will check)
  2. The reason is because the math libraries have been reorganized recently… and libMathCore is not part of base/libCore anymore

Cheers,
Bertrand.

Dear Bertrand

Thank you. Meanwhile, I have re-installed root 5.18/00 and it works indeed.

BTW, is there any possibility to install both root binaries on WinXP?
(I tried to rename the old root folder, but the installer still claimed that there is an old version installed.)

Best regards
Christian

Hi Christian,

It is possible if you install binaries from tar files (msi files remember previous installation to be able to uninstall it…)

Cheers,
Bertrand.

Dear Bertrand

Of course, thank you. My mistake.

Best regards
Christian