无法在Windows上找到cabal以查找haskell-mpi的mpi库 [英] Cannot get cabal to find the mpi library for haskell-mpi on Windows

查看:150
本文介绍了无法在Windows上找到cabal以查找haskell-mpi的mpi库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题已解决!


  1. 按照说明Dons发布 here

  2. 打开您的环境变量(我的电脑 - >属性(在上下文菜单中) - > Advanced)

  3. 添加或创建一个新的环境变量 C_INCLUDE_PATH ,以便它指向MPI的include目录。在我的情况下, / c / program files / mpich2 / include

  4. 添加或创建一个新的环境变量 LIBRARY_PATH ,所以它指向MPI的lib目录。在我的例子中, / c / program files / mpich2 / lib

  5. 以某种方式隐藏libmpi.a。如果需要,您可以稍后解决。这是一个黑客,但你不能建立haskell-mpi,因为ld会失败。我将它重命名为_libmpi.a

现在haskell-mpi应该在windows上构建。预计更多的麻烦,但它的建立,它解决了我的问题。






我想使用haskell- mpi在我的一个大学实验室的实验室机器上执行我的并行计算课程的最终项目,但是我试图让haskell-mpi与MPICH2构建时遇到了麻烦。



haskell-mpi几乎完全没有记录,并且通过他们的git存储库进行挖掘帮助我编写了一些示例程序,但没有做任何事情来帮助我在Windows上进行设置。在我的个人linux系统上,我没有麻烦设置并运行针对MPICH2的haskell-mpi。



问题可能出在cabal上,MPICH2的安装方式,或使用haskell-mpi的cabal配置,因此可以选择标签。



为了解决问题并在需要时添加更多信息,我愿意在这里进行试验,但最终我将无法再访问这些机器。



我在实验室中拥有管理员权限,因此如果问题出在MPICH2安装本身上,我确实可以重新安装它。



在我尝试安装haskell-mpi时cabal失败,如下所示:

<$ p $
配置haskell-mpi-1.0.0 ...
cabal:缺少对外部库的依赖:
*缺少C库: mpi
这个问题通常可以通过安装
提供这个库的系统包来解决(你可能需要-dev版本上)。如果库已经安装了
,但在非标准位置,那么您可以使用标志
--extra-include-dirs =和--extra-lib-dirs =来指定它的位置。
cabal:错误:某些软件包未能安装:在配置步骤中,
haskell-mpi-1.0.0失败。例外情况是:
ExitFailure 1

以下是我为--extra- lib-dirs和--extra-include-dirs:

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

我试着重新排列这些标记,使用短路径 PROGRA〜1 和各种标记这些排列。所以我认为这不会有帮助。我需要知道 mpi 依赖关系实际上是什么意思,并找出我将如何满足它,以便该库可以实际构建。这就是目前生活在上述两个文件夹中的内容:



Libs:

 驱动器C中的卷没有标签。 
卷序列号为5406-5C5C

C:\程序文件目录\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文件1,588,390字节
2 Dir(s)221,505,835,008字节免费

头文件:

 驱动器C中的卷没有标签。 
卷序列号为5406-5C5C

C:\程序文件目录\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文件268,047字节
2 Dir(s)221,505,830,912字节免费
code>

这里有什么东西可以被认出吗?



我是在这一点上很难过。几乎任何建议都会有帮助。



此致,Barend。



PS: haskell-mpi,但我不允许制作新标签。我猜其他人还没有真正使用它。



编辑:关于Dons的建议,



我安装了MingGW和MSYS。运行mingw-get更新后,我使用mingw32-get来检索libtools,mingw32-utils和mingw32-binutils。我使用Windows配置GUI设置了整个系统的以下环境变量:

  LIBRARY_PATH =C:\程序文件\\ MPICH2 \ lib
C_INCLUDE_PATH =C:\ Program Files \MPICH2\include

echo $ LIBRARY_PATH echo%LIBRARY_PATH%现在都可以按预期工作,这并不意外。环境变量已设置。取得进展



cabal install haskell-mpi 仍然产生与之前相同的输出。



长时间玩ld,巨大的红鲱鱼...

我不得不从ld隐藏libmpi.a以获得它可以工作,但haskell-mpi现在可以构建!



将详细步骤放在最上面。 >解决方案


我需要知道mpi依赖的实际含义是什么

extra-libraries:mpi 意味着Cabal会将 -lmpi 添加到ld链接器选项中。此外,处理标题的工具将在包含路径中进行搜索。



那么,我们如何帮助GHC和binutils找到该库?



根据到wiki ,假设您有mingw或msys, b
$ b


如果您需要链接到C软件,请定义一个环境变量C_INCLUDE_PATH,其中列出了可以找到头文件的目录。为了链接库,您还需要定义一个环境变量LIBRARY_PATH,列出可以找到.a和.lib文件的目录。


因此,请尝试设置路径以包含标题和库的路径。


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.

这篇关于无法在Windows上找到cabal以查找haskell-mpi的mpi库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆