1

I am currently using the linux-x86.img which I downloaded from the documentation page for gem5 (http://www.m5sim.org/Download), but since I was not able to compile the fscanf and fopen commands on this image I was wondering if there is a more recent image which I could download and use instead.

The error message throw when trying to compile the lines with fopen and fscanf are

./obj/edgelist.o: In function loadEdgeArray': edgelist.c:(.text+0x148): undefined reference to __isoc99_fscanf' ./obj/edgelist.o: In function loadEdgeArrayInfo': edgelist.c:(.text+0x20c): undefined reference to __isoc99_fscanf' collect2: ld returned 1 exit status make: *** [test] Error 1

This error is thrown when trying to compile from both from qemu as well as gem5.

HoldOffHunger
  • 18,769
  • 10
  • 104
  • 133
bibin
  • 23
  • 6

2 Answers2

0

Here's one setup that generates such an image with Buildroot. I'm a fan of Buildroot because it builds everything from source. I don't understand how fscanf and fopen could fail in that image, but I have tested them in the above setup and they work fine.

Boot used to work in the past, but gem5 X86 full system boot has been broken for likely easy to fix reasons for a few months now as of March 2020 on the gem5 side, although there are efforts in place to fix it, and so likely it will work again soon: https://www.gem5.org/project/2020/03/09/boot-tests.html

Other alternatives include:

It is also worth noting that when the gem5.org website migrated from the old Wiki to the new static website setup in Q1 2020, we lost the ability of doing directory listing under http://dist.gem5.org/dist/current/arm/ for some reason, and so devs were forced to list them one by one on the static website... https://www.gem5.org/documentation/general_docs/fullsystem/guest_binaries

Ciro Santilli
  • 3,693
  • 1
  • 18
  • 44
  • I have added the error message I encounter with fscanf and fopen in the original post. Please let me know if there is a more appropriate forum to post these questions – bibin Apr 01 '20 at 05:25
  • Could you also please link to any of the docker disk images that I can use? – bibin Apr 01 '20 at 05:26
  • @bibin can you compile the program in an Ubuntu host to start with? Have you looked at posts found with Googling the error message e.g. https://stackoverflow.com/questions/39260058/undefined-reference-to-isoc99-sscanf ? The Ubuntu 18.04 Docker images are the best bet most likely. – Ciro Santilli Apr 01 '20 at 07:42
  • The buildroot has been failing for me at the ./run --emulator gem5 stage saying "No such file or directory: '/home/bibin/projects/linux-kernel-module-cheat/out/gem5/default/build/X86/gem5.opt': " Is there any command other than build which needs to be run before running ./run --emulator gem5? – bibin Apr 05 '20 at 17:49
  • Yes, I am able to compile the program on the host with the scanf statements and I am also able to compile the program on gem5/qemu once these 2 statements are commented out. I had also checked my makefile for any weird compilation directives as mentioned in [https://stackoverflow.com/questions/39260058/undefined-reference-to-isoc99-sscanf] which are not present – bibin Apr 05 '20 at 17:54
  • @bibin OK, I'm not sure then." Is there any command other than build which needs to be run before running ./run --emulator gem5": `./build --download-dependencies gem5-buildroot` as mentioned in https://github.com/cirosantilli/linux-kernel-module-cheat/tree/66473201ebb24608a0aaf3e2184579b152ca5023#gem5-buildroot-setup-getting-started If something in that repo does not work, let's move discussion to an issue in that repo. – Ciro Santilli Apr 05 '20 at 18:30
0

I am not sure why the error is no longer occurring for me, but documenting the steps I went through which might have fixed something. I reinstalled Ubuntu18.04 therefore had to rebuild gem5 and I used the parsec image (http://www.cs.utexas.edu/~parsec_m5/x86root-parsec.img.bz2) referenced in this answer Booting gem5 X86 Ubuntu Full System Simulation

bibin
  • 23
  • 6