# Error building 'MPI\`, libmpi could not be found

**URL:** <https://discourse.julialang.org/t/error-building-mpi-libmpi-could-not-be-found/63785>\
**Category:** Julia at Scale\
**Created:** [June 29, 2021, 8:09pm UTC](https://discourse.julialang.org/t/error-building-mpi-libmpi-could-not-be-found/63785 "2021-06-29T20:09:59Z")\
**Posts on this page:** 9\
**Page:** 2

<div class="post-metadata">

**Author:** ![simonbyrne](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simonbyrne/32/19_2.png) [@simonbyrne](https://discourse.julialang.org/u/simonbyrne)\
**Post date:** [July 2, 2021, 4:43am UTC](https://discourse.julialang.org/t/error-building-mpi-libmpi-could-not-be-found/63785/21 "2021-07-02T04:43:42Z")

</div>

It looks like it is picking up an old libc. Perhaps try adding `/cvmfs/soft.computecanada.ca/gentoo/2020/lib64` to your `LD_LIBRARY_PATH`?

---

<div class="post-metadata">

**Author:** ![QuanlingDeng](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/quanlingdeng/32/27360_2.png) [@QuanlingDeng](https://discourse.julialang.org/u/QuanlingDeng)\
**Post date:** [July 21, 2021, 5:02am UTC](https://discourse.julialang.org/t/error-building-mpi-libmpi-could-not-be-found/63785/22 "2021-07-21T05:02:33Z")

</div>

@francispoulin I had a similar issue and I was wondering if you were able to build MPI?

---

<div class="post-metadata">

**Author:** ![francispoulin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/francispoulin/32/24551_2.png) [@francispoulin](https://discourse.julialang.org/u/francispoulin)\
**Post date:** [July 21, 2021, 1:17pm UTC](https://discourse.julialang.org/t/error-building-mpi-libmpi-could-not-be-found/63785/23 "2021-07-21T13:17:58Z")

</div>

Sorry for the late reply. I did try that and it didn’t help.

I am asking for support from people who maintain the machines and hope they can figure it out. I will let you know if/when we get it working.

---

<div class="post-metadata">

**Author:** ![francispoulin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/francispoulin/32/24551_2.png) [@francispoulin](https://discourse.julialang.org/u/francispoulin)\
**Post date:** [July 21, 2021, 1:18pm UTC](https://discourse.julialang.org/t/error-building-mpi-libmpi-could-not-be-found/63785/24 "2021-07-21T13:18:51Z")

</div>

Unfortunately, I have not had a successful build on the server. I’m asking for some technical support and if others manage to do it, I will certainly share waht I learn. Sorry that I could not be of more help.

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [July 21, 2021, 1:24pm UTC](https://discourse.julialang.org/t/error-building-mpi-libmpi-could-not-be-found/63785/25 "2021-07-21T13:24:25Z")

</div>

Most of the time, messages like

```julia
fileX.so: cannot open shared object file: No such file or directory

```

are misleading, because it isn’t `fileX.so` that can’t be found, but some of its dependencies. All kernels are _very_ bad because with this message they don’t tell you what can’t be found. On systems like Linux you have to use `strace` to find out what file is being searched but can’t be found. Nothing Julia can’t do about, operating systems are just unhelpful.

---

<div class="post-metadata">

**Author:** ![francispoulin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/francispoulin/32/24551_2.png) [@francispoulin](https://discourse.julialang.org/u/francispoulin)\
**Post date:** [July 21, 2021, 2:11pm UTC](https://discourse.julialang.org/t/error-building-mpi-libmpi-could-not-be-found/63785/26 "2021-07-21T14:11:27Z")

</div>

Thank you @giordano for the help. I have never used `strace` before. Could you point me to an example that might help me figure out what I need to do?

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [July 21, 2021, 2:20pm UTC](https://discourse.julialang.org/t/error-building-mpi-libmpi-could-not-be-found/63785/27 "2021-07-21T14:20:24Z")

</div>

Start julia with

```julia
strace julia 2> strace.log

```

After you get the error message, you can see in the `strace.log` file what files are being searched. This file is going to be _large_, have fun.

---

<div class="post-metadata">

**Author:** ![simonbyrne](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simonbyrne/32/19_2.png) [@simonbyrne](https://discourse.julialang.org/u/simonbyrne)\
**Post date:** [July 21, 2021, 8:55pm UTC](https://discourse.julialang.org/t/error-building-mpi-libmpi-could-not-be-found/63785/28 "2021-07-21T20:55:38Z")

</div>

You might also be able to use `LD_DEBUG`, which will output info from the linker. I think `LD_DEBUG=libs julia` should be sufficient?

---

<div class="post-metadata">

**Author:** ![QuanlingDeng](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/quanlingdeng/32/27360_2.png) [@QuanlingDeng](https://discourse.julialang.org/u/QuanlingDeng)\
**Post date:** [July 22, 2021, 1:17am UTC](https://discourse.julialang.org/t/error-building-mpi-libmpi-could-not-be-found/63785/29 "2021-07-22T01:17:37Z")

</div>

Thanks for your reply.

I have now figured it out and it worked.  
I did not change any of other environmental variables but did the following

1. go to a terminal
2. type emacs ~/.julia/prefs/MPI.toml
3. set path = “/usr/local/Cellar/open-mpi/4.1.1\_2”

It seems that the way of setting the path is different from the ways in the two links in my original post (see [Error building MPI---ERROR: LoadError: libmpi could not be found](https://discourse.julialang.org/t/error-building-mpi-error-loaderror-libmpi-could-not-be-found/65016)) which were in the files ~/.bash\_profile or ~/.profile

Maybe it’s Julia version thing

[Previous page](https://discourse.julialang.org/t/error-building-mpi-libmpi-could-not-be-found/63785.md?page=1)
