Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 0bc5d77e authored by Jason Lowe-Power's avatar Jason Lowe-Power Committed by Giacomo Travaglini
Browse files

scons: Update python-config flags for python3.8

Starting in python 3.8 the python3-config utility requires the --embed
flag to output -lpython3.8. Without this flag, gem5 won't link to the
python library.

More details: https://bugs.python.org/issue36721
https://github.com/python/cpython/pull/13500



Change-Id: Id9c63577dcd2defa7ae62cc32e042c4a245e7082
Signed-off-by: default avatarJason Lowe-Power <jason@lowepower.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/28687


Reviewed-by: default avatarJason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: default avatarkokoro <noreply+kokoro@google.com>
parent 2d6cd436
Branches
Tags
No related merge requests found
...@@ -97,7 +97,7 @@ import SCons ...@@ -97,7 +97,7 @@ import SCons
import SCons.Node import SCons.Node
import SCons.Node.FS import SCons.Node.FS
from m5.util import compareVersions, readCommand from m5.util import compareVersions, readCommand, readCommandWithReturn
help_texts = { help_texts = {
"options" : "", "options" : "",
...@@ -683,8 +683,21 @@ if main['USE_PYTHON']: ...@@ -683,8 +683,21 @@ if main['USE_PYTHON']:
# Read the linker flags and split them into libraries and other link # Read the linker flags and split them into libraries and other link
# flags. The libraries are added later through the call the CheckLib. # flags. The libraries are added later through the call the CheckLib.
py_ld_flags = readCommand([python_config, '--ldflags'], # Note: starting in Python 3.8 the --embed flag is required to get the
exception='').split() # -lpython3.8 linker flag
retcode, cmd_stdout = readCommandWithReturn(
[python_config, '--ldflags', '--embed'], exception='')
if retcode != 0:
# If --embed isn't detected then we're running python <3.8
retcode, cmd_stdout = readCommandWithReturn(
[python_config, '--ldflags'], exception='')
# Checking retcode again
if retcode != 0:
error("Failing on python-config --ldflags command")
py_ld_flags = cmd_stdout.split()
py_libs = [] py_libs = []
for lib in py_ld_flags: for lib in py_ld_flags:
if not lib.startswith('-l'): if not lib.startswith('-l'):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment