linux-kernel-module-cheat icon indicating copy to clipboard operation
linux-kernel-module-cheat copied to clipboard

Building gem5 raise " ValueError : unsupported pickle protocol: 4"

Open Jrebort opened this issue 5 years ago • 1 comments

@cirosantilli I used ./build --download-dependencies gem5-buildroot this command when building gem5, and got an error.

scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: *** [build/x86/call_type/inst.cc] ValueError : unsupported pickle protocol: 4
scons: building terminated because of errors.
Traceback (most recent call last):
  File "./build", line 669, in <module>
    Main().cli()
  File "/home/yangshuang/workspace/linux-kernel-module-cheat/cli_function.py", line 267, in cli
    exit_status = self.cli_noexit(*args, **kwargs)
  File "/home/yangshuang/workspace/linux-kernel-module-cheat/cli_function.py", line 258, in cli_noexit
    return self._do_main(vars(args))
  File "/home/yangshuang/workspace/linux-kernel-module-cheat/cli_function.py", line 152, in _do_main
    return self.main(**self._get_args(kwargs))
  File "/home/yangshuang/workspace/linux-kernel-module-cheat/common.py", line 1518, in main
    ret = self.timed_main()
  File "./build", line 664, in timed_main
    ret = component.build(self.env['arch'])
  File "./build", line 57, in build
    return self.build_callback()
  File "./build", line 455, in f
    return lkmc.import_path.import_path_main(component_file)(**args)
  File "/home/yangshuang/workspace/linux-kernel-module-cheat/common.py", line 733, in __call__
    return super().__call__(**kwargs)
  File "/home/yangshuang/workspace/linux-kernel-module-cheat/cli_function.py", line 149, in __call__
    return self._do_main(kwargs)
  File "/home/yangshuang/workspace/linux-kernel-module-cheat/cli_function.py", line 152, in _do_main
    return self.main(**self._get_args(kwargs))
  File "/home/yangshuang/workspace/linux-kernel-module-cheat/common.py", line 1518, in main
    ret = self.timed_main()
  File "/home/yangshuang/workspace/linux-kernel-module-cheat/common.py", line 2011, in timed_main
    return self.build()
  File "/home/yangshuang/workspace/linux-kernel-module-cheat/build-m5", line 33, in build
    self._get_make_cmd(),
  File "/home/yangshuang/workspace/linux-kernel-module-cheat/shell_helpers.py", line 457, in run_cmd
    raise e
Exception: Command exited with status: 2

I guess this is caused by the python version, my system python version is 2.7. So I switched the system python version to 3.6 and got a new error.

scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Cleaning targets ...
scons: done cleaning targets.
AttributeError: '_Environ' object has no attribute 'has_key':
  File "/usr/lib/scons/SCons/Script/Main.py", line 1376:
    _exec_main(parser, values)
  File "/usr/lib/scons/SCons/Script/Main.py", line 1339:
    _main(parser)
  File "/usr/lib/scons/SCons/Script/Main.py", line 1111:
    if os.environ.has_key('DH_INTERNAL_OPTIONS'):
Traceback (most recent call last):
  File "./build", line 669, in <module>
    Main().cli()
  File "/home/yangshuang/workspace/linux-kernel-module-cheat/cli_function.py", line 267, in cli
    exit_status = self.cli_noexit(*args, **kwargs)
  File "/home/yangshuang/workspace/linux-kernel-module-cheat/cli_function.py", line 258, in cli_noexit
    return self._do_main(vars(args))
  File "/home/yangshuang/workspace/linux-kernel-module-cheat/cli_function.py", line 152, in _do_main
    return self.main(**self._get_args(kwargs))
  File "/home/yangshuang/workspace/linux-kernel-module-cheat/common.py", line 1518, in main
    ret = self.timed_main()
  File "./build", line 664, in timed_main
    ret = component.build(self.env['arch'])
  File "./build", line 57, in build
    return self.build_callback()
  File "./build", line 455, in f
    return lkmc.import_path.import_path_main(component_file)(**args)
  File "/home/yangshuang/workspace/linux-kernel-module-cheat/common.py", line 733, in __call__
    return super().__call__(**kwargs)
  File "/home/yangshuang/workspace/linux-kernel-module-cheat/cli_function.py", line 149, in __call__
    return self._do_main(kwargs)
  File "/home/yangshuang/workspace/linux-kernel-module-cheat/cli_function.py", line 152, in _do_main
    return self.main(**self._get_args(kwargs))
  File "/home/yangshuang/workspace/linux-kernel-module-cheat/common.py", line 1518, in main
    ret = self.timed_main()
  File "/home/yangshuang/workspace/linux-kernel-module-cheat/common.py", line 2011, in timed_main
    return self.build()
  File "/home/yangshuang/workspace/linux-kernel-module-cheat/build-m5", line 31, in build
    self.clean()
  File "/home/yangshuang/workspace/linux-kernel-module-cheat/build-m5", line 43, in clean
    self._get_make_cmd() + ['--clean', LF],
  File "/home/yangshuang/workspace/linux-kernel-module-cheat/shell_helpers.py", line 457, in run_cmd
    raise e
Exception: Command exited with status: 2

Here shows the error of different versions of the protocol. What caused this? I did not get an error when building gem5 separately, but I used the packaging script of this repo and got the above error.

Jrebort avatar Sep 18 '20 00:09 Jrebort

The Python 2 one I'm not sure about.

The Python 3 one, looks like your scons is too old?

I have now tested a full clean build inside docker Ubuntu 20.04 with ./run-docker sh -- ./build --download-dependencies gem5-buildroot -aA as mentioned at https://github.com/cirosantilli/linux-kernel-module-cheat/tree/e62ff90b884bdb319cb5703408105dabf8e829ac#docker in the latest commit e62ff90b884bdb319cb5703408105dabf8e829ac and that has scons v3.1.2 and it worked. That system contains only Python3.

cirosantilli avatar Sep 18 '20 09:09 cirosantilli