开发者

Cannot get cabal to find the mpi library for haskell-mpi on Windows [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 11 years ago.

PROBLEM IS SOLVED!

  1. Follow the instructions Dons posted here
  2. Open your environment variables (My Computer -> Properties (in the context menu) -> Advanced)
  3. Add to or make a new environment variable C_INCLUDE_PATH so it points to MPI's include directory. In my case, /c/program files/mpich2/include.
  4. Add to or make a new environment variable LIBRARY_PATH so it points to MPI's lib directory. In my case, /c/program files/mpich2/lib
  5. Hide libmpi.a somehow. If need be, you can fix this later. It is a hack but you cannot build haskell-mpi without doing it because ld will fail. I renamed it to _libmpi.a

Now haskell-mpi should build on windows. Anticipating more trouble down the line, but it built, and it solved my problem.


I am wanting to use haskell-mpi on a lab machine at one of my university labs to do my final project for my parallel computing class, but I am running into trouble trying to get haskell-mpi to build against MPICH2.

haskell-mpi is pretty much completely undocumented, and digging through their git repository has helped me program some example programs on it but has done nothing to help me set it up on Windows. On my personal linux system, I had no trouble setting up and running haskell-mpi against MPICH2.

The problem is probably in one of cabal, the way MPICH2 is installed, or with haskell-mpi's cabal configuration, hence the choice of tags.

I am open to experimenting here for the sake of troubleshooting, and adding more information as needed, but eventually I will no longer have access to these machines.

I have administrator rights in the lab where I will be running this, so if the problem is with the MPICH2 installation itself, I could indeed reinstall it.

cabal fails as follows when I try to install haskell-mpi:

Resolving dependencies...
Configuring haskell-mpi-1.0.0...
cabal: Missing dependency on a foreign library:
* Missing C library: mpi
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you开发者_开发技巧 can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
cabal: Error: some packages failed to install:
haskell-mpi-1.0.0 failed during the configure step. The exception was:
ExitFailure 1

Here are what I tried giving for --extra-lib-dirs and --extra-include-dirs:

--extra-lib-dirs="C:\Program Files\MPICH2\lib" 
--extra-include-dirs="C:\Program Files\MPICH2\include"

I've tried reordering where I put those flags, escaping the backlashes, using the short path PROGRA~1 and various permutations of these. So I don't think this is going to help. I need to know what the mpi dependency actually means and figure out how I will satisfy it so that this library can actually build. Here is what lives in the two aforementioned folders at this moment:

Libs:

 Volume in drive C has no label.
 Volume Serial Number is 5406-5C5C

 Directory of C:\Program Files\MPICH2\lib

04/22/2011  01:20 PM    <DIR>          .
04/22/2011  01:20 PM    <DIR>          ..
01/31/2011  03:59 PM           515,704 cxx.lib
01/31/2011  04:23 PM           137,434 fmpich2.lib
01/31/2011  04:25 PM           410,982 fmpich2g.lib
01/31/2011  04:29 PM           162,690 fmpich2s.lib
01/31/2011  04:53 PM                 0 libfmpich2g.a
01/31/2011  04:53 PM                 0 libmpi.a
01/31/2011  04:53 PM           215,528 libmpicxx.a
01/31/2011  04:16 PM            10,618 mpe.lib
01/31/2011  04:46 PM           135,434 mpi.lib
               9 File(s)      1,588,390 bytes
               2 Dir(s)  221,505,835,008 bytes free

Include:

 Volume in drive C has no label.
 Volume Serial Number is 5406-5C5C

 Directory of C:\Program Files\MPICH2\include

02/01/2011  05:38 PM    <DIR>          .
02/01/2011  05:38 PM    <DIR>          ..
11/17/2009  09:46 PM             4,857 clog_commset.h
11/02/2007  05:50 PM               696 clog_const.h
01/31/2011  03:50 PM               731 clog_inttypes.h
11/17/2009  09:46 PM             1,353 clog_uuid.h
10/21/2010  01:20 PM               355 mpe.h
11/17/2009  09:46 PM            11,102 mpe_log.h
11/02/2007  05:50 PM             1,833 mpe_logf.h
11/17/2009  09:46 PM             1,322 mpe_misc.h
01/31/2011  03:50 PM            57,128 mpi.h
01/31/2011  04:23 PM             3,251 mpi.mod
01/31/2011  03:50 PM            97,267 mpicxx.h
01/31/2011  03:51 PM            19,051 mpif.h
01/31/2011  03:50 PM            16,765 mpio.h
01/31/2011  04:23 PM            13,668 mpi_base.mod
01/31/2011  04:23 PM            30,866 mpi_constants.mod
01/31/2011  04:23 PM             7,802 mpi_sizeofs.mod
              16 File(s)        268,047 bytes
               2 Dir(s)  221,505,830,912 bytes free

Is there anything here that might be recognizably missing?

I am quite stumped at this point. Just about any suggestion would be helpful.

Sincerely, Barend.

PS: This should probably be tagged "haskell-mpi", but I'm not allowed to make new tags. I guess nobody else is really using it yet.

EDIT: Following Dons' suggestion,

I installed MingGW and MSYS. After running mingw-get update, I used mingw32-get to retrieve libtools, mingw32-utils, and mingw32-binutils. I set the following environment variables for the whole system using the Windows configuration GUI:

LIBRARY_PATH="C:\Program Files\MPICH2\lib"
C_INCLUDE_PATH="C:\Program Files\MPICH2\include"

echo $LIBRARY_PATH and echo %LIBRARY_PATH% now both work as expected, no surprises there. The environment variables are set. Making progress.

cabal install haskell-mpi still produces the same output it did before.

Played with ld for a long time, huge red herring...

I had to hide libmpi.a from ld to get it to work, but haskell-mpi now builds!

Putting step by step details at the top.


I need to know what the mpi dependency actually means

The line extra-libraries: mpi means that Cabal will add -lmpi to the ld linker options. In addition, tools that process headers will search in the include paths.

So, how do we help GHC and binutils find that library?

According to the wiki, assuming you have mingw or msys,

If you need to link to C-software, define an environment variable C_INCLUDE_PATH that lists the directories where the header files can be found. For linking the libraries you need to define an environment variable LIBRARY_PATH as well, listing the directories where .a and .lib files can be found.

So try setting the paths to include the path to the headers and libraries.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜