无法让 cabal 在 Windows 上找到 haskell-mpi 的 mpi 库

发布于 2024-11-03 11:43:33 字数 4607 浏览 3 评论 0原文

问题已解决!

  1. 按照 Dons 在此处发布的说明
  2. 进行操作环境变量(我的电脑 -> 属性(在上下文菜单中)-> 高级)
  3. 添加或创建一个新的环境变量 C_INCLUDE_PATH,使其指向 MPI 的包含目录。就我而言,/c/program files/mpich2/include
  4. 添加或创建一个新的环境变量LIBRARY_PATH,使其指向 MPI 的 lib 目录。就我而言, /c/program files/mpich2/lib
  5. 以某种方式隐藏 libmpi.a 。如果需要,您可以稍后修复此问题。这是一个 hack,但如果不这样做你就无法构建 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 失败如下:

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

这是我尝试为 --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:

 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

包含:

 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

这里是否有任何东西可能明显丢失?

我现在很困惑。任何建议都会有帮助。

此致,巴伦德。

PS:这可能应该被标记为“haskell-mpi”,但我不允许创建新标签。我想还没有人真正使用过它。

编辑:按照 Dons 的建议,

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

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

echo $LIBRARY_PATHecho %LIBRARY_PATH% 现在都按预期工作,没有什么意外。环境变量已设置。不断进步。

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

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

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

将逐步详细信息放在顶部。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

舂唻埖巳落 2024-11-10 11:43:33

我需要知道 mpi 依赖项的实际含义

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

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

根据 wiki,假设您有 mingw 或 msys,

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

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

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文