@TimZaman Thanks for your solution shared.
But there’s a step that I don’t understand quite clear. Should we put the genrule_directory in each C++ extension BUILD file?  How does the genrule_directory work?