# Rootcint cannot create dictionary in a VM

**URL:** <https://root-forum.cern.ch/t/rootcint-cannot-create-dictionary-in-a-vm/48580>\
**Category:** ROOT\
**Tags:** rootcling\
**Created:** [January 26, 2022, 5:57pm UTC](https://root-forum.cern.ch/t/rootcint-cannot-create-dictionary-in-a-vm/48580 "2022-01-26T17:57:19Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [January 26, 2022, 5:57pm UTC](https://root-forum.cern.ch/t/rootcint-cannot-create-dictionary-in-a-vm/48580/1 "2022-01-26T17:57:20Z")

</div>

While trying to use ROOT 6 in a “Ubuntu 20.04” VirtualBox (6.1.32) machine in a “Shared Folder” working directory ("/c/Temp/output" below), I get:

```bash
[...]:/c/Temp/output$ rootcint -v1 -f outputProjectDict.cxx -I$ROOTSYS/include -I"/opt/ROOT/releases/root_v6.24.06/etc/" -I"/opt/ROOT/releases/root_v6.24.06/etc//cling" -I"/opt/ROOT/releases/root_v6.24.06/include/" -I"/opt/ROOT/releases/root_v6.24.06/include" outputProjectHeaders.h outputLinkDef.h
Error: Renaming outputProjectDict.cxx_tmp_5513 into outputProjectDict.cxx!

```

If the working directory (“output”) is inside of the VM “.vdi” disk then it works fine.  
The host (which serves “/c/Temp”) is a Windows 10 Pro machine.

BTW. ROOT 5 does not have this problem.

---

<div class="post-metadata">

**Author:** ![eguiraud](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eguiraud/32/32217_2.png) [@eguiraud](https://root-forum.cern.ch/u/eguiraud)\
**Post date:** [January 27, 2022, 9:07am UTC](https://root-forum.cern.ch/t/rootcint-cannot-create-dictionary-in-a-vm/48580/2 "2022-01-27T09:07:38Z")

</div>

Hi @Wile_E_Coyote ,  
thank you for the report.

The code relevant to the error should be this: [root/rootcling\_impl.cxx at 7a2612dc7ae62832c7683081020e190c49b75569 · root-project/root · GitHub](https://github.com/root-project/root/blob/7a2612dc7ae62832c7683081020e190c49b75569/core/dictgen/src/rootcling_impl.cxx#L2956-L2958) , which makes me think this should be reproducible in isolation.

Can you `touch` a file called `outputProjectDict.cxx_tmp_5513` in that directory and then try to call `std::rename('outputProjectDict.cxx_tmp_5513 into outputProjectDict.cxx', 'somethingelse')`? We need to figure out why `std::rename` fails in this case.

Cheers,  
Enrico

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [January 27, 2022, 9:35am UTC](https://root-forum.cern.ch/t/rootcint-cannot-create-dictionary-in-a-vm/48580/3 "2022-01-27T09:35:45Z")

</div>

Executing “`std::rename`” from the ROOT prompt works fine.  
It looks like this is some kind of a problem in “Windows host” \<-\> “Linux guest” file system synchronization (though it could also be a general problem for all kinds of hosts when a “Shared Folder” is used in VirtualBox).  
In [lines 2944 - 2955 (rootcling\_impl.cxx")](https://github.com/root-project/root/blob/7a2612dc7ae62832c7683081020e190c49b75569/core/dictgen/src/rootcling_impl.cxx#L2944), there is a special “WIN32” fix which may be relevant also in this case.

---

<div class="post-metadata">

**Author:** ![eguiraud](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eguiraud/32/32217_2.png) [@eguiraud](https://root-forum.cern.ch/u/eguiraud)\
**Post date:** [January 27, 2022, 9:48am UTC](https://root-forum.cern.ch/t/rootcint-cannot-create-dictionary-in-a-vm/48580/4 "2022-01-27T09:48:57Z")

</div>

Alright, if a simple `std::rename` works then the problem might be with renaming files that are currently in use (i.e. what the WIN32 workaround is for). Can you `std::rename` a file (e.g. a ROOT file) in that partition after you have opened it (e.g. as a TFile)?

P.S.  
my link pointed to the wrong lines of course, fixed above

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [January 27, 2022, 11:07am UTC](https://root-forum.cern.ch/t/rootcint-cannot-create-dictionary-in-a-vm/48580/5 "2022-01-27T11:07:01Z")

</div>

I can confirm that one cannot “rename” an opened file.

I tried a simple fix, which seems to work.  
Move the [lines 2948/2949](https://github.com/root-project/root/blob/7a2612dc7ae62832c7683081020e190c49b75569/core/dictgen/src/rootcling_impl.cxx#L2948): “`if (ifile.is_open()) ifile.close();`” to a place right before the [line 2944](https://github.com/root-project/root/blob/7a2612dc7ae62832c7683081020e190c49b75569/core/dictgen/src/rootcling_impl.cxx#L2944) “`#ifdef WIN32`”.

---

<div class="post-metadata">

**Author:** ![eguiraud](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eguiraud/32/32217_2.png) [@eguiraud](https://root-forum.cern.ch/u/eguiraud)\
**Post date:** [January 27, 2022, 12:00pm UTC](https://root-forum.cern.ch/t/rootcint-cannot-create-dictionary-in-a-vm/48580/6 "2022-01-27T12:00:41Z")

</div>

Alright, this is now a bug report: [When working on a Windows partition from Linux, rootcling is not able to rename an output file · Issue #9730 · root-project/root · GitHub](https://github.com/root-project/root/issues/9730) , let’s see what the relevant devs say.

Cheers,  
Enrico

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [January 27, 2022, 12:05pm UTC](https://root-forum.cern.ch/t/rootcint-cannot-create-dictionary-in-a-vm/48580/7 "2022-01-27T12:05:23Z")

</div>

Note that the problem originates in the “`commit`” procedure itself. In the [line 2941](https://github.com/root-project/root/blob/7a2612dc7ae62832c7683081020e190c49b75569/core/dictgen/src/rootcling_impl.cxx#L2941) it opens the relevant file (and unfortunately leaves it opened). Simply closing it seems to solve the problem.

BTW. Maybe there are other places where some file is “left unnecessarily opened” and should be fixed, too.

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [January 27, 2022, 12:26pm UTC](https://root-forum.cern.ch/t/rootcint-cannot-create-dictionary-in-a-vm/48580/8 "2022-01-27T12:26:35Z")

</div>

There is a [PR](https://github.com/root-project/root/pull/9732) addressing this issue. Thanks @Wile_E_Coyote and @eguiraud for reporting it and proposing a solution

> [@Wile\_E\_Coyote](#):
>
> BTW. Maybe there are other places where some file is “left unnecessarily opened” and should be fixed, too.

I’ll take a look

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [February 10, 2022, 12:27pm UTC](https://root-forum.cern.ch/t/rootcint-cannot-create-dictionary-in-a-vm/48580/9 "2022-02-10T12:27:09Z")

</div>

Closed on February 10, 2022, 12:27pm UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
