# Windows 64bit support for ROOT

**URL:** <https://root-forum.cern.ch/t/windows-64bit-support-for-root/36760>\
**Category:** Evolution Proposals, Apps & Ideas\
**Created:** [November 10, 2019, 8:03pm UTC](https://root-forum.cern.ch/t/windows-64bit-support-for-root/36760 "2019-11-10T20:03:46Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Philip\_Thong](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/philip_thong/32/19931_2.png) [@Philip\_Thong](https://root-forum.cern.ch/u/Philip_Thong)\
**Post date:** [November 10, 2019, 8:03pm UTC](https://root-forum.cern.ch/t/windows-64bit-support-for-root/36760/1 "2019-11-10T20:03:47Z")

</div>

I managed to get ROOT v61803 compiling on Windows 64bit, and displaying the hsimple.C histogram.

Is this something the ROOT community is interested in integrating back into the master?

There are some potential discussions to be had on the handling of:

- win32gdk
- `long` natively being 4 bytes on Windows, where it is 8 bytes on \*nix
- casting of pointers from (\*) to long

---

<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:** [November 11, 2019, 8:37am UTC](https://root-forum.cern.ch/t/windows-64bit-support-for-root/36760/2 "2019-11-11T08:37:08Z")

</div>

Hi,

Thank you very much for your offer, I would be interested to see the patch. I already have a version compiling and running on Windows, but the diff is 731KB large and very intrusive. This is mostly due to changes of casting from cast to long to cast to intptr\_t (or uintptr\_t) a bit everywhere in the code, keeping it backward compatible and cross-platform…  
And even if it compiles and run, there are still many tests failing. Did you try to enable testing and run CTest on your build? Could you share the results?

Cheers, Bertrand.

---

<div class="post-metadata">

**Author:** ![Philip\_Thong](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/philip_thong/32/19931_2.png) [@Philip\_Thong](https://root-forum.cern.ch/u/Philip_Thong)\
**Post date:** [November 23, 2019, 4:00pm UTC](https://root-forum.cern.ch/t/windows-64bit-support-for-root/36760/3 "2019-11-23T16:00:58Z")

</div>

Hey Bertrand.

Here is my version of the Win64 port.  
Most of the gtests are passing, except for the dataframe ones, which I could use help with. I suspect I am still missing some export symbols from libCling,  
The ugly part is most of these fail with some sort of heap corruption.

> **[pkthong/root](https://github.com/pkthong/root/tree/tryWin64)**
>
> The official repository for ROOT: analyzing, storing and visualizing big data, scientifically - pkthong/root

Gtests on Win32  
Total Test time (real) = 192.83 sec

The following tests FAILED:

```
      8 - gtest-core-dictgen-test-dictgen-base (Failed)

     14 - gtest-core-meta-test-testHashRecursiveRemove (Failed)

     15 - gtest-core-meta-test-testTClass (Failed)

     17 - gtest-core-metacling-test-coremetaclingtestUnit (Failed)

     25 - gtest-hist-hist-test-testTKDE (Failed)

     29 - gtest-io-io-test-TBufferMerger (Failed)

    120 - gtest-tree-dataframe-test-dataframe-helpers (Failed)

    136 - gtest-tree-tree-test-testBulkApi (Failed)

```

Win64

The following tests FAILED:

```
      8 - gtest-core-dictgen-test-dictgen-base (Failed)

     14 - gtest-core-meta-test-testHashRecursiveRemove (Failed)

     15 - gtest-core-meta-test-testTClass (Failed)

     17 - gtest-core-metacling-test-coremetaclingtestUnit (Failed)

     25 - gtest-hist-hist-test-testTKDE (Failed)

     29 - gtest-io-io-test-TBufferMerger (Failed)

    108 - gtest-tree-dataframe-test-dataframe-friends (Failed)

    109 - gtest-tree-dataframe-test-dataframe-colnames (Failed)

    110 - gtest-tree-dataframe-test-dataframe-cache (Failed)

    111 - gtest-tree-dataframe-test-dataframe-callbacks (Failed)

    112 - gtest-tree-dataframe-test-dataframe-histomodels (Failed)

    113 - gtest-tree-dataframe-test-dataframe-interface (Failed)

    115 - gtest-tree-dataframe-test-dataframe-regression (Failed)

    116 - gtest-tree-dataframe-test-dataframe-simple (Failed)

    117 - gtest-tree-dataframe-test-dataframe-snapshot (Failed)

    118 - gtest-tree-dataframe-test-dataframe-utils (Failed)

    120 - gtest-tree-dataframe-test-dataframe-helpers (Failed)

    121 - gtest-tree-dataframe-test-dataframe-ranges (Failed)

    122 - gtest-tree-dataframe-test-dataframe-leaves (Failed)

    123 - gtest-tree-dataframe-test-dataframe-vecops (Failed)

    125 - gtest-tree-dataframe-test-dataframe-take (Failed)

    127 - gtest-tree-dataframe-test-datasource-more (Failed)

    128 - gtest-tree-dataframe-test-datasource-root (Failed)

    129 - gtest-tree-dataframe-test-datasource-trivial (Failed)

    130 - gtest-tree-dataframe-test-datasource-csv (Failed)

    136 - gtest-tree-tree-test-testBulkApi (Failed)

    137 - gtest-tree-tree-test-testBulkApiMultiple (Failed)

    138 - gtest-tree-tree-test-testBulkApiVarLength (Failed)

    139 - gtest-tree-tree-test-testBulkApiSillyStruct (Failed)

    146 - gtest-tree-treeplayer-test-treetreeplayertestUnit (Failed)
```

---

<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:** [November 26, 2019, 12:01pm UTC](https://root-forum.cern.ch/t/windows-64bit-support-for-root/36760/4 "2019-11-26T12:01:38Z")

</div>

Hi,

Thanks for sharing your code. After a quick look, I have a few remarks:

- This change:

- You cannot change the interface in a backward incompatible way. One must keep the API inchaged on other platforms.  
For example, changing this signature:  
`Long_t TCling::Calc(const char *line, EErrorCode *error)`  
into this:  
`Long64_t TCling::Calc(const char *line, EErrorCode *error)`  
is backward incompatible (same for changing methods parameters)

- How did you run the tests?  
Can you try to enable testing (when configuring with CMake) and then try (in the build directory):

As a general comment, the code must still compile on all platforms. And **the user’s code must still compile without having to modify it** to adapt to any of the changes made for Win64…  
As I said, I have a backward compatible and (more or less) working solution, but as you can see it is non trivial to change the code **without changing the ROOT API**

Cheers, Bertrand.

---

<div class="post-metadata">

**Author:** ![Philip\_Thong](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/philip_thong/32/19931_2.png) [@Philip\_Thong](https://root-forum.cern.ch/u/Philip_Thong)\
**Post date:** [December 3, 2019, 2:05pm UTC](https://root-forum.cern.ch/t/windows-64bit-support-for-root/36760/5 "2019-12-03T14:05:00Z")

</div>

I initially ran the tests using ‘ctest -j8 -C Debug’ and modified the cmake files to allow for an easier debugging experience  
([https://github.com/pkthong/root/commit/f1ce8c730c28b577ce2a49da88858fafdff8df5e](https://github.com/pkthong/root/commit/f1ce8c730c28b577ce2a49da88858fafdff8df5e))

---

<div class="post-metadata">

**Author:** ![Philip\_Thong](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/philip_thong/32/19931_2.png) [@Philip\_Thong](https://root-forum.cern.ch/u/Philip_Thong)\
**Post date:** [December 3, 2019, 2:18pm UTC](https://root-forum.cern.ch/t/windows-64bit-support-for-root/36760/6 "2019-12-03T14:18:21Z")

</div>

In debugging my stack corruption issues, I think I have found a major stumbling block related to the way Cling+LLVM resolves symbols, specifically the non-uniquely defined symbols from msvrt.dll and ucrtbase.dll.

@bellenot , you might have an idea, since you made the following change, which reversed the order of symbol lookup  
([https://github.com/pkthong/root/commit/c1e4fd941be13df6b106f99ad038e778b939c761?diff=unified#diff-9be88db82ded17a68af326157fc224edR591](https://github.com/pkthong/root/commit/c1e4fd941be13df6b106f99ad038e778b939c761?diff=unified#diff-9be88db82ded17a68af326157fc224edR591))

In Win64, the LLVM name mangler is returning a symbol lookup of ‘free’, compared to \_free in Win32. It easily finds ‘free’ in msvcrt.dll, unfortunately, it should be using ucrtbase.dll’s version.

In Win32, since the mangler returns \_free, ultimately, the symbol lookup happens in PlatformWin.cpp, where the ‘\_’ is removed before looking up the symbol, and modules are processed in load order.([https://github.com/pkthong/root/commit/c1e4fd941be13df6b106f99ad038e778b939c761?diff=split#diff-9be88db82ded17a68af326157fc224edR595](https://github.com/pkthong/root/commit/c1e4fd941be13df6b106f99ad038e778b939c761?diff=split#diff-9be88db82ded17a68af326157fc224edR595))

Does your version of the Win64 port have these issues?

If you have a git branch handy, I’d be interested in seeing how you worked around the issue.

---

<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:** [December 10, 2019, 11:16am UTC](https://root-forum.cern.ch/t/windows-64bit-support-for-root/36760/7 "2019-12-10T11:16:04Z")

</div>

I still have several issues with Win64, and I still have to create a branch for the Win64 port of ROOT… I’ll keep you in touch.

---

<div class="post-metadata">

**Author:** ![Philip\_Thong](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/philip_thong/32/19931_2.png) [@Philip\_Thong](https://root-forum.cern.ch/u/Philip_Thong)\
**Post date:** [December 10, 2019, 8:20pm UTC](https://root-forum.cern.ch/t/windows-64bit-support-for-root/36760/8 "2019-12-10T20:20:23Z")

</div>

Just to keep you up to date on where I am.  
I see the following issues, I could use some help with:

- dynamic\_cast is failing. See stressIterator-interpreted

- TTree::Draw(\<3d\>) is passing an invalid ‘this’ pointer to the TPolyMarker3d::PaintH3()

---

<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:** [December 11, 2019, 12:51pm UTC](https://root-forum.cern.ch/t/windows-64bit-support-for-root/36760/9 "2019-12-11T12:51:05Z")

</div>

So with [your changes](https://github.com/pkthong/root/commit/c1d378c6a8c9493b9f15a6413980b88491122972), here is what I get:

```auto
96% tests passed, 22 tests failed out of 601

Label Time Summary:
longtest = 1102.28 sec*proc (15 tests)
tutorial = 3425.70 sec*proc (452 tests)

Total Test time (real) = 824.34 sec

The following tests FAILED:
         14 - gtest-core-metacling-test-coremetaclingtestUnit (Failed)
         23 - gtest-hist-hist-test-testTKDE (Failed)
         29 - gtest-io-io-test-TBufferMerger (Failed)
         89 - gtest-roofit-roofitcore-test-testWorkspace (Failed)
         90 - gtest-roofit-roofitcore-test-testRooDataHist (Failed)
         95 - test-check-invalidptr (Failed)
        103 - test-stress (Failed)
        113 - test-stresshistogram-interpreted (Failed)
        123 - test-stressroostats-interpreted (Failed)
        125 - test-stressfit-interpreted (Failed)
        129 - test-stressiterators-interpreted (Failed)
        136 - test-periodic-build (Failed)
        139 - gtest-tree-tree-test-testBulkApi (Failed)
        140 - gtest-tree-tree-test-testBulkApiMultiple (Failed)
        141 - gtest-tree-tree-test-testBulkApiVarLength (Failed)
        142 - gtest-tree-tree-test-testBulkApiSillyStruct (Failed)
        162 - tutorial-fit-combinedFit (Failed)
        163 - tutorial-fit-exampleFit3D (Failed)
        185 - tutorial-fit-multidimfit (Failed)
        372 - tutorial-legacy-cont-TListAndSTL (Failed)
        393 - tutorial-math-exampleFunctor (Failed)
        420 - tutorial-roofit-rf102_dataimport (Failed)
Errors while running CTest

```

---

<div class="post-metadata">

**Author:** ![Philip\_Thong](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/philip_thong/32/19931_2.png) [@Philip\_Thong](https://root-forum.cern.ch/u/Philip_Thong)\
**Post date:** [December 11, 2019, 2:28pm UTC](https://root-forum.cern.ch/t/windows-64bit-support-for-root/36760/10 "2019-12-11T14:28:35Z")

</div>

Interesting. I take it you adopted some of my changes into your own win64 branch? Or did you run mine as-is?

I should clarify that I mostly wanted to do a quick and dirty prototype of the win64 port, with hopes that some of the changes will make it into your branch. At least I know the win32gdk will not be an issue for 64bit.

---

<div class="post-metadata">

**Author:** ![Philip\_Thong](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/philip_thong/32/19931_2.png) [@Philip\_Thong](https://root-forum.cern.ch/u/Philip_Thong)\
**Post date:** [December 11, 2019, 2:30pm UTC](https://root-forum.cern.ch/t/windows-64bit-support-for-root/36760/11 "2019-12-11T14:30:06Z")

</div>

Once we can get a common branch, I’d be interested in poking at the remaining tests and seeing why they are still failing.

---

<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:** [December 11, 2019, 2:52pm UTC](https://root-forum.cern.ch/t/windows-64bit-support-for-root/36760/12 "2019-12-11T14:52:21Z")

</div>

> [@Philip\_Thong](#):
>
> I take it you adopted some of my changes into your own win64 branch? Or did you run mine as-is?

I only took [this commit](https://github.com/pkthong/root/commit/c1d378c6a8c9493b9f15a6413980b88491122972) (more or less) on top of our changes, but I this still need to be understood… 😉  
And as I said, our modifications are much more complex than what you did (but I still have to dig deeper into your code)

---

<div class="post-metadata">

**Author:** ![Philip\_Thong](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/philip_thong/32/19931_2.png) [@Philip\_Thong](https://root-forum.cern.ch/u/Philip_Thong)\
**Post date:** [December 11, 2019, 4:04pm UTC](https://root-forum.cern.ch/t/windows-64bit-support-for-root/36760/13 "2019-12-11T16:04:08Z")

</div>

To see the affect of the mangling from [this commit](https://github.com/pkthong/root/commit/c1d378c6a8c9493b9f15a6413980b88491122972), put a breakpoint [here](https://github.com/pkthong/root/blob/c1d378c6a8c9493b9f15a6413980b88491122972/interpreter/llvm/src/lib/Support/Windows/DynamicLibrary.inc#L142)  
You will find that without the commit, the search for c runtime functions, like (::free) always resolves in this loop.  
With the fix, the symbol resolves [here](https://github.com/pkthong/root/blob/c1d378c6a8c9493b9f15a6413980b88491122972/interpreter/cling/lib/Utils/PlatformWin.cpp#L612)  
(note: the comment above on L611 is incorrect, and left over from an old commit)

---

<div class="post-metadata">

**Author:** ![Philip\_Thong](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/philip_thong/32/19931_2.png) [@Philip\_Thong](https://root-forum.cern.ch/u/Philip_Thong)\
**Post date:** [December 17, 2019, 4:42pm UTC](https://root-forum.cern.ch/t/windows-64bit-support-for-root/36760/14 "2019-12-17T16:42:11Z")

</div>

I think I might have an answer for the dynamic\_cast issue.  
\_\_ImageBase doesn’t seem to be handled correctly in the LLVM 5.0 version we have in ROOT.  
This was fixed in the LLVM master in ([https://reviews.llvm.org/D30709](https://reviews.llvm.org/D30709))

It may be worth a shot to upgrade LLVM to something newer, and retrying.

---

<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:** [December 18, 2019, 7:58am UTC](https://root-forum.cern.ch/t/windows-64bit-support-for-root/36760/15 "2019-12-18T07:58:29Z")

</div>

We were planning to upgrade LLVM since quite a while… Should happen soon(ish) Thanks for confirming it would solve at least one issue!

---

<div class="post-metadata">

**Author:** ![Philip\_Thong](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/philip_thong/32/19931_2.png) [@Philip\_Thong](https://root-forum.cern.ch/u/Philip_Thong)\
**Post date:** [December 20, 2019, 8:09pm UTC](https://root-forum.cern.ch/t/windows-64bit-support-for-root/36760/16 "2019-12-20T20:09:37Z")

</div>

I imported ROOT 5.0.2 and applied the patches from ([http://root.cern.ch/git/llvm.git](http://root.cern.ch/git/llvm.git)) and backported the fix to \_\_ImageBase, in case you wanted to try it out without waiting for the llvm upgrade.  
I also fixed some ptr casting issues in mathcore.  
([https://github.com/pkthong/root/commit/68da5daa0699e893f93eb38bb95b1f19bbc8d663](https://github.com/pkthong/root/commit/68da5daa0699e893f93eb38bb95b1f19bbc8d663))

---

<div class="post-metadata">

**Author:** ![Philip\_Thong](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/philip_thong/32/19931_2.png) [@Philip\_Thong](https://root-forum.cern.ch/u/Philip_Thong)\
**Post date:** [July 6, 2020, 10:15pm UTC](https://root-forum.cern.ch/t/windows-64bit-support-for-root/36760/17 "2020-07-06T22:15:01Z")

</div>

Any movement on upgrading the LLVM stack in ROOT?

---

<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:** [July 7, 2020, 6:27am UTC](https://root-forum.cern.ch/t/windows-64bit-support-for-root/36760/18 "2020-07-07T06:27:05Z")

</div>

This should happen this year (sorry, but there no precise schedule for the upgrade)
