You are not logged in.

#1 2020-12-07 10:09:20

Registered: 2020-12-07
Posts: 2

[Solved] Haskell-mpi on Arch


I am trying to compile haskell-mpi on Arch Linux. I have not found it in the official repocitory, so I'm installing it with cabal.

So far, I have managed to get to the linking stage. Unfortunately, the compilation then fails with the following error:

/usr/bin/ error: cannot find -lmpi
/usr/bin/ error: cannot find -lopen-rte
/usr/bin/ error: cannot find -lopen-pal
collect2: error: ld returned 1 exit status
`cc' failed in phase `Linker'. (Exit code: 1)
cabal: Failed to build haskell-mpi-1.4.0. See the build log above for details.

The options I have specified in my


are the following:

  gcc-options: -pthread -Wl,-rpath -Wl,/usr/lib/openmpi -Wl,--enable-new-dtags -L/usr/lib/openmpi
  ghc-options: -dynamic
  ld-options: -L/usr/lib/openmpi/

As a jury-rigged solution I have used the Foreign Function Interface to write my own, minimal MPI interface. I did this passing the flags

-lmpi -lopen-rte -lopen-pal -L/usr/lib/openmpi

to ghc, which gave no errors. This code executes correctly, so I don't think the problem is with MPI.

Why does this happen? I am not too familiar with linking, so I would appreciate any help you could offer!

This is my first post here, so apologies for any mistakes, and thank you in advance!

Last edited by Clepton (2020-12-10 08:07:59)


#2 2020-12-10 08:07:36

Registered: 2020-12-07
Posts: 2

Re: [Solved] Haskell-mpi on Arch

I managed to solve it!

When it complained about ld not finding the mpi libraries, I added


to ld-options. Apparently, this was incorrect! Instead, passing the flag directly to ghc (using ghc-options) solved the issue.

I don't know why, but it appears that the linker is called directly by ghc and ignores ld-options.

Marking as solved!

Best regards!


Board footer

Powered by FluxBB