Undefined symbol google::base::CheckOpMessageBuilder::NewString when compiling with torch extensions

Hi,

I integrate glog into my python project which using torch extensions.

but when importing the module it always say that it can’t find glog symbol (_ZN6google4base21CheckOpMessageBuilder9NewStringEv)

when using c++filt, the real name is google::base::CheckOpMessageBuilder::NewString()

import torch
from setuptools import setup
from torch.utils.cpp_extension import BuildExtension, CUDAExtension

setup(
    name='charmander',
    ext_modules=[
        CUDAExtension('charmander', [
            'src/charmander.cpp',
            'src/cuda_image.cu'
            ],
            libraries=['glog']
        ),
    ],
    cmdclass={
        'build_ext': BuildExtension
    })

the interesting thing is that when using prebuilt pytorch, the problem is gone. but when using pytorch installed from pip, we have this problem.

any idea?