尝试按照提供的说明安装 GEM5 模拟器http://learning.gem5.org/book/part1/building.html并执行以下操作
sudo apt install build-essential git m4 scons zlib1g zlib1g-dev libprotobuf-dev protobuf-compiler libprotoc-dev libgoogle-perftools-dev python-dev python
git clone https://gem5.googlesource.com/public/gem5
sudo apt-get install python-six
sudo scons build/X86/gem5.opt -j2
The output after the above command is as follows:
-------------------------------------------------------------------------
scons: Reading SConscript files ...
Warning: Your compiler doesn't support incremental linking and lto at the same time, so lto is being disabled. To force lto on anyway, use the --force-lto option. That will disable partial linking.
Info: Using Python config: /usr/bin/python2.7-config
Checking for C header file Python.h... (cached) yes
Checking for C library python2.7... (cached) yes
Checking for C library pthread... (cached) yes
Checking for C library dl... (cached) yes
Checking for C library util... (cached) yes
Checking for C library m... (cached) yes
Checking for accept(0,0,0) in C++ library None... (cached) yes
Checking for zlibVersion() in C++ library z... (cached) yes
Checking for GOOGLE_PROTOBUF_VERIFY_VERSION in C++ library protobuf... (cached) yes
Checking for C header file valgrind/valgrind.h... (cached) no
Checking for clock_nanosleep(0,0,NULL,NULL) in C library None... (cached) yes
Checking for timer_create(CLOCK_MONOTONIC, NULL, NULL) in C library None... (cached) no
Checking for timer_create(CLOCK_MONOTONIC, NULL, NULL) in C library rt... (cached) yes
Checking for C library tcmalloc... (cached) yes
Checking for char temp; backtrace_symbols_fd((void*)&temp, 0, 0) in C library None... (cached) yes
Checking for C header file fenv.h... (cached) yes
Checking for C header file png.h... (cached) no
Warning: Header file <png.h> not found.
This host has no libpng library.
Disabling support for PNG framebuffers.
Checking for C header file linux/kvm.h... (cached) yes
Checking for C header file linux/if_tun.h... (cached) yes
Checking size of struct kvm_xsave ... (cached) yes
Checking for member exclude_host in struct perf_event_attr...(cached) yes
Package hdf5-serial was not found in the pkg-config search path.
Perhaps you should add the directory containing `hdf5-serial.pc'
to the PKG_CONFIG_PATH environment variable
No package 'hdf5-serial' found
Checking for hdf5-serial using pkg-config... no
Package hdf5 was not found in the pkg-config search path.
Perhaps you should add the directory containing `hdf5.pc'
to the PKG_CONFIG_PATH environment variable
No package 'hdf5' found
Checking for hdf5 using pkg-config... no
Checking for H5Fcreate("", 0, 0, 0) in C library hdf5... (cached) no
Warning: Couldn't find any HDF5 C++ libraries. Disabling
HDF5 support.
Checking whether __i386__ is declared... (cached) no
Checking whether __x86_64__ is declared... (cached) yes
Building in /home/murali/GEM5/gem5/build/X86
Using saved variables file /home/murali/GEM5/gem5/build/variables/X86
scons: done reading SConscript files.
scons: Building targets ...
[ CXX] X86/dev/x86/pc.cc -> .o
[ TRACING] -> X86/debug/I8254.hh
[ CXX] X86/dev/x86/i8254.cc -> .o
In file included from build/X86/dev/x86/pc.cc:41:
build/X86/arch/x86/intmessage.hh: In function 'Packet* X86ISA::buildIntTriggerPacket(int, X86ISA::TriggerIntMessage)':
build/X86/arch/x86/intmessage.hh:84:44: error: implicitly-declared 'constexpr BitfieldBackend::BitUnionOperators<X86ISA::BitfieldUnderlyingClassesTriggerIntMessage>::BitUnionOperators(const BitfieldBackend::BitUnionOperators<X86ISA::BitfieldUnderlyingClassesTriggerIntMessage>&)' is deprecated [-Werror=deprecated-copy]
84 | return buildIntPacket(addr, message);
| ^
In file included from build/X86/sim/serialize.hh:62,
from build/X86/sim/eventq.hh:53,
from build/X86/sim/sim_object.hh:58,
from build/X86/dev/platform.hh:44,
from build/X86/dev/x86/pc.hh:40,
from build/X86/dev/x86/pc.cc:35:
build/X86/base/bitunion.hh:262:9: note: because 'BitfieldBackend::BitUnionOperators<X86ISA::BitfieldUnderlyingClassesTriggerIntMessage>' has user-provided 'typename Base::__StorageType BitfieldBackend::BitUnionOperators<Base>::operator=(const BitfieldBackend::BitUnionOperators<Base>&) [with Base = X86ISA::BitfieldUnderlyingClassesTriggerIntMessage; typename Base::__StorageType = unsigned int]'
262 | operator=(BitUnionOperators const &other)
| ^~~~~~~~
In file included from build/X86/arch/x86/intmessage.hh:37,
from build/X86/dev/x86/pc.cc:41:
build/X86/dev/x86/intdev.hh:87:29: note: initializing argument 2 of 'Packet* X86ISA::buildIntPacket(Addr, T) [with T = BitfieldBackend::BitUnionOperators<X86ISA::BitfieldUnderlyingClassesTriggerIntMessage>; PacketPtr = Packet*; Addr = long unsigned int]'
87 | buildIntPacket(Addr addr, T payload)
| ~~^~~~~~~
build/X86/dev/x86/intdev.hh: In instantiation of 'Packet* X86ISA::buildIntPacket(Addr, T) [with T = BitfieldBackend::BitUnionOperators<X86ISA::BitfieldUnderlyingClassesTriggerIntMessage>; PacketPtr = Packet*; Addr = long unsigned int]':
build/X86/arch/x86/intmessage.hh:84:44: required from here
build/X86/dev/x86/intdev.hh:93:5: error: implicitly-declared 'constexpr BitfieldBackend::BitUnionOperators<X86ISA::BitfieldUnderlyingClassesTriggerIntMessage>::BitUnionOperators(const BitfieldBackend::BitUnionOperators<X86ISA::BitfieldUnderlyingClassesTriggerIntMessage>&)' is deprecated [-Werror=deprecated-copy]
93 | pkt->setRaw<T>(payload);
| ^~~
In file included from build/X86/sim/serialize.hh:62,
from build/X86/sim/eventq.hh:53,
from build/X86/sim/sim_object.hh:58,
from build/X86/dev/platform.hh:44,
from build/X86/dev/x86/pc.hh:40,
from build/X86/dev/x86/pc.cc:35:
build/X86/base/bitunion.hh:262:9: note: because 'BitfieldBackend::BitUnionOperators<X86ISA::BitfieldUnderlyingClassesTriggerIntMessage>' has user-provided 'typename Base::__StorageType BitfieldBackend::BitUnionOperators<Base>::operator=(const BitfieldBackend::BitUnionOperators<Base>&) [with Base = X86ISA::BitfieldUnderlyingClassesTriggerIntMessage; typename Base::__StorageType = unsigned int]'
262 | operator=(BitUnionOperators const &other)
| ^~~~~~~~
In file included from build/X86/arch/x86/intmessage.hh:39,
from build/X86/dev/x86/pc.cc:41:
build/X86/mem/packet_access.hh:62:18: note: initializing argument 1 of 'void Packet::setRaw(T) [with T = BitfieldBackend::BitUnionOperators<X86ISA::BitfieldUnderlyingClassesTriggerIntMessage>]'
62 | Packet::setRaw(T v)
| ~~^
[ CXX] X86/dev/x86/i8237.cc -> .o
cc1plus: all warnings being treated as errors
scons: *** [build/X86/dev/x86/pc.o] Error 1
scons: building terminated because of errors.
-----------------------------------------------------------------------------
有人能帮我消除上述错误并成功构建 GEM5 模拟器吗?提前致谢
答案1
我曾经/现在也遇到过同样的问题。我认为这是因为 gcc 9 针对之前不会发出警告的内容发出了一些警告。
作为一种快速解决方法,请在 gem5 目录中找到 SConstruct 文件,向下滚动到设置 gcc 标志的位置,然后将弹出的警告添加到无错误列表中(或完全删除错误标志):
main.Append(CCFLAGS=['-Werror', #remove this or
'-Wno-error=deprecated-declarations',
'-Wno-error=deprecated-copy', # add this
'-Wno-error=pessimizing-move', # this
'-Wno-error=address-of-packed-member', # this and possible others
'-Wno-error=deprecated',
])
到目前为止这对我来说似乎有用,但我还没有完成编译......
答案2
决议通过后:在我的笔记本电脑(i5 CPU M520 -64 位)上的 Ubuntu 19.10 上安装 GEM5在 gem5 b383997d4a9c642dd4356bfc4554ac7ae183ae62(2020 年 3 月)中,Ubuntu 19.10(GCC 9)构建对我有用:
scons -j `nproc` build/ARM/gem5.opt
如果您发现任何其他构建错误,请在 Jira 问题跟踪器上打开问题。