# Problems installing OpenCoarrays under WSL2 on Windows 11

**URL:** <https://fortran-lang.discourse.group/t/problems-installing-opencoarrays-under-wsl2-on-windows-11/9043>\
**Category:** Help\
**Created:** [January 5, 2025, 7:05pm UTC](https://fortran-lang.discourse.group/t/problems-installing-opencoarrays-under-wsl2-on-windows-11/9043 "2025-01-05T19:05:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arjen](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@Arjen](https://fortran-lang.discourse.group/u/Arjen)\
**Post date:** [January 5, 2025, 7:05pm UTC](https://fortran-lang.discourse.group/t/problems-installing-opencoarrays-under-wsl2-on-windows-11/9043/1 "2025-01-05T19:05:26Z")

</div>

I am trying to install the OpenCoarrays feature for gfortran under WSL2. This turned out to be much more problematic than I hoped it would be. Here is what I did:

- I tried building from source, but that turned out not to be necessary.
- So I installed the libcoarrays-mpich-dev package.
- Compiling and linking via “caf” however gives a lot of missing libraries:

caf -o timing timing.f90  
f951: Warning: Nonexistent include directory ‘/usr/lib/x86\_64-linux-gnu/openmpi/lib/…/…/fortran/gfortran-mod-15/openmpi’ [-Wmissing-include-dirs]  
/usr/bin/ld: cannot find -lmpi\_usempif08: No such file or directory  
/usr/bin/ld: cannot find -lmpi\_usempi\_ignore\_tkr: No such file or directory  
/usr/bin/ld: cannot find -lmpi\_mpifh: No such file or directory  
/usr/bin/ld: cannot find -lopen-rte: No such file or directory  
/usr/bin/ld: cannot find -lopen-pal: No such file or directory  
/usr/bin/ld: cannot find -lhwloc: No such file or directory  
/usr/bin/ld: cannot find -levent\_core: No such file or directory  
/usr/bin/ld: cannot find -levent\_pthreads: No such file or directory  
collect2: error: ld returned 1 exit status  
Error: comand:  
`/usr/bin/mpif90.openmpi -I/usr/lib/x86_64-linux-gnu/fortran/ -fcoarray=lib -o timing timing.f90 /usr/lib/x86_64-linux-gnu/open-coarrays/openmpi/lib/libcaf_openmpi.a`

Apparently, I am missing a set of packages, but I have no idea which ones.

Any suggestions?

---

<div class="post-metadata">

**Author:** ![hkvzjal](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/hkvzjal/32/3055_2.png) [@hkvzjal](https://fortran-lang.discourse.group/u/hkvzjal)\
**Post date:** [January 5, 2025, 7:18pm UTC](https://fortran-lang.discourse.group/t/problems-installing-opencoarrays-under-wsl2-on-windows-11/9043/2 "2025-01-05T19:18:55Z")

</div>

Looking at the error messages you might try:

```auto
sudo apt install openmpi-bin openmpi-common libopenmpi-dev
sudo apt install libhwloc-dev libevent-dev
sudo apt-get install libpthread-stubs0-dev

```

---

<div class="post-metadata">

**Author:** ![everythingfunctional](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/everythingfunctional/32/176_2.png) [@everythingfunctional](https://fortran-lang.discourse.group/u/everythingfunctional)\
**Post date:** [January 6, 2025, 2:49am UTC](https://fortran-lang.discourse.group/t/problems-installing-opencoarrays-under-wsl2-on-windows-11/9043/3 "2025-01-06T02:49:34Z")

</div>

If I recall the Ubuntu packages (that WSL pulls from by default) are outdated and broken (could be wrong). I recommend using the install script in the OpenCoarrays repo.

---

<div class="post-metadata">

**Author:** ![Arjen](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@Arjen](https://fortran-lang.discourse.group/u/Arjen)\
**Post date:** [January 6, 2025, 10:51am UTC](https://fortran-lang.discourse.group/t/problems-installing-opencoarrays-under-wsl2-on-windows-11/9043/4 "2025-01-06T10:51:56Z")

</div>

Thanks, it took a while to build OpenCoarrays, or rather MPICH, but it does work now.

(I tried building it before under Cygwin, but I got a build error due to the redefinition of some C type)
