diff --git a/examples/pubsub/main.cc b/examples/pubsub/main.cc
index fb252e6c4e61e6a1e4b7df677cb97681ccbb7454..39fb8aea15c8cf5355bf841c5cdba410aede88ff 100644
--- a/examples/pubsub/main.cc
+++ b/examples/pubsub/main.cc
@@ -60,6 +60,13 @@ DEFINE_string(oauth_scope,
               "https://www.googleapis.com/auth/cloud-platform",
               "Scope for OAuth tokens.");
 
+// In some distros, gflags is in the namespace google, and in some others,
+// in gflags. This hack is enabling us to find both.
+namespace google { }
+namespace gflags { }
+using namespace google;
+using namespace gflags;
+
 namespace {
 
 const char kTopic[] = "testtopics";
@@ -81,7 +88,7 @@ grpc::string GetServiceAccountJsonKey() {
 
 int main(int argc, char** argv) {
   grpc_init();
-  google::ParseCommandLineFlags(&argc, &argv, true);
+  ParseCommandLineFlags(&argc, &argv, true);
   gpr_log(GPR_INFO, "Start PUBSUB client");
 
   std::ostringstream ss;
diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc
index 47f2d34a4dd203bcb63dbd8c895d5ad2cc39a1ab..78f2063c45baa647b3cde2fdbd8b5b6af68b19e8 100644
--- a/test/cpp/interop/client.cc
+++ b/test/cpp/interop/client.cc
@@ -92,6 +92,13 @@ using grpc::testing::StreamingOutputCallRequest;
 using grpc::testing::StreamingOutputCallResponse;
 using grpc::testing::TestService;
 
+// In some distros, gflags is in the namespace google, and in some others,
+// in gflags. This hack is enabling us to find both.
+namespace google { }
+namespace gflags { }
+using namespace google;
+using namespace gflags;
+
 namespace {
 // The same value is defined by the Java client.
 const std::vector<int> request_stream_sizes = {27182, 8, 1828, 45904};
@@ -386,7 +393,7 @@ void DoPingPong() {
 int main(int argc, char** argv) {
   grpc_init();
 
-  google::ParseCommandLineFlags(&argc, &argv, true);
+  ParseCommandLineFlags(&argc, &argv, true);
 
   if (FLAGS_test_case == "empty_unary") {
     DoEmpty();
diff --git a/test/cpp/interop/server.cc b/test/cpp/interop/server.cc
index 8566ad5bef4c19e33aaac9f53db8c1a84d2c3c18..4869d4df529891aa48c23115025ae79c1d92e22f 100644
--- a/test/cpp/interop/server.cc
+++ b/test/cpp/interop/server.cc
@@ -73,6 +73,13 @@ using grpc::testing::StreamingOutputCallResponse;
 using grpc::testing::TestService;
 using grpc::Status;
 
+// In some distros, gflags is in the namespace google, and in some others,
+// in gflags. This hack is enabling us to find both.
+namespace google { }
+namespace gflags { }
+using namespace google;
+using namespace gflags;
+
 bool SetPayload(PayloadType type, int size, Payload* payload) {
   PayloadType response_type = type;
   // TODO(yangg): Support UNCOMPRESSABLE payload.
@@ -217,7 +224,7 @@ void RunServer() {
 
 int main(int argc, char** argv) {
   grpc_init();
-  google::ParseCommandLineFlags(&argc, &argv, true);
+  ParseCommandLineFlags(&argc, &argv, true);
 
   GPR_ASSERT(FLAGS_port != 0);
   RunServer();
diff --git a/test/cpp/qps/client.cc b/test/cpp/qps/client.cc
index 8a33ab2ca3f0645f79d3c69f66d206c6bc250936..666f25054ab608ec521f7b6a99c074e7fa757641 100644
--- a/test/cpp/qps/client.cc
+++ b/test/cpp/qps/client.cc
@@ -80,6 +80,13 @@ using grpc::testing::SimpleResponse;
 using grpc::testing::StatsRequest;
 using grpc::testing::TestService;
 
+// In some distros, gflags is in the namespace google, and in some others,
+// in gflags. This hack is enabling us to find both.
+namespace google { }
+namespace gflags { }
+using namespace google;
+using namespace gflags;
+
 static double now() {
   gpr_timespec tv = gpr_now();
   return 1e9 * tv.tv_sec + tv.tv_nsec;
@@ -221,7 +228,7 @@ void RunTest(const int client_threads, const int client_channels,
 
 int main(int argc, char **argv) {
   grpc_init();
-  google::ParseCommandLineFlags(&argc, &argv, true);
+  ParseCommandLineFlags(&argc, &argv, true);
 
   GPR_ASSERT(FLAGS_server_port);
 
diff --git a/test/cpp/qps/server.cc b/test/cpp/qps/server.cc
index dcef8f20abd3c22f79ae897d1446ba1fa7d37f3e..8e136349a15e490ede14dc1a913258d403140372 100644
--- a/test/cpp/qps/server.cc
+++ b/test/cpp/qps/server.cc
@@ -68,6 +68,13 @@ using grpc::testing::StatsRequest;
 using grpc::testing::TestService;
 using grpc::Status;
 
+// In some distros, gflags is in the namespace google, and in some others,
+// in gflags. This hack is enabling us to find both.
+namespace google { }
+namespace gflags { }
+using namespace google;
+using namespace gflags;
+
 static bool got_sigint = false;
 
 static void sigint_handler(int x) { got_sigint = 1; }
@@ -149,7 +156,7 @@ static void RunServer() {
 
 int main(int argc, char** argv) {
   grpc_init();
-  google::ParseCommandLineFlags(&argc, &argv, true);
+  ParseCommandLineFlags(&argc, &argv, true);
 
   signal(SIGINT, sigint_handler);