diff --git a/third_party/gpus/cuda_configure.bzl b/third_party/gpus/cuda_configure.bzl index c7bc350959a..5c545447c6d 100644 --- a/third_party/gpus/cuda_configure.bzl +++ b/third_party/gpus/cuda_configure.bzl @@ -50,6 +50,7 @@ load( "raw_exec", "read_dir", "which", + "realpath", ) _GCC_HOST_COMPILER_PATH = "GCC_HOST_COMPILER_PATH" @@ -360,8 +361,8 @@ def _cuda_include_path(repository_ctx, cuda_config): ) inc_entries = [] if target_dir != "": - inc_entries.append(str(repository_ctx.path(target_dir).realpath)) - inc_entries.append(str(repository_ctx.path(cuda_config.cuda_toolkit_path + "/include").realpath)) + inc_entries.append(realpath(repository_ctx, target_dir)) + inc_entries.append(realpath(repository_ctx, cuda_config.cuda_toolkit_path + "/include")) return inc_entries def enable_cuda(repository_ctx): diff --git a/third_party/gpus/find_cuda_config.py b/third_party/gpus/find_cuda_config.py index 57067b35629..e2ab42abf67 100644 --- a/third_party/gpus/find_cuda_config.py +++ b/third_party/gpus/find_cuda_config.py @@ -437,7 +437,7 @@ def _get_legacy_path(env_name, default=[]): def _normalize_path(path): """Returns normalized path, with forward slashes on Windows.""" - path = os.path.normpath(path) + path = os.path.realpath(path) if _is_windows(): path = path.replace("\\", "/") return path @@ -449,7 +449,7 @@ def find_cuda_config(): cuda_version = os.environ.get("TF_CUDA_VERSION", "") base_paths = _list_from_env("TF_CUDA_PATHS", _get_default_cuda_paths(cuda_version)) - base_paths = [os.path.realpath(path) for path in base_paths if os.path.exists(path)] + base_paths = [path for path in base_paths if os.path.exists(path)] result = {} if "cuda" in libraries: