Search code examples
pythonubuntuterminalsconsgem5

Trying to build Gem5 on ubuntu 22: native-elf-format: Permission denied or not found


I am trying Gem5 for the first time and I am using Learning_Gem5 as guide. I have a dual boot system (Windows 11 and Ubuntu 22.04.2) and I am doing this on Ubuntu.

When I reach this step

python3 `which scons` build/X86/gem5.opt -j9

I encounter an error which terminates the building.

scons: Building targets ...
 [VER TAGS]  -> X86/sim/tags.cc
/usr/bin/env: ‘python3\r’: No such file or directory
 [     CXX] X86/sim/root.cc -> .o
 [     CXX] X86/sim/sim_object.cc -> .o
 [     CXX] X86/sim/sub_system.cc -> .o
 [     CXX] X86/sim/ticked_object.cc -> .o
 [     CXX] X86/sim/simulate.cc -> .o
 [     CXX] X86/sim/stat_control.cc -> .o
 [     CXX] X86/sim/stat_register.cc -> .o
scons: *** [build/X86/sim/tags.cc] Error 127
 [ TRACING]  -> X86/debug/ClockDomain.hh
scons: building terminated because of errors.

I searched and I found some stuff about making a link to a python directory and changing from CRLF and LF but I couldn't figure out what is going on and what should I do.

Any help is appreciated!

Update: Barmar's right. I used

dos2unix cpt_upgrader.py

and it was fixed. But I encountered another problem :(

scons: Building targets ...
 [VER TAGS]  -> X86/sim/tags.cc
build/X86/ext/libelf/native-elf-format > build/X86/ext/libelf/native-elf-format.h
/tmp/tmpiwxnwoqi: 1: build/X86/ext/libelf/native-elf-format: Permission denied
 [    SHCC] X86/ext/softfloat/f64_to_i64_r_minMag.c -> .os
 [    SHCC] X86/ext/softfloat/f64_to_ui32.c -> .os
 [    SHCC] X86/ext/softfloat/f64_to_ui32_r_minMag.c -> .os
 [    SHCC] X86/ext/softfloat/f64_to_ui64.c -> .os
 [    SHCC] X86/ext/softfloat/f64_to_ui64_r_minMag.c -> .os
 [    SHCC] X86/ext/softfloat/i32_to_f128.c -> .os
 [    SHCC] X86/ext/softfloat/i32_to_f16.c -> .os
scons: *** [build/X86/ext/libelf/native-elf-format.h] Error 126
scons: building terminated because of errors.

It says that "native-elf-format.h" does not have execute permission. When I give the permission, it says:

scons: Building targets ...
 [VER TAGS]  -> X86/sim/tags.cc
build/X86/ext/libelf/native-elf-format > build/X86/ext/libelf/native-elf-format.h
/tmp/tmpu4ahur8f: 1: build/X86/ext/libelf/native-elf-format: not found
 [    SHCC] X86/ext/softfloat/f64_classify.c -> .os
 [    SHCC] X86/ext/softfloat/f64_div.c -> .os
 [    SHCC] X86/ext/softfloat/f64_eq.c -> .os
 [    SHCC] X86/ext/softfloat/f64_eq_signaling.c -> .os
 [    SHCC] X86/ext/softfloat/f64_isSignalingNaN.c -> .os
 [    SHCC] X86/ext/softfloat/f64_le.c -> .os
 [    SHCC] X86/ext/softfloat/f64_le_quiet.c -> .os
scons: *** [build/X86/ext/libelf/native-elf-format.h] Error 127
scons: building terminated because of errors.

Any ideas?


Solution

  • I found the solution! I used this link and ran dos2unix over all of the files in the repository.