diff --git a/dependency_support/embedded_python_interpreter/print_libpython_path.py b/dependency_support/embedded_python_interpreter/print_libpython_path.py index 2e584e89c0..b6eec1a12e 100644 --- a/dependency_support/embedded_python_interpreter/print_libpython_path.py +++ b/dependency_support/embedded_python_interpreter/print_libpython_path.py @@ -23,4 +23,13 @@ for pv in ('LIBDIR', 'LIBPL') ] +if 'rules_hdl_cpython' in config_vars['prefix']: + # Hack: Work around broken library paths in the hermetic Python toolchain. + # It reports that the library path is an absolute path like + # + # /install/lib/libpython3.8.so + # + # This path doesn't exist. So we'll fix it here. + file_paths = [path.replace('/install', config_vars['prefix']) for path in file_paths] + print(list(filter(os.path.exists, file_paths))[0])