# Cross compiling to several OSes

**URL:** <https://discuss.ocaml.org/t/cross-compiling-to-several-oses/6153>\
**Category:** Ecosystem\
**Tags:** build\
**Created:** [July 28, 2020, 7:16am UTC](https://discuss.ocaml.org/t/cross-compiling-to-several-oses/6153 "2020-07-28T07:16:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![grayswandyr](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/grayswandyr/32/94_2.png) [@grayswandyr](https://discuss.ocaml.org/u/grayswandyr)\
**Post date:** [July 28, 2020, 7:16am UTC](https://discuss.ocaml.org/t/cross-compiling-to-several-oses/6153/1 "2020-07-28T07:16:29Z")

</div>

Hi,  
I’d like to know if there are off-the-shelf, systematic solutions to build OCaml programs for various OSes (even better, I’d love to automatically publish releases for several OSes at once). In my case, I work on GNU/Linux and would like to build Mac OS and Windows 10 binaries. I suppose it should be doable with CI tools as we already have @avsm’s build scripts for Travis, right?

---

<div class="post-metadata">

**Author:** ![avsm](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/avsm/32/6_2.png) [@avsm](https://discuss.ocaml.org/u/avsm)\
**Post date:** [July 28, 2020, 1:14pm UTC](https://discuss.ocaml.org/t/cross-compiling-to-several-oses/6153/2 "2020-07-28T13:14:19Z")

</div>

The easiest way right now is to use a GitHub Actions to generate the executable artefacts. See [https://github.com/ocamllabs/duniverse/blob/master/.github/workflows/test.yml](https://github.com/ocamllabs/duniverse/blob/master/.github/workflows/test.yml) for an example.

There are various efforts going on throughout the ocaml/opam/dune stacks to simplify cross-compilation, but full “direct compilation” is a little while out as every piece of the stack has to work together. Luckily, hosted builds like GitHub Actions solve the immediate problem.

---

<div class="post-metadata">

**Author:** ![grayswandyr](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/grayswandyr/32/94_2.png) [@grayswandyr](https://discuss.ocaml.org/u/grayswandyr)\
**Post date:** [July 28, 2020, 4:05pm UTC](https://discuss.ocaml.org/t/cross-compiling-to-several-oses/6153/3 "2020-07-28T16:05:13Z")

</div>

Thanks, this is the king of thing I was looking for.
