我正在尝试从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(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正在加载spec文件,但我没有看到任何MPICC选项。我的spec文件非常简单:
/**
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
答案 0 :(得分:0)
这样可行:
将二进制文件链接到:
libmpi_cxx.dylib
libmpi.dylib
libboost_mpi.dylib
libboost_serialization.dylib
将编译器(在构建选项下)更改为LLVM GCC 4.2(通过直接运行mpic ++暗示,它报告它在内部使用llvm gcc 4.2)
在目标,构建阶段,编译源,添加编译器选项&#34; -lm&#34;报告您需要与libm链接。感谢@pyCthon指出mpic ++ --showme:链接,它揭示了允许它从命令行成功构建的最终库