Problems loading script with CINT or ACLiC

Hi,

I am trying to load and run the attached demo script but get the following errors. (The script does a minimization with minuit2). I have tried with ROOT 5.18 on an UBUNTU Linux machine, and ROOT 5.18 and 5.20 on a Windows XP machine.

with CINT- .L Quad4FMain.cxx
the error is- Limitation: Reference member not supported. Please use pointer minuit2/abobj.h(98)

with ACLiC- .L Quad4FMain.cxx +
the error is- ‘cl’ is not recognized as an internal or external command, operable program or batch file. Error:external preprocessing failed… Error: C:\root\bin\rootcint: error loading headers… Error in : Dictionary generation failed…

Any assistance will be greatly appreciated.

Thanks,
Warren

// @(#)root/minuit2:$Name: $:$Id: Quad4FMain.cxx,v 1.1 2005/11/29 17:53:53 moneta Exp $
// Authors: M. Winkler, F. James, L. Moneta, A. Zsenei 2003-2005

/**********************************************************************

  •                                                                *
    
  • Copyright © 2005 LCG ROOT Math team, CERN/PH-SFT *
  •                                                                *
    

**********************************************************************/

#include “Quad4F.h”
#include “Minuit2/FunctionMinimum.h”
#include “Minuit2/MnMigrad.h”
#include “Minuit2/MnUserParameters.h”
#include “Minuit2/MnPrint.h”
// #include “TimingUtilities/PentiumTimer.h”

// StackAllocator gStackAllocator;

using namespace ROOT::Minuit2;

int main() {

Quad4F fcn;

// PentiumTimer stopwatch;
// stopwatch.start();

// long long int start = stopwatch.lap().ticks();
// long long int stop = stopwatch.lap().ticks();
// std::cout<<"stop-start: "<<stop - start<<std::endl;
// start = stopwatch.lap().ticks();
{
//test constructor
MnUserParameters upar;
upar.Add(“x”, 1., 0.1);
upar.Add(“y”, 1., 0.1);
upar.Add(“z”, 1., 0.1);
upar.Add(“w”, 1., 0.1);

MnMigrad migrad(fcn, upar);
FunctionMinimum min = migrad();
std::cout<<"minimum: "<<min<<std::endl;
}
// stop = stopwatch.lap().ticks();
// std::cout<<"stop-start: "<<stop - start<<std::endl;
/*

{
//test constructor
std::vector par(4);
std::vector err(4);
for(int i = 0; i < 4; i++) {
par[i] = 1.;
err[i] = 0.1;
}
MnMigrad migrad(fcn, par, err);
FunctionMinimum min = migrad();
std::cout<<"minimum: "<<min<<std::endl;
}

{
//test edm Value
std::vector par(4);
std::vector err(4);
for(int i = 0; i < 4; i++) {
par[i] = 1.;
err[i] = 0.1;
}
MnMigrad migrad(fcn, par, err);
double edm = 1.e-1;
FunctionMinimum min = migrad(20, edm);
std::cout<<"minimum: "<<min<<std::endl;
}

{
//test # of iterations
std::vector par(4);
std::vector err(4);
for(int i = 0; i < 4; i++) {
par[i] = 1.;
err[i] = 0.1;
}
MnMigrad migrad(fcn, par, err);
int niter = 2;
FunctionMinimum min = migrad(niter, 1.e-5);
std::cout<<"minimum: "<<min<<std::endl;
}
*/

return 0;
}

// @(#)root/minuit2:$Name: $:$Id: Quad4F.h,v 1.1 2005/11/29 17:53:53 moneta Exp $
// Authors: M. Winkler, F. James, L. Moneta, A. Zsenei 2003-2005

/**********************************************************************

  •                                                                *
    
  • Copyright © 2005 LCG ROOT Math team, CERN/PH-SFT *
  •                                                                *
    

**********************************************************************/

#include “Minuit2/FCNBase.h”

namespace ROOT {

namespace Minuit2 {

class Quad4F : public FCNBase {

public:

Quad4F() {}

~Quad4F() {}

double operator()(const std::vector& par) const {

double x = par[0];
double y = par[1];
double z = par[2];
double w = par[3];

return ( (1./70.)*(21*x*x + 20*y*y + 19*z*z - 14*x*z - 20*y*z) + w*w );

}

double Up() const {return 1.;}

private:

};

} // namespace Minuit2

} // namespace ROOT

Hi,

Since your Quad4F class inherit from a compiled class (and must overload virtual functions) you must compile your script (via a makefile or ACLiC).

Note that the error message the error is- Limitation: Reference member not supported. Please use pointer minuit2/abobj.hseem to indicate that the Minuit2 library has not been loaded which may be due to the fact that you have not build (i.e. you may not have added --enable-minuit2 to the configure line).

he error is- 'cl' is not recognized as an internal or external command, operable program or batch file. Error:external preprocessing failed.... Error: C:\root\bin\rootcint: error loading headers... Error in <ACLiC>: Dictionary generation failed... This indicate that your compiler is not setup properly on windows (you may need to run the microsoft script named vsvar32.bat)

Cheers,
Philippe.

Thanks, Philippe,

Unfortunately, neither of your suggestions have worked. I have been trying to get it to run by compiling with ACLiC and I had already enabled Minuit2 when I configured my ROOT build; but this script (and others like it) don’t work on my Linux machine.

On my windows machine, I tried to execute vsvar32.bat as you suggested. But that should not matter if I’m compiling within ROOT, using ACLiC, should it?

thanks,
Warren

[quote]On my windows machine, I tried to execute vsvar32.bat as you suggested. But that should not matter if I’m compiling within ROOT, using ACLiC, should it? [/quote]Of course, it should :slight_smile:. ACLiC calls the installed compiler (Microsoft’s C++ compiler on windows) and hence this compiler needs to be setup properly.

[quote]; but this script (and others like it) don’t work on my Linux machine. [/quote]Did you try ACLiC on linux? How does it fail?

Cheers,
Philippe

I get the same error messages on the Linux machine as on the windows machine

R/
Warren

[quote]I get the same error messages on the Linux machine as on the windows machine [/quote]Really, even with ACLiC? This is extremely surprising. You said:

[quote]with ACLiC- .L Quad4FMain.cxx +
the error is- ‘cl’ is not recognized as an internal or external command, operable program or batch file. Error:external preprocessing failed… Error: C:\root\bin\rootcint: error loading headers… Error in : Dictionary generation failed… [/quote]There is no way I know of that it would complain about ‘cl’ on Linux … What is the actual message on Linux?

Philippe.

PS. You’re code can not work in interpreted mode, so you must use ACLiC

Philippe, thanks again for your patience and help with this issue.
Here is my current status:

On my Windows machine, when executing vsvar32.bat then attempting to compile and run with ACLiC, I obtain the following:

C:>"Program Files\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat"
Setting environment for using Microsoft Visual Studio 2008 x86 tools.

C:>root
root [0] .x root/Quad4FMain.cxx +

Info in TWinNTSystem::ACLiC: creating shared library C:\root\Quad4FMain_cxx.dll
24940109_cint.cxx
cl : Command line warning D9002 : ignoring unknown option '-G5’
s55k_18467.cxx
Creating library C:\root\Quad4FMain_cxx.lib and object C:\root\Quad4FMain_cxx.exp
s55k_18467.obj : error LNK2019: unresolved external symbol “public: bool __thiscall ROOT::Minuit2::MnUserParameters::Add(char const *,double,double)” (?Add@MnUserParameters@Minuit2@ROOT@@QAE_NPBDNN@Z) referenced in function _main
C:\root\Quad4FMain_cxx.dll : fatal error LNK1120: 1 unresolved externals
Error in : Compilation failed!
Error: Function Quad4FMain() is not defined in current scope (0)
*** Interpreter error recovered ***

On my Linux machine, when attempting to use ACLiC, I get:

root [0] .x Quad4FMain.cxx+
Info in TUnixSystem::ACLiC: creating shared library /opt/whuelsni/IceCube/icerec_2/build/./Quad4FMain_cxx.so
sh: rootcint: not found
Error in : Dictionary generation failed!
Info in : Invoking compiler to check macro’s validity
Info in : The compiler has not found any problem with your macro.
Probably your macro uses something rootcint can’t parse.
Check root.cern.ch/root/Cint.phtml?limitations for Cint’s limitations.
Error: Function Quad4FMain() is not defined in current scope :0:
*** Interpreter error recovered ***

R/
Warren

On windows try:root [] gSystem->Load("libMinuit2"); root [] .x root/Quad4FMain.cxx+
On linux, rootcint is not in your PATH. This means that $ROOTSYS/bin is probably not in your path.

Cheers,
Philippe.

Update on current status:

Linux: I fixed my PATH and LD_LIBRARY_PATH environmental variables; and now my scripts are running on Linux.

Windows: Still the same error messages as noted above, even with executing vsvars32.bat.

Hi,

did you really load libMinuit2 on windows like Philippe suggested? Does it print anything when you do that?

Cheers, Axel.

yes - I tried the command gSystem->Load(“libMinuit2”);
no - it does not print out anything following that

C:\root>"C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat
"

Setting environment for using Microsoft Visual Studio 2008 x86 tools.

C:\root>root -l
root [0] gSystem->Load(“libMinuit2”);
root [1] .x Quad4FMain.cxx++
Info in TWinNTSystem::ACLiC: creating shared library C:\root\Quad4FMain_cxx.dll
2412493_cint.cxx
cl : Command line warning D9002 : ignoring unknown option '-G5’
s2tk_.cxx
Creating library C:\root\Quad4FMain_cxx.lib and object C:\root\Quad4FMain_cxx.exp
C:\root\Quad4FMain_cxx.dll: A dynamic link library (DLL) initialization routine failed.
Load Error: Failed to load Dynamic link library:\root\Quad4FMain_cxx.dll
cl : Command line warning D9035 : option ‘o’ has been deprecated and will be removed in a future release
cl : Command line warning D9035 : option ‘o’ has been deprecated and will be removed 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’
s2tk_5.cxx;
c1xx : fatal error C1083: Cannot open source file: ‘C:\root\s2tk_5.cxx;’: No such file or directory
link
c1xx : fatal error C1083: Cannot open source file: ‘link’: No such file or directory
etc…

What does

cl

print in your case?

Philippe

PS. In my case it does:[code]Microsoft ® 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for 80x86
Copyright © Microsoft Corporation. All rights reserved.

usage: cl [ option… ] filename… [ /link linkoption… ][/code] and I am interested in the numbers on the first line

Hi,

Actually, I can now reproduce the problem. The issue appears when trying to use ACLiC from a ROOT version build with MS C++ version 7.1 (the binary download that is available) with MS C++ version 9. ACLiC expects in this case v7.1 and pass it the appropriate flags …

Cheers,
Philippe.

Hi all,

I am up and running with my Minuit2 scripts on a Linux machine and a Windows machine. For the record, here is a summary of the things I had to verify and/or change to get it to work:

Linux:
(1) ensure MINUIT2 is enabled prior to compiling: ./configure --enable-minuit2
(2) ensure environmental variables are set correctly
(3) run in compiled mode (ACLIC) with .x (or .L) filename.c+ (or ++)

Windows:
(1) ensure compatible version of Visual Studio C++ is installed
(2) ensure cygwin is properly installed and setup prior to root install
(3) execute, prior to running root, the vsvars32.bat command (for visual studio)
(4) run in compiled mode (ACLIC) with .x (or .L) filename.c+ (or ++)

Thanks again for all the help.

Warren