我正在建立一个与物理探测器模拟相关的大项目。
我必须在macOS Sierra 10.12.5上使用CMAKE编译项目,我的处理器架构是64位。
我使用“自制软件”构建了所有需求程序。
我尝试在不同的CMAKE架构模式下编译:
cmake ../mu3e
cmake -DCMAKE_OSX_ARCHITECTURES=x86_64 ../mu3e
cmake -DCMAKE_OSX_ARCHITECTURES=i386 ../mu3e
cmake -DCMAKE_OSX_ARCHITECTURES="ppc;i386" ../mu3e
cmake -DCMAKE_OSX_ARCHITECTURES="x86_64;i386" ../mu3e
../ mu3e是源的目录。
我总是遇到与 “未定义的架构x86_64符号相同或类似的错误:” 和 “ld:symbol(s )找不到架构x86_64“ :
[ 66%] Built target mu3eAnaFibreTrackStat
[ 66%] Building CXX object mu3eAna/Fibres/CMakeFiles/mu3eAnaFibreAna.dir/fibreana.cpp.o
[ 67%] Linking CXX shared library libmu3eAnaFibreAna.dylib
Undefined symbols for architecture x86_64:
"HitStatistics::processFrame(std::__1::map<unsigned int, std::__1::vector<fibreAnaTypes::hit_t, std::__1::allocator<fibreAnaTypes::hit_t> >, std::__1::less<unsigned int>, std::__1::allocator<std::__1::pair<unsigned int const, std::__1::vector<fibreAnaTypes::hit_t, std::__1::allocator<fibreAnaTypes::hit_t> > > > >*)", referenced from:
fibreAna::processFrame() in fibreana.cpp.o
"HitStatistics::HitStatistics(unsigned int)", referenced from:
fibreAna::setHitStat(bool) in fibreana.cpp.o
"TVersionCheck::TVersionCheck(int)", referenced from:
__GLOBAL__sub_I_fibreana.cpp in fibreana.cpp.o
"MPPCStatistics::processFrame(std::__1::map<unsigned int, std::__1::vector<fibreAnaTypes::sensor_t, std::__1::allocator<fibreAnaTypes::sensor_t> >, std::__1::less<unsigned int>, std::__1::allocator<std::__1::pair<unsigned int const, std::__1::vector<fibreAnaTypes::sensor_t, std::__1::allocator<fibreAnaTypes::sensor_t> > > > >*)", referenced from:
fibreAna::processFrame() in fibreana.cpp.o
"MPPCStatistics::MPPCStatistics(unsigned int, unsigned int)", referenced from:
fibreAna::setMPPCStat(bool) in fibreana.cpp.o
"FibreStatistics::processFrame(std::__1::map<unsigned int, std::__1::vector<fibreAnaTypes::fibre_t, std::__1::allocator<fibreAnaTypes::fibre_t> >, std::__1::less<unsigned int>, std::__1::allocator<std::__1::pair<unsigned int const, std::__1::vector<fibreAnaTypes::fibre_t, std::__1::allocator<fibreAnaTypes::fibre_t> > > > >*)", referenced from:
fibreAna::processFrame() in fibreana.cpp.o
"FibreStatistics::FibreStatistics(unsigned int, unsigned int, unsigned int)", referenced from:
fibreAna::setFibreStat(bool) in fibreana.cpp.o
"TrackStatistics::processFrame(std::__1::vector<fibreAnaTypes::track_t, std::__1::allocator<fibreAnaTypes::track_t> >*, std::__1::map<unsigned int, std::__1::vector<fibreAnaTypes::hit_t, std::__1::allocator<fibreAnaTypes::hit_t> >, std::__1::less<unsigned int>, std::__1::allocator<std::__1::pair<unsigned int const, std::__1::vector<fibreAnaTypes::hit_t, std::__1::allocator<fibreAnaTypes::hit_t> > > > >*)", referenced from:
fibreAna::processFrame() in fibreana.cpp.o
"TrackStatistics::TrackStatistics()", referenced from:
fibreAna::setTrackStat(bool) in fibreana.cpp.o
"FibreEndStatistics::processFrame(std::__1::map<unsigned int, std::__1::vector<fibreAnaTypes::fibreend_t, std::__1::allocator<fibreAnaTypes::fibreend_t> >, std::__1::less<unsigned int>, std::__1::allocator<std::__1::pair<unsigned int const, std::__1::vector<fibreAnaTypes::fibreend_t, std::__1::allocator<fibreAnaTypes::fibreend_t> > > > >*)", referenced from:
fibreAna::processFrame() in fibreana.cpp.o
"FibreEndStatistics::FibreEndStatistics(unsigned int, unsigned int, unsigned int)", referenced from:
fibreAna::setFibreEndStat(bool) in fibreana.cpp.o
"TChain::TChain(char const*, char const*)", referenced from:
fibreAna::fibreAna(char const*) in fibreana.cpp.o
"TClass::GetClass(std::type_info const&, bool, bool)", referenced from:
fibreAna::init() in fibreana.cpp.o
"TObject::operator delete(void*)", referenced from:
fibreAna::fibreAna(char const*) in fibreana.cpp.o
"TStorage::ObjectAlloc(unsigned long)", referenced from:
fibreAna::fibreAna(char const*) in fibreana.cpp.o
"TDataType::GetType(std::type_info const&)", referenced from:
fibreAna::init() in fibreana.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [mu3eAna/Fibres/libmu3eAnaFibreAna.dylib] Error 1
make[1]: *** [mu3eAna/Fibres/CMakeFiles/mu3eAnaFibreAna.dir/all] Error 2
make: *** [all] Error 2
在Ubuntu 16.04 LTS中进行编译时,一切正常,这可能会给你一个提示,说明为什么这不起作用。
感谢您提出任何建议,如果您需要更多信息,请与我们联系。