You are not logged in.
Pages: 1
Hi!
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/ld.gold: error: cannot find -lmpi
/usr/bin/ld.gold: error: cannot find -lopen-rte
/usr/bin/ld.gold: 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
~/.cabal/config
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)
Offline
I managed to solve it!
When it complained about ld not finding the mpi libraries, I added
-L/usr/lib/openmpi/
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!
Offline
Pages: 1