Error: "caffe2::cuda" is ambiguous

I’m trying to build pytorch with cuda-11.8 on Ubuntu 22.04, but obtained the following ERROR messages:

....../pytorch/caffe2/core/context_gpu.cu(564): error: "caffe2::cuda" is ambiguous

....../pytorch/caffe2/core/context_gpu.cu(564): error: expected a ";"

....../pytorch/caffe2/core/context_gpu.cu(568): warning #12-D: parsing restarts here after previous syntax error

....../pytorch/caffe2/core/context_gpu.cu(569): error: "caffe2::cuda" is ambiguous

....../pytorch/caffe2/core/context_gpu.cu(628): error: "caffe2::cuda" is ambiguous

Versions

➜  ~ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.1 LTS
Release:	22.04
Codename:	jammy
➜  ~ python --version
Python 3.10.6
➜  ~ gcc --version
gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

➜  ~ 

Please refer to error: “caffe2::cuda” is ambiguous