Belal JahanNia
Belal JahanNia

Reputation: 21

Failed to compile with Gem5

I'm trying to compile gem5 on mac os. I have solved 3 problem that faced until now, but i'm stopped at the last error.

The error says :

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

clang version: Apple LLVM version 10.0.0 (clang-1000.11.45.5)

Target: x86_64-apple-darwin17.7.0

Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Any solution?

Upvotes: 1

Views: 515

Answers (1)

Belal JahanNia
Belal JahanNia

Reputation: 21

I found the solution.

The changes in below link cause this error :

https://gem5-review.googlesource.com/c/public/gem5/+/11518/

You can revert changes in SConscript file at “gem5/src/cpu/testesr/traffic-gen/SConscript” and try co compile .

I could compile fine and run a spare benchmark with revert the changes in SConscript file like below :

    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')

Hope works fine for everyone who face same error.

Cheers , Belal.

Upvotes: 0

Related Questions