Compiling on windows

Hi,

I installed the root 15.20/00 binary on a WinXP machine, and subsequently installed MS visual studio with Visual C++ 2005 (which I believe corresponds to VC++ 8.0, mentioned in the 15.20/00 release notes as being compatible with the root binary). When I try to compile something within root using the command .L file.cc+, I get the following error message:

Error: C:\root\bin\rootcint: The input list file C:\Documents.in does not exist
Error in : Dictionary generation failed!
Info in : Invoking compiler to check macro’s validity
’cl’ is not recognized as an internal or external command,
operable program or batch file.

Any suggestions on how to fix this? Should I reinstall the root binary after the installation of visual studio?

Thanks,
Abi

Hi,

Please install ROOT in a path not containing blanks (e.g. NOT in C:\Program Files\root) an try again.

Cheers,
Bertrand.

Hi Bertrand,

Actually, my path is C:\root\bin\root.exe.

Abi

Oh, yes, sorry, I overlooked your post :blush:
You must have the environment variables set to be able to call the compiler. To do so, you have to call:
"C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat"
before starting root.

Cheers,
Bertrand.

Hi Bertrand,

Thanks, this got me a step further, but there are a few more problems that maybe you can help me solve:

First, there still is a problem if the file I’m trying to compile is in a directory path that has spaces in its names (such as “Documents and Sesttings”). Then I get the following error:

c1xx : fatal error C1083: Cannot open source file: ‘and’: No such file or direc
ory
My
c1xx : fatal error C1083: Cannot open source file: ‘Settings\avner\My’: No such
file or directory
TGC

Is the only solution to work in directory names without spaces?

Perhaps more difficult is the following problem (which I get when I put the file to be compiled in a spaceless-name path): Trying to compile a very simple function, which just does cout to some char*, I first get the following errors in the cmd window from which I’m running root:

Info in TWinNTSystem::ACLiC: creating shared library C:\try_cc.dll
23460171_cint.cxx
cl : Command line warning D9002 : ignoring unknown option '-G5’
s3m8_18467.cxx
Creating library C:\try_cc.lib and object C:\try_cc.exp
C:\try_cc.dll: A dynamic link library (DLL) initialization routine failed.
Load Error: Failed to load Dynamic link library C:\try_cc.dll

Then I get a VC++ popup window that says

“Runtime Error!
Program C:\root\bin\root.exe
R6034
An application has made an attempt to load the C runtime library incorrectly. Please contact the application’s support team for more information.”

When I click “OK” in that window (or sometimes before), the root cmd window gives the following:

cl : Command line warning D9035 : option ‘o’ has been deprecated and will be rem
oved in a future release
cl : Command line warning D9035 : option ‘o’ has been deprecated and will be rem
oved in a future release
cl : Command line warning D9002 : ignoring unknown option '-G5’
cl : Command line warning D9002 : ignoring unknown option '-ignore:4049,4075,421
7,4221’
cl : Command line warning D9002 : ignoring unknown option '-incremental:no’
cl : Command line warning D9002 : ignoring unknown option '-LIBPATH:C:\root’
s3m8_18467.cxx;
c1xx : fatal error C1083: Cannot open source file: ‘C:\s3m8_18467.cxx;’: No such
file or directory
link
c1xx : fatal error C1083: Cannot open source file: ‘link’: No such file or direc
tory
s3m8_18467.obj
C:\s3m8_18467.obj : warning C4819: The file contains a character that cannot be
represented in the current code page (1255). Save the file in Unicode format to
prevent data loss
C:\s3m8_18467.obj(1) : error C2018: unknown character '0x1’
C:\s3m8_18467.obj(1) : error C2143: syntax error : missing ‘;’ before '|'
C:\s3m8_18467.obj(1) : error C4430: missing type specifier - int assumed. Note:
C++ does not support default-int

Followed by many lines that look like this:

C:\s3m8_18467.obj(1) : error C2018: unknown character ‘0x7f’

And then by

C:\s3m8_18467.obj(2) : fatal error C1003: error count exceeds 100; stopping comp
ilation
libCore.lib
c1xx : fatal error C1083: Cannot open source file: ‘libCore.lib’: No such file o
r directory
libCint.lib
c1xx : fatal error C1083: Cannot open source file: ‘libCint.lib’: No such file o
r directory
libMathcore.lib
c1xx : fatal error C1083: Cannot open source file: ‘libMathcore.lib’: No such fi
le or directory
libRint.lib
c1xx : fatal error C1083: Cannot open source file: ‘libRint.lib’: No such file o
r directory
advapi32.lib
c1xx : fatal error C1083: Cannot open source file: ‘advapi32.lib’: No such file
or directory
Generating Code…
*** Interpreter error recovered ***

Do you know what I’m doing wrong?

Thanks again,
Abi

Hi,

I would need a bit more information:
Which binary file did you download?
From where are you trying to compile this file?
Usually, Windows doesn’t allow to write directly in C:
Where is your $TEMP environment variable pointing to?

Cheers,
Bertrand.

Hi Bertrand,

The binary file is from ftp://root.cern.ch/root/root_v5.20.00.win32.msi, labelled “WindowsXP/NT/w2000 with VC++ 7.1 (runs with VC++6 and VC++8.0), version 5.20/00”

In cmd, I went into C:, typied “root”, and then .L file.cc+

echo %TEMP% gives me
C:\DOCUME~1\avner\LOCALS~1\Temp
(I guess %–% is the format on windows - just learned something new)

Thanks again,
Abi

Hi Abi,

Please avoid working directly in C:\ directory! Windows (since XP) doesn’t allow to write files in C:\

Cheers, Bertrand.

HI Bertrand,

Maybe I’ve changed the security settings sometime in the past, becuase
my code file is try.cc, and I see the following newer files in C:\

try_cc.d
try_cc.def
try_cc.dll
try_cc.dll.manifest
try_cc.exp
try_cc.lib
try_cc.rootmap

Anyway, moving to a subdirectory of C:\ and compiling there, I get the same behavior.

Abi

OK, so the problem is due to the incompatibility between root binaries and the compiler when using ACLiC.
One solution would be to install MSVC++9.0 (2008) - there is even a free version - and use the root_v5.20.00.win32.vc90.msi binary.
But I’ll check with our ACLiC guru if there is another solution anyway…
Sorry for the trouble.

Cheers, Bertrand.

Hi Bertrand,

Nothing to be sorry about - I’m grateful for your help. Does this mean that the statement on the root site (see my message above from 16:53) about these versions being compatible is just incorrect?

Before trying the solution of installing a new version of VC++, I’ll wait to hear if there is an alternative solution.

Thanks,
Abi

Alternatively, can I compile and link not within the root session? Is there a DOS makefile or something that can be used within the VC++ environment, and then some command to hook the .so file to root?

Thanks,
Abi

No, building applications with MSVC++8.0 using ROOT libraries compiled with MSVC++7.1 should work (but I’ll check again, just to be sure)
Apparently the problem is only with ACLiC.
And yes, you can take a look at ROOTSYS/test/Makefile.win32 as an example of nmake makefile.
BTW, to verify the compatibility, you can cd root/test and type: nmake -f Makefile.win32 CFG=Release, this should build the executables in the test directory.

– Bertrand.

[quote]First, there still is a problem if the file I’m trying to compile is in a directory path that has spaces in its names (such as “Documents and Sesttings”). Then I get the following error:

c1xx : fatal error C1083: Cannot open source file: ‘and’: No such file or direc
ory
My
c1xx : fatal error C1083: Cannot open source file: ‘Settings\avner\My’: No such
file or directory
TGC
[/quote]Currently ACLiC really does not like spaces :slight_smile:. Not only should you install ROOT in a directory that has no spaces in its name BUT you also need to work (for your scripts) in a directory with no space in its name (so not in ‘My Documents’ or any of its sub-directories.)

Cheers,
Philippe.

Hi,

additionally, there are a few fundamental problems that we need to understand -maybe we can fix things and you don’t need to upgrade your compiler after all. That assumes that you work in a directory without spaces, that root is in a directory without spaces, and that your source files are in a directory without spaces.

The error message “An application has made an attempt to load the C runtime library incorrectly.” means that you have a mismatch in the MS C runtime libraries. You will need the program from dependencywalker.com to see what the libraries are that try_cc.dll depends on. Could you post that, please? Alternatively you can simply attach try_cc.dll.

The next issue is
c1xx : fatal error C1083: Cannot open source file: ‘C:\s3m8_18467.cxx;’: No such file or directory
c1xx : fatal error C1083: Cannot open source file: ‘link’: No such file or directory
Of course what’s meant is “cl C:\s3m8_18467.cxx; link …” but cl misinterprets it as “cl ‘C:\s3m8_18467.cxx;’ link”, i.e. as being passed two source files, one of them being link. That’s bad.

Do you have any special shell or do you use the regular cmd.exe? Could you re-run the build after setting gDebug=7 and post the output?

Cheers, Axel.

Hi,

Based on the suggestions supplied here, I removed my visual studio 2005 and downloaded VC++ 2008. I try to compile within root (.x file.cc+) a simple “hello world” program. It spits out the following within the root window:

root [0] .x tryit.cc++
Info in TWinNTSystem::ACLiC: creating shared library C:\cxx-work\TGC-alignment
\tryit_cc.dll
2536187_cint.cxx
cl : Command line warning D9002 : ignoring unknown option '-G5’
s4pk_18467.cxx
Creating library C:\cxx-work\TGC-alignment\tryit_cc.lib and object C:\cxx-wor
k\TGC-alignment\tryit_cc.exp

And then a window pops up with the title “root.exe - Unable to locate component”, saying “This application has failed to start because MSVCP90.dll was not found. Re-installing the application may fix this problem.”

I reinstalled the VC++ but got the same thing.

I should say that I’m running root 5.20/00.

Any help is appreciated.

Thanks,
Abi

Hi,

Did you download the root tar file for VC 7.1 or VC 9.0 (I recommend trying with the tar file for VC9.0)

Cheers,
Philippe.

Hi Philippe,

OK, installing root 5.21.04 actually solves the compilation problem. Still some kinks when trying to interactively call compiled code, but I guess those will get worked out.

Thanks,
Abi

Dear all, I have the same problem as reported in this thread, see attached file.

In installed in my laptop (OS: Windows Vista) root_v5.24.00.win32, with Visual Studio 9.0 as recommended by the root page.
My cygwin shortcut consists of these lines:

[code]@echo off

C:
call “C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat” x86
chdir C:\cygwin\bin

bash --login -i[/code]

And these are the settings in my vsvars32.bat:

@set PATH=C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE;C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN;C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools;C:\Windows\Microsoft.NET\Framework\v3.5;C:\Windows\Microsoft.NET\Framework\v2.0.50727;C:\Program Files\Microsoft Visual Studio 9.0\VC\VCPackages;%PATH% @set INCLUDE=C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE;%INCLUDE% @set LIB=C:\Program Files\Microsoft Visual Studio 9.0\VC\LIB;%LIB% @set LIBPATH=C:\Windows\Microsoft.NET\Framework\v3.5;C:\Windows\Microsoft.NET\Framework\v2.0.50727;C:\Program Files\Microsoft Visual Studio 9.0\VC\LIB;%LIBPATH%

You can see in the attachment, among the other things, the result of echo $PATH in cygwin (just to be sure that the settings are actually taken into account).
In this forum it was suggested to go into root/test and try to compile, to check dependencies.
I did:

nmake -f Makefile.win32 CFG="Win32 Release" 

and it appears ok.

As recommended often in this forum, I downloaded the executable from
dependencywalker.com/
but I’m not sure of how to interpret its results.
I get this message:

Any hint?

Thanks a lot in advance.


I forgot to mention that this happens with more than one macro, therefore I assume that it is not macro-dependent.
Anyway, I just checked that the same happens even with a dummy macro like:

void test() { }