Re: (no subject)

From: Dmitry Naumov <naumov_at_nusun.jinr.ru>
Date: Mon, 13 Nov 2006 15:48:35 +0300


Hi Axel,
thanks for suggestions. Surely I transfered the file correctly. I investigated the problem and isolated it. This might be a small limitation of root cint parsing the string or something similar. So, this is what I found. I have a rootlogon file of the form:

#include <iostream>
using namespace std;

void rootlogon() {

    // set macro path to include nuclon macros     TString macropath = gROOT->GetMacroPath();     TString NUCLON = gSystem->Getenv("NUCLONINSTALL");     if (NUCLON == "") NUCLON = ".";
    if (!macropath.Contains(NUCLON+"macros")) {

        macropath += ":";
        macropath += gSystem->ExpandPathName((NUCLON+"macros").Data());
        gROOT->SetMacroPath(macropath);
        cout << "Set macros path: " << (NUCLON+"macros").Data() << endl;
        cout << gROOT->GetMacroPath() << endl;
    }
// <skip>
}
If I write the line
macropath += gSystem->ExpandPathName((NUCLON+"macros").Data()); as
macropath += gSystem->ExpandPathName((NUCLON+"/macros").Data());

Then in the path it appears somepath//macros and this double "//" causes that strange problem - it works well on my laptop and does not on other pcs while generally Linux should take both expressions without complains. [Originally I had the second line with two "//"]

If you could reproduce this behavior then perhaps one might want improve the line parsing of root cint.

Best regards, Dmitry

Axel Naumann wrote:
> Hi,
>
> it might be sufficient to delete test_vector_C.d before transferring the
> code to another computer (or before running ".L test.C+ there for the
> first time). If thsi does not help I need more info:
>
> how do you transfer your code form your laptop to the other PC? I need
> details, like:
>
> cd ~
> tar czf nuclon.tar.gz nuclon
> scp nuclon.tar.zg otherpc:
> ssh otherpc
> tar xzf nuclon
> cd nuclon
> root ...
>
> On your second computer, could you run
> root[]gDebug=7
> root[].L test.C+
> root[].q
> and set the output of that, plus the file *linkdef.h that root has
> generated.
>
> Cheers, Axel.
>
> Dmitry Naumov wrote:
>
>> Dear ROOTers,
>>
>> I have encountered a strange problem about use of map, vector from root
>> interpreter.
>> I wrote a simple exercise macro for my students like this:
>>
>> #include <vector>
>> #include <map>
>> #include <iostream>
>> #include <TString.h>
>>
>> void test() {
>> vector<Int_t> p;
>> map<TString,Int_t> m;
>> for (Int_t i(0); i<10; i++) {
>> p.push_back(i*i);
>> TString title = Form("value squared %d",i);
>> m[title] = i*i;
>> }
>> for (UInt_t i(0); i<p.size(); i++) {
>> cout << "value " << p[i] << endl;
>> }
>> map<TString,Int_t>::iterator it;
>> for (it=m.begin(); it!=m.end(); it++) {
>> cout << it->first << " " << it->second << endl;
>> }
>> it = m.find("value squared 4");
>> cout << it->first << " " << it->second << endl;
>> }
>>
>> Then on my laptop I compiled this code as follows:
>> root[].L test.C+
>> and run it
>> root[] test()
>>
>> it gives a correct result and no problem during the compilation. My root
>> version is 5.13/01.
>> gcc -v output is:
>> naumov_at_naumov-laptop(10:53)> gcc -v
>> Using built-in specs.
>> Target: i486-linux-gnu
>> Configured with: ../src/configure -v
>> --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
>> --enable-shared --with-system-zlib --libexecdir=/usr/lib
>> --without-included-gettext --enable-threads=posix --enable-nls
>> --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu
>> --enable-libstdcxx-debug --enable-mpfr --with-tune=i686
>> --enable-checking=release i486-linux-gnu
>> Thread model: posix
>> gcc version 4.1.2 20060928 (prerelease) (Debian 4.1.1-15)
>>
>>
>> However the same macro is not compiling under other pcs. The following
>> command root[].L test.C+
>> gives :
>>
>>
>> Info in <TUnixSystem::ACLiC>: creating shared library
>> /home/naumov/nuclon//macros/test_vector_C.so
>> Warning: link requested for unknown srcfile /home/naumov/nuclon
>> /home/naumov/nuclon//macros/filehmmaiilinkdef.h:10:
>> Syntax error: #pragma link
>> /home/naumov/nuclon//macros/filehmmaiilinkdef.h:10:
>> Warning: Error occurred during reading source files
>> Warning: Error occurred during dictionary source generation
>> !!!Removing /home/naumov/nuclon//macros/filesXPixF.cxx
>> /home/naumov/nuclon//macros/filesXPixF.h !!!
>> Error: rootcint: error loading headers...
>> Error in <ACLiC>: Dictionary generation failed!
>> Info in <ACLiC>: Invoking compiler to check macro's validity
>> /home/naumov/nuclon//macros/test_vector.C: In function void test():
>> /home/naumov/nuclon//macros/test_vector.C:7: error: vector was not
>> declared in this scope
>> /home/naumov/nuclon//macros/test_vector.C:7: error: expected
>> primary-expression before > token
>> /home/naumov/nuclon//macros/test_vector.C:7: error: p was not
>> declared in this scope
>> /home/naumov/nuclon//macros/test_vector.C:8: error: map was not
>> declared in this scope
>> /home/naumov/nuclon//macros/test_vector.C:8: error: expected
>> primary-expression before , token
>> /home/naumov/nuclon//macros/test_vector.C:8: error: expected
>> primary-expression before > token
>> /home/naumov/nuclon//macros/test_vector.C:8: error: m was not
>> declared in this scope
>> /home/naumov/nuclon//macros/test_vector.C:15: error: cout was not
>> declared in this scope
>> /home/naumov/nuclon//macros/test_vector.C:15: error: endl was not
>> declared in this scope
>> /home/naumov/nuclon//macros/test_vector.C:17: error: expected
>> primary-expression before , token
>> /home/naumov/nuclon//macros/test_vector.C:17: error: expected
>> primary-expression before > token
>> /home/naumov/nuclon//macros/test_vector.C:17: error: ::iterator
>> has not been declared
>> /home/naumov/nuclon//macros/test_vector.C:17: error: expected `;' before
>> it
>> /home/naumov/nuclon//macros/test_vector.C:18: error: it was not
>> declared in this scope
>> /home/naumov/nuclon//macros/test_vector.C:19: error: cout was not
>> declared in this scope
>> /home/naumov/nuclon//macros/test_vector.C:19: error: endl was not
>> declared in this scope
>> /home/naumov/nuclon//macros/test_vector.C:23: error: cout was not
>> declared in this scope
>> /home/naumov/nuclon//macros/test_vector.C:23: error: endl was not
>> declared in this scope
>>
>>
>> What is strange that the compiler is near the same:
>> naumov_at_nui118(10:57)> gcc -v
>> Using built-in specs.
>> Target: i486-linux-gnu
>> Configured with: ../src/configure -v
>> --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
>> --enable-shared --with-system-zlib --libexecdir=/usr/lib
>> --without-included-gettext --enable-threads=posix --enable-nls
>> --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu
>> --enable-libstdcxx-debug --enable-mpfr --with-tune=i686
>> --enable-checking=release i486-linux-gnu
>> Thread model: posix
>> gcc version 4.1.2 20060901 (prerelease) (Debian 4.1.1-13)
>>
>> the root version is older a bit (5.12/00e), but I also checked it with
>> the same root version as mine.
>>
>> Could anyone shed a light on that? Best regards, Dmitry
>>
>>
Received on Mon Nov 13 2006 - 13:48:49 MET

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:32:01 MET