Re: TMapFile usage on MacOsX

From: Keisuke Fujii <keisuke.fujii_at_kek.jp>
Date: Wed, 27 Apr 2005 20:31:20 +0900


Hi Daniel,

I had a chance to look into your problem with TMapFile. Although you might have already solved the problem, here is what I found:
1. Since MacOS X's libstdc++ is an archive, the system standard new

     and delete will be linked into lib*.dylib's and lib*.so's unless you
     provide -lNew explicitly in their link lists. This requires  
patching of
     config/Makefile.macosx.

2. You need to patch base/src/TMapFile.cxx to make it use ROOT's

    custom new and delete.

Side effects of doing this include that now all the executables linked against ROOT's libraries have to use the custom new and delete, for consistency. This requires patching of bin/root-config and test/Makefile. I prepared a private patch together with a HOWTO file that explains how to build a TMapFIle-enabled version of ROOT and how to run the TMapFile example.
You can find them in

        http://www-jlc.kek.jp/~fujiik/macosx/10.3.X/src/root/New/

Notice that you need to explicitly Load libHistPainter.so before you run hcons.C (a problem related with one of the dylib features). Anyway, it worked.

I hope Fons will find a better solution.

--
Good luck,
Keisuke Fujii

On 2005/04/25, at 17:51, daniel cussol wrote:


> Hello MacRooters,
> I run ROOT CVS version (4.03.05) on MacOs X.3.9. I have sent last week
> a message
> (http://root.cern.ch/cgi-bin/print_hit_bold.pl/root/roottalk/
> roottalk05/0850.html) concerning TMapFile on MacOsX but I had no
> answers. Except for my bad use of root-cint (thanks to Fons for his
> quick answer ;-) ), I still not can use TMapFile on MacOsX, althought
> I run rootn.exe. I have tried several ROOT versions, and I even loaded
> and compiled the CVS version. The result is always the same: under
> rootn.exe, when I try to generate a TMapFile, I obtain the following
> error message:
>
> rootn.exe
> *******************************************
> * *
> * W E L C O M E to R O O T *
> * *
> * Version 4.03/05 24 April 2005 *
> * *
> * You are welcome to visit our Web site *
> * http://root.cern.ch *
> * *
> *******************************************
>
> FreeType Engine v2.1.3 used to render TrueType fonts.
> Compiled for macosx with thread support.
>
> CINT/ROOT C/C++ Interpreter version 5.15.169, Mar 14 2005
> Type ? for help. Commands must be C++ statements.
> Enclose multiple statements between { }.
> root [0] TMapFile *mf=TMapFile::Create("tutu.map","recreate",10000)
> Error in <TMapFile::TMapFile>: no memory mapped file capability
> available
> Use rootn.exe or link application against "-lNew"
> root [1]
>
> I tried to track the problem. It appears that the fgHasCustomNewDelete
> field in TStorage is not set even if rootn.exe is executed. Since this
> flag is tested in the TMapFile::MapToAddress() method, and the result
> is kFALSE, the TMapFile::Create method returns the above error
> message. I tried to track where this flag was set to kTRUE via a
> TStorage::SetCustomNewDelete() and I found it was called in the
> G__Base2.cxx and in NexDelete.cxx files. Unfortunately, my
> understanding of C++ does not allow me to go further. I also tried to
> set it before calling the TMapFile::Create method, but in this case
> ROOT crashes with the follwing error message when I update the
> TMapFile:
>
> rootn.exe
> *******************************************
> * *
> * W E L C O M E to R O O T *
> * *
> * Version 4.03/05 24 April 2005 *
> * *
> * You are welcome to visit our Web site *
> * http://root.cern.ch *
> * *
> *******************************************
>
> FreeType Engine v2.1.3 used to render TrueType fonts.
> Compiled for macosx with thread support.
>
> CINT/ROOT C/C++ Interpreter version 5.15.169, Mar 14 2005
> Type ? for help. Commands must be C++ statements.
> Enclose multiple statements between { }.
> root [0] TStorage::SetCustomNewDelete() root
> [1] TMapFile *mf=TMapFile::Create("tutu.map","recreate",10000)
> root [2] mf->Print()
> Memory mapped file: tutu.map
> Title: Option: CREATE
> Mapped Memory region: 0x3e000 - 0x41000 (0.01 MB)
> Current breakval: 0x3e10c
> root [3] TH1F *h1=new TH1F("h1","test",100,0,100) root
> [4] mf->Update() Fatal in
> <CustomReAlloc2>: space was not allocated via custom new
> aborting
> Abort
>
>
> Is the fact that this flag is not set correctly for rootn.exe due to
> MacOsX limitations? Did I make something wrong or missed something
> when I have compiled my ROOT versions on MacOsX (I don't think so
> because this problem is present with the compiled version of ROOT
> 4.02.00 for MacOsX provided by Fons)? Do I have to set a special
> environement variable on MacOsX to allow the memory sharing? These
> errors can be easily reproduced by running the tutorial hprod.C. I
> have also to mention that all is running correctly on Scientific
> Linux. That is why I think it might be a configuration problem on my
> Mac or a general problem on MacOsX.3.9. Has somebody tested hprod.C on
> his Mac? Did it run correctly?
> I hope that the indications I give will be helpfull for sombedy to
> help me ;-).
>
> Thanks for your answers.
> Friendly
>
> --
> Daniel CUSSOL
>
> LPC Caen IN2P3/ENSICAEN/Universite de Caen
> Boulevard du Marechal Juin
> 14050 CAEN CEDEX
>
> e-mail : cussol_at_in2p3.fr
> Tel : +33-(0)2-31-45-29-73
> FAX : +33-(0)2-31-45-25-49
>
Received on Wed Apr 27 2005 - 13:34:03 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:07 MET