我正在尝试从 Xcode4 运行以下简单示例:
#include <boost/mpi/environment.hpp>
#include <boost/mpi/communicator.hpp>
#include <iostream>
namespace mpi = boost::mpi;
int main(int argc, char* argv[])
{
mpi::environment env(argc, argv);
mpi::communicator world;
std::cout << "I am process " << world.rank() << " of " << world.size()
<< "." << std::endl;
return 0;
}
我已将 libboost_mpi 和 libboost_serialization 添加到 Xcode,并使用默认 LLVM 进行编译返回:
/usr/local/include/boost/mpi/communicator.hpp:1329:9:错误:调用'boost::mpi::communicator'的隐式删除的复制构造函数:comm(comm),source(source),tag (tag), ia(comm), value(值) ^ ~~~~
但是,我可以编译和运行使用
mpic++ -I/usr/local/include main.cpp -L/usr/local/lib -lboost_mpi -lboost_serialization
虽然 mpic++ 似乎正在调用 LLVM:
$mpic++
i686-apple-darwin11-llvm-g++-4.2:没有输入文件
无论如何,我尝试在 Xcode 4 中添加 mpic++ 作为编译器选项。我可以运行
$ sudo opensnoop -n Xcode | grep mpicc.xcspec
并看到 Xcode 正在加载规范文件,但我没有看到任何 MPICC 选项。我的规范文件相当简单:
/**
Xcode Compiler Specification for MPICC
*/
{ Type = Compiler;
Identifier = com.apple.compilers.mpicc;
BasedOn = com.apple.compilers.gcc.4_2;
Name = “MPICC”;
Version = “Default”;
Description = “MPI GNU C/C++ Compiler 4.0″;
ExecPath = “/usr/local/bin/mpicc”;
PrecompStyle = pch;
}
它存储在
/Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/LLVM GCC 4.2.xcplugin/Contents/Resources/mpicc.xcspec