# CMake different build output in windows and linux for ARM M0

**URL:** <https://discourse.cmake.org/t/cmake-different-build-output-in-windows-and-linux-for-arm-m0/1233>\
**Category:** Code\
**Tags:** os:linux, os:windows\
**Created:** [May 19, 2020, 7:19am UTC](https://discourse.cmake.org/t/cmake-different-build-output-in-windows-and-linux-for-arm-m0/1233 "2020-05-19T07:19:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![david.reimondez](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/d/54ee81/32.png) [@david.reimondez](https://discourse.cmake.org/u/david.reimondez)\
**Post date:** [May 19, 2020, 7:19am UTC](https://discourse.cmake.org/t/cmake-different-build-output-in-windows-and-linux-for-arm-m0/1233/1 "2020-05-19T07:19:05Z")

</div>

Hi all !

We are using cmake in combination with Ninja and gcc-arm compiler for doing cross-compiling for ARM M0 microcontroller processor. The output of this is an .hex file  
It is quite interesting that using exactly same cmake, ninja and compiler version and of course same set-up (same CMakeList, code, etc) it brings completely different compilation result (different .hex files) when we compile on Windows and Linux.

Is this normal? What is the explanation for this? Or are we doing something wrong?

I had a look on the Cmake logs and they are pretty similar but it loos the building order is a little bit different on Windows and on Linux. Can this be solved somehow? Is it possible to define the build order?

Thanks a lot for your help!

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [November 9, 2020, 7:46pm UTC](https://discourse.cmake.org/t/cmake-different-build-output-in-windows-and-linux-for-arm-m0/1233/2 "2020-11-09T19:46:31Z")

</div>

Usually this means that your build is under-specified. Some `add_custom_command` is likely missing a `DEPENDS` or `OUTPUT` path that would hook things up properly. I usually use `ninja -t debug` to figure out what `ninja` is looking at for recompilation. Knowing a bit about how `ninja` works internally, it does sort various bits based on pointer values, so the build order could be different even with similar allocation patterns given the differences in `malloc` implementations on the two platforms.

As for the difference in the `.hex` files, I would try to minimize what makes the output to try and determine what, exactly, _is_ the difference in the files. It could be padding or metadata that is different.
