5.13/04 on WinXP with VC++2005 express

Hello ROOT lovers,

I have several Windows-related problems :open_mouth: Any help gratefully appreciated :frowning:

I downloaded the win32gdk Windows installer version 5.13/04 on a new XP machine, then decided I wanted to be able to compile stuff too so went to Bertrand Bellenot’s instructions and tried to follow them again. However, as VisualC++2003 is no longer available, I installed the ‘replacement’, VisualC++2005 Express, which includes .NET framework 2.0.

Then from the VC++2005 page I followed a link to download and install “Microsoft Windows Server 2003 R2 Platform SDK” which I assume is also some update of the stuff Bertrand described. Finally I installed “.NET framework 2.0 redistributable” and “.NET framework 2.0 SDK” (all 354 MB!!).

Then I set environment variables analogolous to Bertrand (ROOTSYS was already defined by the installer and added to PATH):

INCLUDE =
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\include;C:\Program Files\Microsoft Visual Studio 8\VC\include

LIB =
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Lib;C:\Program Files\Microsoft Visual Studio 8\VC\lib;%ROOTSYS%\lib

PATH =
%ROOTSYS%\bin; C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin;C:\Program Files\Microsoft Visual Studio 8\VC\bin;C:\Program Files\Microsoft Visual Studio 8\Common7\IDE;%ROOTSYS%\lib

Then I tried to compile a tutorial script in ROOT:

.L tutorials/anim.C++

First I got an error from cl.exe saying ‘mspdb80.dll’ was missing. I found this file in …/Visual Studio 8/Common 7/IDE and so added this to the PATH variable.

Then I got an error from root.exe saying ‘MSVCR80.dll’ was missing. This I found in c:\Windows\WinSxS\x86_Microsoft.VC80_afihife(random stream of letters), along with ‘msvcp80.dll’. As ‘msvcp80.dll’ is also in Visual Studio/SDK/v2.0/Bin, I copied ‘msvcr80.dll’ there too.

Then the error from root.exe became something like ‘attempt at illegal access to C runtime library’…

That’s when I thought maybe the ROOT binary I downloaded doesn’t work with VC++8, so I decided to build from source.

Under cygwin, I run

./configure win32gdk --disable-mysql --disable-odbc

(the two disables are necessary because although ‘sql.h’ is not found by configure, an attempt is still made to compile TODBCResult)

Although I have installed all the jpeg, gif, png etc. libraries, ‘./configure’ cannot find them or the headers. e.g. ‘jpeglib.h’ is in /usr/include, but invisible to ./configure. libjpeg.a, libjpeg.dll.a and libjpeg.la are in /usr/lib, but ‘configure’ can’t seem to find them. what paths is it using ?

Can anybody help me please ?
John

The build finished while I was typing. After ‘make cintdlls’ and ‘make install’ I type ‘root’ in a Windows terminal. First I get a dialog box telling me:

This application could not start because MSVCR80D.dll is missing. Reinstalling this application may correct this problem.

in the command window I see:

c:\cygwin\root\bin\libWin32gdk.dll is missing
Load Error: Failed to load Dynamic link library c:\cygwin\root\bin\libWin32gdk.dll

and then the usual ROOT prompt.
The compilation of scripts from the ROOT command line now works e.g. .L $ROOTSYS/tutorials/anim.C+, but when I try to run it ROOT crashes and burns…

Help ???

I found msvcr80d.dll in the same weird directory as msvcr80.dll. So I copied it into Visual studio/SDK/2.0/bin.
Now when I run root.exe I get:

Debug Error!

R6034
An application has made an attempt to load the C runtime library without using a manifest…

What is going on ???
John

Hi John,

copying DLLs is not the solution, I’m afraid. Windows will find the proper DLL if ROOT (or your program linking against ROOT) is built with the proper settings. I’m referring to the /MD vs. /MDd compiler flag, which determines whether the resulting executable or DLL needs the MSVCR80.dll or the MSVCR80D.dll. When mixing flags, one can end up with a program that depends (via its DLLs) on both. That’s causing havoc to the library calls, so MS came up with an overkill-mechanism: the .manifest files. You can still trick the system by copying the dlls around, but then the program will abort at runtime.

OK, so now you know what happened - all you need to do is find out why it happened :slight_smile: Make sure either all objects are built with /MD (you didn’t specify --build=debug at the configure line, so /MD should be used) or /MDd. And make sure that all 3rd party libraries you link with are also release libraries. You can use dumpbin.exe /DIRECTIVES base/src/TObject.o to check what TObject.o needs; it should say /DEFAULTLIB:“MSVCRT” for a release build. You can use depends.exe from dependencywalker.com/ to check the libraries you link against. The error message you see suggests that one of win32gdk’s objects (or one of its link dependencies) was compiled with an /MDd flag; could you remove all of win32gdk’s object files (make clean-win32gdk should do it), re-build it, and try again?

Now on your question why the ROOT build system doesn’t use the libs in /usr/lib nor the headers in /usr/include. These are headers and libs for the cygwin system only; they cannot be used by a native windows application like the ROOT version you’re building with MSVC. You will have to download and install native windows versions of those libraries, and point the configure script to them.

Cheers, Axel.
[/b]

You may want to install the ROOT from BNL server root.bnl.gov compiled with VC++ v.8.0. Make sure you choose the “Custom” installation rather “Typical” to install all libs and header files you need.

Hi Axel, Valeri,

Thanks a lot for the replies.

Regarding the ‘debug’ issue, at first I was running ./configure with --build=debug, so this could explain the mixup. However, I later ‘reconfigured’ and did a ‘make clean’, so any conflicting libraries should have been erased ?

I have just done ‘make clean’, ‘make distclean’ and ‘make clean-win32gdk’ and I am going to try the build again.

If it works, I will then try to find all the jpeg etc. libraries on the web (has anyone bundled them all up in a handy pack ?) and rebuild with them.

If not, I will try to install the BNL binary version.

Cheers,
John

Hi John,

And what about building ROOT without all the jpeg etc. libraries first ?
Just to see if you manage to build Root with standard configuration (i.e. with minimum external dependencies).

Cheers,
Bertrand.

Hi Bertrand

good idea - I just started looking for Windows versions of all the image libraries and realised that installing them all by hand could take years…

So here we go…

John

Hi John,

It will work just fine with libAfterImage anyway :wink:
(at least jpg, GIF, PNG are natively supported)

Cheers,
Bertrand.

Oh well in that case there’s no point… Nice to know!
By the way, any chance of updating your instructions now that VC++2003 is dead ? If my build works, I can write everything I did in a nice neat ‘tutorial’…
John :unamused:

If you manage to build Root this way, that would be very nice :smiley:
Otherwise I would have to try myself, and it is always tricky to have several version of VisualC++ intalled together on the same machine (MS still doesn’t know how to make developper’s life easy :cry: )
Cheers,
Bertrand.

It worked!
Thanks a lot everyone.

Here, as promised, is the full story:

First I installed cygwin, with X11, make, autoconf, automake etc.

Then I downloaded and installed MS Visual C++ 2005 Express Edition from
http://msdn.microsoft.com/vstudio/express/visualc/download

On this page I followed the link in Step 4 “Install the platform SDK”; on the next page I clicked on the link in Step 2 “Platform SDK” and ended up here: http://www.microsoft.com/downloads/details.aspx?familyid=0BAF2B35-C656-4969-ACE8-E4C0C0716ADB&displaylang=en
"Microsoft Windows Server 2003 R2 Platform SDK Web Install"
I downloaded ‘PSDK-x86.exe’, chose a Custom install, and deselected everything that looked superfluous, like documentation or AMD/64 bit stuff. Basically I kept the ‘Core SDK’ part.

Next I installed the “Microsoft .NET Framework Version 2.0 Redistributable Package (x86)” from http://www.microsoft.com/downloads/details.aspx?FamilyID=0856eacb-4362-4b0d-8edd-aab15c5e04f5&DisplayLang=en
When I launched the installer it asked me to choose between “Repair” and (I think) “Remove” an existing installation. I chose “Repair”.

Finally I downloaded and installed “.NET Framework 2.0 Software Development Kit (SDK) (x86)” from http://www.microsoft.com/downloads/details.aspx?familyid=FE6F2099-B7B4-4F47-A244-C96D69C35DEC&displaylang=en

Then I set up the Windows environment variables as follows:

ROOTSYS = C:\cygwin\root

INCLUDE = C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\include;C:\Program Files\Microsoft Visual Studio 8\VC\include

LIB= C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Lib;C:\Program Files\Microsoft Visual Studio 8\VC\lib;%ROOTSYS%\lib

PATH = %ROOTSYS%\bin;C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin;C:\Program Files\Microsoft Visual Studio 8\VC\bin;C:\Program Files\Microsoft Visual Studio 8\Common7\IDE;%ROOTSYS%\lib

I downloaded the full ROOT source tree for v5.13/04 and untarzipped in the c:\cygwin\root (/root in cygwin) directory. I didn’t define any environment variables in the bash shell, the values imported from the Windows environment are sufficient.

In a bash shell xterm in the /root directory I typed:

./configure win32gdk --disable-odbc

(the ‘disable’ is necessary even though ‘configure’ knows that MySQL is not present i.e. doesn’t find sql.h)

make
make cintdlls (doesn’t seem to do anything, unlike on Linux)
make install

Then in a Windows command terminal I type ‘root’ or ‘root.exe’ and it works!

Hope this is useful
Thanks again
John

Great news ! :smiley:
And thank you very much for the HowTo. The Win32 web page will be updated with these precious infos.

Cheers,
Bertrand.

Another receipt:
Normally, Cygwin installation leaves the “Cygwin” shortcut on the user’s desktop that to invoke the “C:\cygwin\cygwin.bat” file.
That batch file looks like this [code]rem @echo off
C:
chdir C:\cygwin\bin

bash --login -i[/code]
To set “VC++” + “ROOT” build env properly one may create another shortcut to ‘rootbuild.bat’ or edit the existent ‘cygwin.bat’ as follows:[code]rem @echo off
call “%VS80COMNTOOLS%\vsvars32.bat” x86
C:
chdir C:\cygwin\bin

bash --login -i[/code]This way, all needed variables are to be set and no need to play with the error prone "manual settings"
If, by some reason, you have no “VS80COMNTOOLS” you may find another workaround:[code]rem @echo off
call “%VCINSTALLDIR%\bin\vcvars32.bat” x86
C:
chdir C:\cygwin\bin

bash --login -i[/code]The latter should work for any version of VC++ and used to be enough to compile ROOT.

Hi John,

[quote=“j.d.frankland”]Regarding the ‘debug’ issue, at first I was running ./configure with --build=debug, so this could explain the mixup. However, I later ‘reconfigured’ and did a ‘make clean’, so any conflicting libraries should have been erased ?[/quote] That’s the explanation for the dll issue - most of the object files don’t get erased when re-configuring.

Cheers, Axel.

[quote=“j.d.frankland”]It worked!
[snip]
Then in a Windows command terminal I type ‘root’ or ‘root.exe’ and it works!

Hope this is useful
Thanks again
John[/quote]

this much worked fine for me too - i could compile root using your recipe… the only snag was that i needed to ‘mv /usr/bin/link.exe /usr/bin/link_cyg.exe’ as axel suggested in some post here… not sure why i needed to do that and you didn’t - did i select a cygwin setup option that i shouldn’t have?

[quote=“fine”]Another receipt:
Normally, Cygwin installation leaves the “Cygwin” shortcut on the user’s desktop that to invoke the “C:\cygwin\cygwin.bat” file.
That batch file looks like this [code]rem @echo off
C:
chdir C:\cygwin\bin

bash --login -i[/code]
To set “VC++” + “ROOT” build env properly one may create another shortcut to ‘rootbuild.bat’ or edit the existent ‘cygwin.bat’ as follows:[code][/quote]

i tried that, and root would not compile. make died quickly with a missing ‘sehmap.h’… and i noticed the envvars defined by that script were a lot lighter than those in the message above from John…
in the end i decided to set the environment variables via the windows System Properties and do nothing in cygwin.bat as John did… then ./configure win32gdk then make then make install all worked, and i could type ‘root’ from a command prompt window and root started fine, i could open a TBrowser and a TGuiBuilder… i thought i was almost done…

but then i fired up my VS 2005 express and tried to rebuild my GUI versus the root libraries that i had just built locally w.r.t. VS80.
that compilation went fine, but trying to run my GUI app, i get the windows warning 'the application or DLL libCore.dll is not a valid Windows image…'
that file i see in C:\cygwin\root\lib but it is zero bytes. hmmmm…

the only reference to this issue that i could find is this one:
root.cern.ch/root/roottalk/roottalk02/0937.html
but “my regular root” seems to work fine…
any ideas? cheers,
bill

Hi,

use only %ROOTSYS%/bin as the PATH entry; the versions in %ROOTSYS%/lib are placeholders to keep track of the change time for the build system.

Cheers, Axel.