为 macOS-x86_64 构建但尝试链接为 OpenMPI 上为 macOS-arm64 编译错误构建的文件

时间:2021-02-15 12:38:49

标签: c macos visual-studio-code openmpi

我正在尝试使用本教程在 VSCode 上安装和运行 OpenMPI https://medium.com/@li.nguyen_15905/setting-up-vscode-for-mpi-programming-b6665da6b4ad

<块引用>

当我“运行构建任务”来编译 Hello.c 文件时,我收到此错误:

(`Executing task: C/C++: mpicc build active file <

Starting build...
/Users/mohamad/opt/usr/local/bin/mpicc -g /Users/mohamad/opt/usr/local/bin/helloworld/.vscode/hello.c -o /Users/mohamad/opt/usr/local/bin/helloworld/.vscode/hello
ld: warning: ignoring file /Users/mohamad/opt/usr/local/lib/libmpi.dylib, **building for macOS-x86_64 but attempting to link with file built for macOS-arm64**
Undefined symbols for architecture x86_64:
  "_MPI_Comm_rank", referenced from:
      _main in hello-c829ad.o
  "_MPI_Comm_size", referenced from:
      _main in hello-c829ad.o
  "_MPI_Finalize", referenced from:
      _main in hello-c829ad.o
  "_MPI_Get_processor_name", referenced from:
      _main in hello-c829ad.o
  "_MPI_Init", referenced from:
      _main in hello-c829ad.o
  "_ompi_mpi_comm_world", referenced from:
      _main in hello-c829ad.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Build finished with error(s).
The terminal process failed to launch (exit code: -1).`)

运行命令 mpirun -np 2 hello 给出:

mpirun was unable to find the specified executable file, and therefore
did not launch the job.  This error was first reported for process
rank 0; it may have occurred for other processes as well.

NOTE: A common cause for this error is misspelling a mpirun command
      line parameter option (remember that mpirun interprets the first
      unrecognized command line token as the executable).

Node:       Mohamads-MBP
Executable: hello
--------------------------------------------------------------------------
2 total processes failed to start

有什么建议可以解决这个问题吗?

注意:所有使用的配置设置都包含在链接中。

0 个答案:

没有答案