Error when building pytorch 1.1.0 from source

When building pytorch 1.1.0 from source with explicitly setting -D_GLIBCXX_USE_CXX11_ABI=0 , I met such error:

pytorch/build/lib/libcaffe2_gpu.so: undefined reference to `gloo::getCudaPCIBusID(int)'
pytorch/build/lib/libcaffe2_gpu.so: undefined reference to `gloo::EnforceNotMet::EnforceNotMet(char const*, int, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'

the building steps is:

git clone https://github.com/pytorch/pytorch.git && git checkout v1.1.0
...  # using `git reset --hard` do some change to reset the third_party submodules to the correct commit with tags/v1.1.0
export USE_NINJA=OFF
export CFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0 $CFLAGS"
export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
python setup.py install

how to solve that?
Details is here: https://github.com/pytorch/pytorch/issues/31943