1

I moved my Gem5 simulations from my system to a server. My system does not have HDF5 libraries, but the server has, and I am met with this error:

/usr/local/lib/python2.7/config/libpython2.7.a(posixmodule.o): In function `posix_tmpnam':
/space/src/Python-2.7/./Modules/posixmodule.c:7275: warning: the use of `tmpnam_r' is dangerous, better use `mkstemp'
/usr/local/lib/python2.7/config/libpython2.7.a(posixmodule.o): In function `posix_tempnam':
/space/src/Python-2.7/./Modules/posixmodule.c:7230: warning: the use of `tempnam' is dangerous, better use `mkstemp'
build/X86/base/lib.o.partial: In function `Stats::Hdf5::addMetaData(H5::DataSet&, char const*, double)':
/net/nasstore/students/GRAD/ECE/febinps/home/Paper3/gem5/build/X86/base/stats/hdf5.cc:312: undefined reference to `H5::H5Object::createAttribute(char const*, H5::DataType const&, H5::DataSpace const&, H5::PropList const&) const'
build/X86/base/lib.o.partial: In function `Stats::Hdf5::addMetaData(H5::DataSet&, char const*, std::vector<char const*, std::allocator<char const*> > const&)':
/net/nasstore/students/GRAD/ECE/febinps/home/Paper3/gem5/build/X86/base/stats/hdf5.cc:280: undefined reference to `H5::H5Object::createAttribute(char const*, H5::DataType const&, H5::DataSpace const&, H5::PropList const&) const'
build/X86/base/lib.o.partial: In function `Stats::Hdf5::addMetaData(H5::DataSet&, char const*, std::string const&)':
/net/nasstore/students/GRAD/ECE/febinps/home/Paper3/gem5/build/X86/base/stats/hdf5.cc:302: undefined reference to `H5::H5Object::createAttribute(char const*, H5::DataType const&, H5::DataSpace const&, H5::PropList const&) const'
collect2: error: ld returned 1 exit status
scons: *** [build/X86/gem5.opt] Error 1
scons: building terminated because of errors.

How can I fix this? Is there an yway I can avoid the build from using HDF5? I cannot do much at the server as I do not have admin access.

Febin Sunny
  • 311
  • 1
  • 13

3 Answers3

1

After the resolution of: https://askubuntu.com/questions/1187343/installation-of-gem5-on-ubuntu-19-10-on-my-laptop-i5-cpu-m520-64bit in gem5 b383997d4a9c642dd4356bfc4554ac7ae183ae62 (March 2020) the Ubuntu 19.10 (GCC 9) build is working for me:

scons -j `nproc` build/ARM/gem5.opt

If you find any further build bugs, do open an issue on the Jira issue tracker.

After https://gem5-review.googlesource.com/c/public/gem5/+/34777 gem5 should be building every time with HDF5 on the upstream testing system see also https://askubuntu.com/questions/350475/how-can-i-install-gem5/1275773#1275773 so I don't think it will break again easily.

Ciro Santilli
  • 3,693
  • 1
  • 18
  • 44
0

I don't know the root cause of this issue, some one who is working on Gem5 could possibly answer that.

But as a workaround, since I have no admin access to the server ,and even then removing a library just for the sake of one build doesn't feel right, I edited the SConstruct file in gem5/, where the environment variables are gathered and passed:

have_hdf5 = 0 #check_hdf5() #line number 951 in the SConstruct file

This seems to work for the build.

Febin Sunny
  • 311
  • 1
  • 13
0

In case you run on older system like Debian 10 or Ubuntu 16.04, the errors are due to the fact that the hdf5 library path is not in default system library path. I solved it by manually (brutally) linking gem5 ...

The link flags added are: -L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -lhdf5_cpp -lhdf5

g++ -o /gem5/default/build/X86/gem5.opt \
    -Wl,--as-needed -fuse-ld=gold -L/usr/lib/python2.7/config-x86_64-linux-gnu -L/usr/lib \
    -Xlinker -export-dynamic \
    -Wl,-O1 -Wl,-Bsymbolic-functions -z origin -O3 \
    /gem5/default/build/X86/sim/main.o \
    /gem5/default/build/X86/dev/net/lib.o.partial \
    /gem5/default/build/X86/base/lib.o.partial \
    /gem5/default/build/X86/dev/i2c/lib.o.partial \
    /gem5/default/build/X86/cpu/testers/traffic_gen/lib.o.partial \
    /gem5/default/build/X86/mem/cache/tags/indexing_policies/lib.o.partial \
    /gem5/default/build/X86/mem/ruby/slicc_interface/lib.o.partial \
    /gem5/default/build/X86/mem/probes/lib.o.partial \
    /gem5/default/build/X86/mem/ruby/network/simple/lib.o.partial \
    /gem5/default/build/X86/dev/x86/lib.o.partial \
    /gem5/default/build/X86/mem/ruby/network/fault_model/lib.o.partial \
    /gem5/default/build/X86/systemc/utils/lib.o.partial \
    /gem5/default/build/X86/systemc/dt/int/lib.o.partial \
    /gem5/default/build/X86/cpu/kvm/lib.o.partial \
    /gem5/default/build/X86/cpu/simple/probes/lib.o.partial \
    /gem5/default/build/X86/base/filters/lib.o.partial \
    /gem5/default/build/X86/dev/serial/lib.o.partial \
    /gem5/default/build/X86/sim/power/lib.o.partial \
    /gem5/default/build/X86/mem/cache/tags/lib.o.partial \
    /gem5/default/build/X86/arch/x86/bios/lib.o.partial \
    /gem5/default/build/X86/systemc/dt/fx/lib.o.partial \
    /gem5/default/build/X86/mem/ruby/common/lib.o.partial \
    /gem5/default/build/X86/mem/ruby/network/garnet2.0/lib.o.partial \
    /gem5/default/build/X86/mem/ruby/structures/lib.o.partial \
    /gem5/default/build/X86/cpu/testers/garnet_synthetic_traffic/lib.o.partial \
    /gem5/default/build/X86/mem/cache/prefetch/lib.o.partial \
    /gem5/default/build/X86/cpu/trace/lib.o.partial \
    /gem5/default/build/X86/sim/probe/lib.o.partial \
    /gem5/default/build/X86/sim/lib.o.partial \
    /gem5/default/build/X86/mem/ruby/protocol/lib.o.partial \
    /gem5/default/build/X86/systemc/tlm_core/2/quantum/lib.o.partial \
    /gem5/default/build/X86/cpu/simple/lib.o.partial \
    /gem5/default/build/X86/base/vnc/lib.o.partial \
    /gem5/default/build/X86/mem/ruby/system/lib.o.partial \
    /gem5/default/build/X86/mem/cache/lib.o.partial \
    /gem5/default/build/X86/arch/x86/lib.o.partial \
    /gem5/default/build/X86/dev/storage/lib.o.partial \
    /gem5/default/build/X86/mem/protocol/lib.o.partial \
    /gem5/default/build/X86/systemc/core/lib.o.partial \
    /gem5/default/build/X86/systemc/tlm_core/2/generic_payload/lib.o.partial \
    /gem5/default/build/X86/cpu/testers/directedtest/lib.o.partial \
    /gem5/default/build/X86/mem/ruby/profiler/lib.o.partial \
    /gem5/default/build/X86/arch/x86/regs/lib.o.partial \
    /gem5/default/build/X86/dev/pci/lib.o.partial \
    /gem5/default/build/X86/cpu/o3/probe/lib.o.partial \
    /gem5/default/build/X86/mem/cache/compressors/lib.o.partial \
    /gem5/default/build/X86/cpu/lib.o.partial \
    /gem5/default/build/X86/learning_gem5/part2/lib.o.partial \
    /gem5/default/build/X86/mem/cache/replacement_policies/lib.o.partial \
    /gem5/default/build/X86/dev/virtio/lib.o.partial \
    /gem5/default/build/X86/proto/lib.o.partial \
    /gem5/default/build/X86/cpu/testers/rubytest/lib.o.partial \
    /gem5/default/build/X86/mem/qos/lib.o.partial \
    /gem5/default/build/X86/cpu/pred/lib.o.partial \
    /gem5/default/build/X86/python/lib.o.partial \
    /gem5/default/build/X86/arch/generic/lib.o.partial \
    /gem5/default/build/X86/systemc/tlm_bridge/lib.o.partial \
    /gem5/default/build/X86/dev/lib.o.partial \
    /gem5/default/build/X86/kern/lib.o.partial \
    /gem5/default/build/X86/mem/lib.o.partial \
    /gem5/default/build/X86/cpu/testers/memtest/lib.o.partial \
    /gem5/default/build/X86/systemc/dt/misc/lib.o.partial \
    /gem5/default/build/X86/systemc/tlm_utils/lib.o.partial \
    /gem5/default/build/X86/cpu/o3/lib.o.partial \
    /gem5/default/build/X86/mem/ruby/network/lib.o.partial \
    /gem5/default/build/X86/systemc/dt/bit/lib.o.partial \
    /gem5/default/build/X86/dev/ps2/lib.o.partial \
    /gem5/default/build/X86/unittest/lib.o.partial \
    /gem5/default/build/X86/systemc/channel/lib.o.partial \
    /gem5/default/build/X86/systemc/dt/lib.o.partial \
    /gem5/default/build/X86/base/date.o \
    -L/gem5/default/build/libelf -L/gem5/default/build/fputils -L/gem5/default/build/libfdt -L/gem5/default/build/drampower -L/gem5/default/build/iostream3 -L/gem5/default/build/nomali -L/gem5/default/build/googletest -L/usr/lib/x86_64-linux-gnu/hdf5/serial/ \
    -lpython2.7 -lpthread -ldl -lutil -lm -lz -lprotobuf -lrt -ltcmalloc -lnomali -liostream3 \
    -ldrampower -lfdt -lfputils -lelf -lhdf5_cpp -lhdf5
Yun-Chih Chen
  • 543
  • 6
  • 18