我正在尝试在Mac OS上编译gem5。 我已经解决了到现在为止面临的3个问题,但是我停在了最后一个错误上。
错误提示:
Undefined symbols for architecture x86_64:
"PyTrafficGen::start(pybind11::object)", referenced from:
module_init(pybind11::module&) in lib.o.partial
"typeinfo for PyTrafficGen", referenced from:
pybind11::detail::type_caster_base::cast(PyTrafficGen const*, pybind11::return_value_policy, pybind11::handle) in lib.o.partial
pybind11::class_<PyTrafficGen, BaseTrafficGen, std::1::unique_ptr<PyTrafficGen, pybind11::nodelete> >::class<>(pybind11::handle, char const*) in lib.o.partial
pybind11::class<PyTrafficGen, BaseTrafficGen, std::__1::unique_ptr<PyTrafficGen, pybind11::nodelete> >::init_instance(pybind11::detail::instance*, void const*) in lib.o.partial
_ZZN8pybind1112cpp_function10initializeIZNS0_C1INSt3__110shared_ptrI7BaseGenEE12PyTrafficGenJyEJNS_4nameENS_9is_methodENS_7siblingEEEEMT0_FT_DpT1_EDpRKT2_EUlPS7_yE_S6_JSL_yEJS8_S9_SA_EEEvOSC_PFSB_SE_ESK_ENKUlRNS_6detail13function_callEE_clESS in lib.o.partial
_ZZN8pybind1112cpp_function10initializeIZNS0_C1INSt3__110shared_ptrI7BaseGenEE12PyTrafficGenJyyyyyyhyEJNS_4nameENS_9is_methodENS_7siblingEEEEMT0_FT_DpT1_EDpRKT2_EUlPS7_yyyyyyhyE_S6_JSL_yyyyyyhyEJS8_S9_SA_EEEvOSC_PFSB_SE_ESK_ENKUlRNS_6detail13function_callEE_clESS in lib.o.partial
_ZZN8pybind1112cpp_function10initializeIZNS0_C1INSt3__110shared_ptrI7BaseGenEE12PyTrafficGenJyyyyyyhyjjjjjjEJNS_4nameENS_9is_methodENS_7siblingEEEEMT0_FT_DpT1_EDpRKT2_EUlPS7_yyyyyyhyjjjjjjE_S6_JSL_yyyyyyhyjjjjjjEJS8_S9_SA_EEEvOSC_PFSB_SE_ESK_ENKUlRNS_6detail13function_callEE_clESS in lib.o.partial
_ZZN8pybind1112cpp_function10initializeIZNS0_C1INSt3__110shared_ptrI7BaseGenEE12PyTrafficGenJyyyyyyhyjjjjjjjEJNS_4nameENS_9is_methodENS_7siblingEEEEMT0_FT_DpT1_EDpRKT2_EUlPS7_yyyyyyhyjjjjjjjE_S6_JSL_yyyyyyhyjjjjjjjEJS8_S9_SA_EEEvOSC_PFSB_SE_ESK_ENKUlRNS_6detail13function_callEE_clESS in lib.o.partial
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation).
Mac OS High Sierra 10.13.6
c语版本: Apple LLVM版本10.0.0(clang-1000.11.45.5)
目标:x86_64-apple-darwin17.7.0
线程模型:posix InstalledDir:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
有解决方案吗?
答案 0 :(得分:0)
我找到了解决方法。
以下链接中的更改导致此错误:
https://gem5-review.googlesource.com/c/public/gem5/+/11518/
您可以还原“gem5/src/cpu/testesr/traffic-gen/SConscript”
处SConscript文件中的更改,然后尝试进行协同编译。
我可以很好地编译并运行备用基准测试,并还原SConscript文件中的更改,如下所示:
Import('*')
Source('base.cc')
Source('base_gen.cc')
Source('dram_gen.cc')
Source('dram_rot_gen.cc')
Source('exit_gen.cc')
Source('idle_gen.cc')
Source('linear_gen.cc')
Source('random_gen.cc')
Source('stream_gen.cc')
DebugFlag('TrafficGen')
SimObject('BaseTrafficGen.py')
#if env['USE_PYTHON']:
# Source('pygen.cc', add_tags='python')
# SimObject('PyTrafficGen.py')
# Only build the traffic generator if we have support for protobuf as the
# tracing relies on it
if env['HAVE_PROTOBUF']:
SimObject('TrafficGen.py')
Source('trace_gen.cc')
Source('traffic_gen.cc')
希望对于遇到相同错误的每个人都很好。
干杯, 贝拉。