scons: fix build failed caused by Non-ASCII directory path
This patch addresses the issue of gem5 failing to build when the build directory path contains non-ASCII characters. The previous patches[1] that attempted to fix this issue became ineffective after the upgrade of Python and pybind11 to new versions. This new patch manually sets the locale in marshal.py based on the `LC_CTYPE` environment variable, providing a comprehensive solution that works with Non-ASCII build directory paths. [1] https://gem5-review.googlesource.com/c/public/gem5/+/58369 Change-Id: I3ad28b6ee52fd347d2fe71f279baab629e88d12c Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/70818 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu> Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
This commit is contained in:
@@ -48,6 +48,7 @@ interpretters, and so the exact same interpretter should be used both to run
|
||||
this script, and to read in and execute the marshalled code later.
|
||||
"""
|
||||
|
||||
import locale
|
||||
import marshal
|
||||
import sys
|
||||
import zlib
|
||||
@@ -65,6 +66,11 @@ if len(sys.argv) < 4:
|
||||
print(f"Usage: {sys.argv[0]} CPP PY MODPATH ABSPATH", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
# Set the Python's locale settings manually based on the `LC_CTYPE`
|
||||
# environment variable
|
||||
if "LC_CTYPE" in os.environ:
|
||||
locale.setlocale(locale.LC_CTYPE, os.environ["LC_CTYPE"])
|
||||
|
||||
_, cpp, python, modpath, abspath = sys.argv
|
||||
|
||||
with open(python, "r") as f:
|
||||
|
||||
Reference in New Issue
Block a user