Move over to ABSL logging and flags.

Removes gperftools too since that wants gflags.

Here come the fireworks.

Change-Id: I79cb7bcf60f1047fbfa28bfffc21a0fd692e4b1c
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/aos/ipc_lib/BUILD b/aos/ipc_lib/BUILD
index bae23b8..2ecd167 100644
--- a/aos/ipc_lib/BUILD
+++ b/aos/ipc_lib/BUILD
@@ -15,8 +15,9 @@
         ":shm_observers",
         "//aos:macros",
         "//aos/util:compiler_memory_barrier",
-        "@com_github_google_glog//:glog",
         "@com_google_absl//absl/base",
+        "@com_google_absl//absl/log",
+        "@com_google_absl//absl/log:check",
     ],
 )
 
@@ -53,7 +54,8 @@
         ":aos_sync",
         ":core_lib",
         ":shared_mem_types",
-        "@com_github_google_glog//:glog",
+        "@com_google_absl//absl/log",
+        "@com_google_absl//absl/log:check",
     ],
 )
 
@@ -105,7 +107,7 @@
         "//aos:init",
         "//aos/logging",
         "//aos/mutex",
-        "@com_github_gflags_gflags//:gflags",
+        "@com_google_absl//absl/flags:flag",
     ],
 )
 
@@ -120,7 +122,8 @@
     target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
-        "@com_github_google_glog//:glog",
+        "@com_google_absl//absl/log",
+        "@com_google_absl//absl/log:check",
     ],
 )
 
@@ -134,7 +137,8 @@
         ":signalfd",
         "//aos/testing:googletest",
         "//aos/testing:test_logging",
-        "@com_github_google_glog//:glog",
+        "@com_google_absl//absl/log",
+        "@com_google_absl//absl/log:check",
     ],
 )
 
@@ -149,7 +153,8 @@
     visibility = ["//visibility:public"],
     deps = [
         ":shm_observers",
-        "@com_github_google_glog//:glog",
+        "@com_google_absl//absl/log",
+        "@com_google_absl//absl/log:check",
     ],
 )
 
@@ -160,7 +165,8 @@
     deps = [
         ":index32",
         "//aos/testing:googletest",
-        "@com_github_google_glog//:glog",
+        "@com_google_absl//absl/log",
+        "@com_google_absl//absl/log:check",
     ],
 )
 
@@ -172,7 +178,8 @@
     visibility = ["//visibility:public"],
     deps = [
         ":shm_observers",
-        "@com_github_google_glog//:glog",
+        "@com_google_absl//absl/log",
+        "@com_google_absl//absl/log:check",
     ],
 )
 
@@ -183,7 +190,8 @@
     deps = [
         ":index",
         "//aos/testing:googletest",
-        "@com_github_google_glog//:glog",
+        "@com_google_absl//absl/log",
+        "@com_google_absl//absl/log:check",
     ],
 )
 
@@ -213,7 +221,8 @@
         "//aos/time",
         "//aos/util:compiler_memory_barrier",
         "//aos/util:top",
-        "@com_github_google_glog//:glog",
+        "@com_google_absl//absl/log",
+        "@com_google_absl//absl/log:check",
         "@com_google_absl//absl/strings",
         "@com_google_absl//absl/types:span",
     ],
@@ -266,6 +275,8 @@
     name = "lockless_queue_test",
     timeout = "eternal",
     srcs = ["lockless_queue_test.cc"],
+    # We don't want all the signal handlers registered, otherwise we can't fork.
+    args = ["--nobacktrace"],
     shard_count = 10,
     target_compatible_with = ["@platforms//os:linux"],
     deps = [
@@ -283,6 +294,8 @@
 cc_test(
     name = "lockless_queue_death_test",
     srcs = ["lockless_queue_death_test.cc"],
+    # We don't want all the signal handlers registered, otherwise we can't fork.
+    args = ["--nobacktrace"],
     target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":event",
@@ -307,7 +320,8 @@
     target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
-        "@com_github_google_glog//:glog",
+        "@com_google_absl//absl/log",
+        "@com_google_absl//absl/log:check",
     ],
 )
 
@@ -320,7 +334,8 @@
         "//aos:realtime",
         "//aos/logging",
         "//aos/time",
-        "@com_github_google_glog//:glog",
+        "@com_google_absl//absl/log",
+        "@com_google_absl//absl/log:check",
     ],
 )
 
@@ -334,7 +349,7 @@
         ":latency_lib",
         "//aos:init",
         "//aos/events:epoll",
-        "@com_github_gflags_gflags//:gflags",
+        "@com_google_absl//absl/flags:flag",
     ],
 )
 
@@ -349,7 +364,7 @@
         "//aos:condition",
         "//aos:init",
         "//aos/mutex",
-        "@com_github_gflags_gflags//:gflags",
+        "@com_google_absl//absl/flags:flag",
     ],
 )
 
@@ -363,7 +378,7 @@
         ":latency_lib",
         "//aos:init",
         "//aos/events:epoll",
-        "@com_github_gflags_gflags//:gflags",
+        "@com_google_absl//absl/flags:flag",
     ],
 )
 
@@ -377,7 +392,7 @@
         ":latency_lib",
         "//aos:init",
         "//aos/events:epoll",
-        "@com_github_gflags_gflags//:gflags",
+        "@com_google_absl//absl/flags:flag",
     ],
 )
 
@@ -407,7 +422,8 @@
         "//aos/ipc_lib:aos_sync",
         "//aos/time",
         "//aos/type_traits",
-        "@com_github_google_glog//:glog",
+        "@com_google_absl//absl/log",
+        "@com_google_absl//absl/log:check",
     ],
 )
 
@@ -442,7 +458,7 @@
     target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
-        "@com_github_gflags_gflags//:gflags",
+        "@com_google_absl//absl/flags:flag",
     ],
 )
 
diff --git a/aos/ipc_lib/aos_sync.cc b/aos/ipc_lib/aos_sync.cc
index 78c6b2c..5642434 100644
--- a/aos/ipc_lib/aos_sync.cc
+++ b/aos/ipc_lib/aos_sync.cc
@@ -25,7 +25,8 @@
 #endif
 
 #include "absl/base/call_once.h"
-#include "glog/logging.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 
 #include "aos/macros.h"
 #include "aos/util/compiler_memory_barrier.h"
diff --git a/aos/ipc_lib/data_alignment.h b/aos/ipc_lib/data_alignment.h
index 3bf38ce..9cbfa23 100644
--- a/aos/ipc_lib/data_alignment.h
+++ b/aos/ipc_lib/data_alignment.h
@@ -1,7 +1,8 @@
 #ifndef AOS_IPC_LIB_DATA_ALIGNMENT_H_
 #define AOS_IPC_LIB_DATA_ALIGNMENT_H_
 
-#include "glog/logging.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 
 namespace aos {
 
diff --git a/aos/ipc_lib/event.cc b/aos/ipc_lib/event.cc
index fd5bcaf..b62bdb2 100644
--- a/aos/ipc_lib/event.cc
+++ b/aos/ipc_lib/event.cc
@@ -6,7 +6,8 @@
 #include <ostream>
 #include <ratio>
 
-#include "glog/logging.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 
 #include "aos/type_traits/type_traits.h"
 
diff --git a/aos/ipc_lib/eventfd_latency.cc b/aos/ipc_lib/eventfd_latency.cc
index 4a5616f..e35f8fc 100644
--- a/aos/ipc_lib/eventfd_latency.cc
+++ b/aos/ipc_lib/eventfd_latency.cc
@@ -10,10 +10,12 @@
 #include <ratio>
 #include <thread>
 
-#include "gflags/gflags.h"
-#include "glog/logging.h"
+#include "absl/flags/flag.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 
 #include "aos/events/epoll.h"
+#include "aos/init.h"
 #include "aos/ipc_lib/latency_lib.h"
 #include "aos/logging/implementations.h"
 #include "aos/realtime.h"
@@ -23,16 +25,16 @@
 // It measures both latency of a random timer thread, and latency of the
 // pipe.
 
-DEFINE_int32(seconds, 10, "Duration of the test to run");
-DEFINE_int32(
-    latency_threshold, 1000,
+ABSL_FLAG(int32_t, seconds, 10, "Duration of the test to run");
+ABSL_FLAG(
+    int32_t, latency_threshold, 1000,
     "Disable tracing when anything takes more than this many microseoncds");
-DEFINE_int32(core, 7, "Core to pin to");
-DEFINE_int32(sender_priority, 53, "RT priority to send at");
-DEFINE_int32(receiver_priority, 52, "RT priority to receive at");
-DEFINE_int32(timer_priority, 51, "RT priority to spin the timer at");
+ABSL_FLAG(int32_t, core, 7, "Core to pin to");
+ABSL_FLAG(int32_t, sender_priority, 53, "RT priority to send at");
+ABSL_FLAG(int32_t, receiver_priority, 52, "RT priority to receive at");
+ABSL_FLAG(int32_t, timer_priority, 51, "RT priority to spin the timer at");
 
-DEFINE_bool(log_latency, false, "If true, log the latency");
+ABSL_FLAG(bool, log_latency, false, "If true, log the latency");
 
 namespace chrono = ::std::chrono;
 
@@ -40,15 +42,15 @@
 
 void SenderThread(int fd) {
   const monotonic_clock::time_point end_time =
-      monotonic_clock::now() + chrono::seconds(FLAGS_seconds);
+      monotonic_clock::now() + chrono::seconds(absl::GetFlag(FLAGS_seconds));
   // Standard mersenne_twister_engine seeded with 0
   ::std::mt19937 generator(0);
 
   // Sleep between 1 and 15 ms.
   ::std::uniform_int_distribution<> distribution(1000, 15000);
 
-  SetCurrentThreadAffinity(MakeCpusetFromCpus({FLAGS_core}));
-  SetCurrentThreadRealtimePriority(FLAGS_sender_priority);
+  SetCurrentThreadAffinity(MakeCpusetFromCpus({absl::GetFlag(FLAGS_core)}));
+  SetCurrentThreadRealtimePriority(absl::GetFlag(FLAGS_sender_priority));
   while (true) {
     const monotonic_clock::time_point wakeup_time =
         monotonic_clock::now() + chrono::microseconds(distribution(generator));
@@ -108,21 +110,22 @@
 
     max_wakeup_latency = ::std::max(wakeup_latency, max_wakeup_latency);
 
-    if (wakeup_latency > chrono::microseconds(FLAGS_latency_threshold)) {
+    if (wakeup_latency >
+        chrono::microseconds(absl::GetFlag(FLAGS_latency_threshold))) {
       t.Stop();
       AOS_LOG(INFO, "Stopped tracing, latency %" PRId64 "\n",
               static_cast<int64_t>(wakeup_latency.count()));
     }
 
-    if (FLAGS_log_latency) {
+    if (absl::GetFlag(FLAGS_log_latency)) {
       AOS_LOG(INFO, "dt: %8d.%03d\n",
               static_cast<int>(wakeup_latency.count() / 1000),
               static_cast<int>(wakeup_latency.count() % 1000));
     }
   });
 
-  SetCurrentThreadAffinity(MakeCpusetFromCpus({FLAGS_core}));
-  SetCurrentThreadRealtimePriority(FLAGS_receiver_priority);
+  SetCurrentThreadAffinity(MakeCpusetFromCpus({absl::GetFlag(FLAGS_core)}));
+  SetCurrentThreadRealtimePriority(absl::GetFlag(FLAGS_receiver_priority));
   epoll.Run();
   UnsetCurrentThreadRealtimePriority();
   epoll.DeleteFd(fd);
@@ -141,8 +144,9 @@
 int Main(int /*argc*/, char ** /*argv*/) {
   AOS_LOG(INFO, "Main!\n");
   ::std::thread t([]() {
-    TimerThread(monotonic_clock::now() + chrono::seconds(FLAGS_seconds),
-                FLAGS_timer_priority);
+    TimerThread(
+        monotonic_clock::now() + chrono::seconds(absl::GetFlag(FLAGS_seconds)),
+        absl::GetFlag(FLAGS_timer_priority));
   });
 
   int fd = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);
@@ -162,7 +166,7 @@
 }  // namespace aos
 
 int main(int argc, char **argv) {
-  ::gflags::ParseCommandLineFlags(&argc, &argv, true);
+  aos::InitGoogle(&argc, &argv);
 
   return ::aos::Main(argc, argv);
 }
diff --git a/aos/ipc_lib/futex_latency.cc b/aos/ipc_lib/futex_latency.cc
index eee015e..f6264aa 100644
--- a/aos/ipc_lib/futex_latency.cc
+++ b/aos/ipc_lib/futex_latency.cc
@@ -8,26 +8,28 @@
 #include <ratio>
 #include <thread>
 
-#include "gflags/gflags.h"
-#include "glog/logging.h"
+#include "absl/flags/flag.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 
 #include "aos/condition.h"
+#include "aos/init.h"
 #include "aos/ipc_lib/latency_lib.h"
 #include "aos/logging/implementations.h"
 #include "aos/mutex/mutex.h"
 #include "aos/realtime.h"
 #include "aos/time/time.h"
 
-DEFINE_int32(seconds, 10, "Duration of the test to run");
-DEFINE_int32(
-    latency_threshold, 1000,
+ABSL_FLAG(int32_t, seconds, 10, "Duration of the test to run");
+ABSL_FLAG(
+    int32_t, latency_threshold, 1000,
     "Disable tracing when anything takes more than this many microseoncds");
-DEFINE_int32(core, 7, "Core to pin to");
-DEFINE_int32(sender_priority, 53, "RT priority to send at");
-DEFINE_int32(receiver_priority, 52, "RT priority to receive at");
-DEFINE_int32(timer_priority, 51, "RT priority to spin the timer at");
+ABSL_FLAG(int32_t, core, 7, "Core to pin to");
+ABSL_FLAG(int32_t, sender_priority, 53, "RT priority to send at");
+ABSL_FLAG(int32_t, receiver_priority, 52, "RT priority to receive at");
+ABSL_FLAG(int32_t, timer_priority, 51, "RT priority to spin the timer at");
 
-DEFINE_bool(log_latency, false, "If true, log the latency");
+ABSL_FLAG(bool, log_latency, false, "If true, log the latency");
 
 const uint32_t kSignalNumber = SIGRTMIN + 1;
 const uint32_t kQuitSignalNumber = SIGRTMIN + 2;
@@ -49,15 +51,15 @@
 
 void SenderThread(WakeupData *data) {
   const monotonic_clock::time_point end_time =
-      monotonic_clock::now() + chrono::seconds(FLAGS_seconds);
+      monotonic_clock::now() + chrono::seconds(absl::GetFlag(FLAGS_seconds));
   // Standard mersenne_twister_engine seeded with 0
   ::std::mt19937 generator(0);
 
   // Sleep between 1 and 15 ms.
   ::std::uniform_int_distribution<> distribution(1000, 15000);
 
-  SetCurrentThreadAffinity(MakeCpusetFromCpus({FLAGS_core}));
-  SetCurrentThreadRealtimePriority(FLAGS_sender_priority);
+  SetCurrentThreadAffinity(MakeCpusetFromCpus({absl::GetFlag(FLAGS_core)}));
+  SetCurrentThreadRealtimePriority(absl::GetFlag(FLAGS_sender_priority));
   while (true) {
     const monotonic_clock::time_point wakeup_time =
         monotonic_clock::now() + chrono::microseconds(distribution(generator));
@@ -93,8 +95,8 @@
   chrono::nanoseconds sum_latency = chrono::nanoseconds(0);
   int latency_count = 0;
 
-  SetCurrentThreadAffinity(MakeCpusetFromCpus({FLAGS_core}));
-  SetCurrentThreadRealtimePriority(FLAGS_receiver_priority);
+  SetCurrentThreadAffinity(MakeCpusetFromCpus({absl::GetFlag(FLAGS_core)}));
+  SetCurrentThreadRealtimePriority(absl::GetFlag(FLAGS_receiver_priority));
   while (true) {
     chrono::nanoseconds wakeup_latency;
     {
@@ -118,13 +120,14 @@
 
     max_wakeup_latency = ::std::max(wakeup_latency, max_wakeup_latency);
 
-    if (wakeup_latency > chrono::microseconds(FLAGS_latency_threshold)) {
+    if (wakeup_latency >
+        chrono::microseconds(absl::GetFlag(FLAGS_latency_threshold))) {
       t.Stop();
       AOS_LOG(INFO, "Stopped tracing, latency %" PRId64 "\n",
               static_cast<int64_t>(wakeup_latency.count()));
     }
 
-    if (FLAGS_log_latency) {
+    if (absl::GetFlag(FLAGS_log_latency)) {
       AOS_LOG(INFO, "dt: %8d.%03d\n",
               static_cast<int>(wakeup_latency.count() / 1000),
               static_cast<int>(wakeup_latency.count() % 1000));
@@ -148,8 +151,9 @@
 
   AOS_LOG(INFO, "Main!\n");
   ::std::thread t([]() {
-    TimerThread(monotonic_clock::now() + chrono::seconds(FLAGS_seconds),
-                FLAGS_timer_priority);
+    TimerThread(
+        monotonic_clock::now() + chrono::seconds(absl::GetFlag(FLAGS_seconds)),
+        absl::GetFlag(FLAGS_timer_priority));
   });
 
   ::std::thread st([&data]() { SenderThread(&data); });
@@ -164,7 +168,7 @@
 }  // namespace aos
 
 int main(int argc, char **argv) {
-  ::gflags::ParseCommandLineFlags(&argc, &argv, true);
+  aos::InitGoogle(&argc, &argv);
 
   return ::aos::Main(argc, argv);
 }
diff --git a/aos/ipc_lib/index.h b/aos/ipc_lib/index.h
index c4cc64a..575d113 100644
--- a/aos/ipc_lib/index.h
+++ b/aos/ipc_lib/index.h
@@ -5,7 +5,8 @@
 
 #include <limits>
 
-#include "glog/logging.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 
 #include "aos/ipc_lib/shm_observers.h"
 
diff --git a/aos/ipc_lib/index_test.cc b/aos/ipc_lib/index_test.cc
index 334696e..a7f0c85 100644
--- a/aos/ipc_lib/index_test.cc
+++ b/aos/ipc_lib/index_test.cc
@@ -2,7 +2,8 @@
 
 #include <ostream>
 
-#include "glog/logging.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 #include "gtest/gtest.h"
 
 namespace aos::ipc_lib::testing {
diff --git a/aos/ipc_lib/ipc_comparison.cc b/aos/ipc_lib/ipc_comparison.cc
index 8bb78d7..e5905ac 100644
--- a/aos/ipc_lib/ipc_comparison.cc
+++ b/aos/ipc_lib/ipc_comparison.cc
@@ -26,7 +26,8 @@
 #include <thread>
 #include <utility>
 
-#include "gflags/gflags.h"
+#include "absl/flags/flag.h"
+#include "absl/flags/usage.h"
 
 #include "aos/condition.h"
 #include "aos/init.h"
@@ -36,14 +37,15 @@
 #include "aos/realtime.h"
 #include "aos/time/time.h"
 
-DEFINE_string(method, "", "Which IPC method to use");
-DEFINE_int32(messages, 1000000, "How many messages to send back and forth");
-DEFINE_int32(client_cpu, 0, "CPU to pin client to");
-DEFINE_int32(server_cpu, 0, "CPU to pin server to");
-DEFINE_int32(client_priority, 1,
-             "Realtime priority for client. Negative for don't change");
-DEFINE_int32(server_priority, 1,
-             "Realtime priority for server. Negative for don't change");
+ABSL_FLAG(std::string, method, "", "Which IPC method to use");
+ABSL_FLAG(int32_t, messages, 1000000,
+          "How many messages to send back and forth");
+ABSL_FLAG(int32_t, client_cpu, 0, "CPU to pin client to");
+ABSL_FLAG(int32_t, server_cpu, 0, "CPU to pin server to");
+ABSL_FLAG(int32_t, client_priority, 1,
+          "Realtime priority for client. Negative for don't change");
+ABSL_FLAG(int32_t, server_priority, 1,
+          "Realtime priority for server. Negative for don't change");
 
 namespace aos {
 
@@ -761,63 +763,65 @@
   sem_t *ping_sem_, *pong_sem_;
 };
 
-int Main(int /*argc*/, char **argv) {
+int Main() {
   ::std::unique_ptr<PingPongerInterface> ping_ponger;
-  if (FLAGS_method == "pipe") {
+  if (absl::GetFlag(FLAGS_method) == "pipe") {
     ping_ponger.reset(new PipePingPonger());
-  } else if (FLAGS_method == "named_pipe") {
+  } else if (absl::GetFlag(FLAGS_method) == "named_pipe") {
     ping_ponger.reset(new NamedPipePingPonger());
-  } else if (FLAGS_method == "aos_mutex") {
+  } else if (absl::GetFlag(FLAGS_method) == "aos_mutex") {
     ping_ponger.reset(new AOSMutexPingPonger());
-  } else if (FLAGS_method == "aos_event") {
+  } else if (absl::GetFlag(FLAGS_method) == "aos_event") {
     ping_ponger.reset(new AOSEventPingPonger());
-  } else if (FLAGS_method == "pthread_mutex") {
+  } else if (absl::GetFlag(FLAGS_method) == "pthread_mutex") {
     ping_ponger.reset(new PthreadMutexPingPonger(false, false));
-  } else if (FLAGS_method == "pthread_mutex_pshared") {
+  } else if (absl::GetFlag(FLAGS_method) == "pthread_mutex_pshared") {
     ping_ponger.reset(new PthreadMutexPingPonger(true, false));
-  } else if (FLAGS_method == "pthread_mutex_pshared_pi") {
+  } else if (absl::GetFlag(FLAGS_method) == "pthread_mutex_pshared_pi") {
     ping_ponger.reset(new PthreadMutexPingPonger(true, true));
-  } else if (FLAGS_method == "pthread_mutex_pi") {
+  } else if (absl::GetFlag(FLAGS_method) == "pthread_mutex_pi") {
     ping_ponger.reset(new PthreadMutexPingPonger(false, true));
-  } else if (FLAGS_method == "eventfd") {
+  } else if (absl::GetFlag(FLAGS_method) == "eventfd") {
     ping_ponger.reset(new EventFDPingPonger());
-  } else if (FLAGS_method == "sysv_semaphore") {
+  } else if (absl::GetFlag(FLAGS_method) == "sysv_semaphore") {
     ping_ponger.reset(new SysvSemaphorePingPonger());
-  } else if (FLAGS_method == "sysv_queue") {
+  } else if (absl::GetFlag(FLAGS_method) == "sysv_queue") {
     ping_ponger.reset(new SysvQueuePingPonger());
-  } else if (FLAGS_method == "posix_semaphore_unnamed_shared") {
+  } else if (absl::GetFlag(FLAGS_method) == "posix_semaphore_unnamed_shared") {
     ping_ponger.reset(new PosixUnnamedSemaphorePingPonger(1));
-  } else if (FLAGS_method == "posix_semaphore_unnamed_unshared") {
+  } else if (absl::GetFlag(FLAGS_method) ==
+             "posix_semaphore_unnamed_unshared") {
     ping_ponger.reset(new PosixUnnamedSemaphorePingPonger(0));
-  } else if (FLAGS_method == "posix_semaphore_named") {
+  } else if (absl::GetFlag(FLAGS_method) == "posix_semaphore_named") {
     ping_ponger.reset(new PosixNamedSemaphorePingPonger());
-  } else if (FLAGS_method == "posix_queue") {
+  } else if (absl::GetFlag(FLAGS_method) == "posix_queue") {
     ping_ponger.reset(new PosixQueuePingPonger());
-  } else if (FLAGS_method == "unix_stream") {
+  } else if (absl::GetFlag(FLAGS_method) == "unix_stream") {
     ping_ponger.reset(new UnixPingPonger(SOCK_STREAM));
-  } else if (FLAGS_method == "unix_datagram") {
+  } else if (absl::GetFlag(FLAGS_method) == "unix_datagram") {
     ping_ponger.reset(new UnixPingPonger(SOCK_DGRAM));
-  } else if (FLAGS_method == "unix_seqpacket") {
+  } else if (absl::GetFlag(FLAGS_method) == "unix_seqpacket") {
     ping_ponger.reset(new UnixPingPonger(SOCK_SEQPACKET));
-  } else if (FLAGS_method == "tcp") {
+  } else if (absl::GetFlag(FLAGS_method) == "tcp") {
     ping_ponger.reset(new TCPPingPonger(false));
-  } else if (FLAGS_method == "tcp_nodelay") {
+  } else if (absl::GetFlag(FLAGS_method) == "tcp_nodelay") {
     ping_ponger.reset(new TCPPingPonger(true));
-  } else if (FLAGS_method == "udp") {
+  } else if (absl::GetFlag(FLAGS_method) == "udp") {
     ping_ponger.reset(new UDPPingPonger());
   } else {
-    fprintf(stderr, "Unknown IPC method to test '%s'\n", FLAGS_method.c_str());
-    ::gflags::ShowUsageWithFlags(argv[0]);
+    fprintf(stderr, "Unknown IPC method to test '%s'\n",
+            absl::GetFlag(FLAGS_method).c_str());
     return 1;
   }
 
   ::std::atomic<bool> done{false};
 
   ::std::thread server([&ping_ponger, &done]() {
-    if (FLAGS_server_priority > 0) {
-      SetCurrentThreadRealtimePriority(FLAGS_server_priority);
+    if (absl::GetFlag(FLAGS_server_priority) > 0) {
+      SetCurrentThreadRealtimePriority(absl::GetFlag(FLAGS_server_priority));
     }
-    SetCurrentThreadAffinity(MakeCpusetFromCpus({FLAGS_server_cpu}));
+    SetCurrentThreadAffinity(
+        MakeCpusetFromCpus({absl::GetFlag(FLAGS_server_cpu)}));
 
     while (!done) {
       const PingPongerInterface::Data *data = ping_ponger->Wait();
@@ -829,10 +833,11 @@
     }
   });
 
-  if (FLAGS_client_priority > 0) {
-    SetCurrentThreadRealtimePriority(FLAGS_client_priority);
+  if (absl::GetFlag(FLAGS_client_priority) > 0) {
+    SetCurrentThreadRealtimePriority(absl::GetFlag(FLAGS_client_priority));
   }
-  SetCurrentThreadAffinity(MakeCpusetFromCpus({FLAGS_client_cpu}));
+  SetCurrentThreadAffinity(
+      MakeCpusetFromCpus({absl::GetFlag(FLAGS_client_cpu)}));
 
   // Warm everything up.
   for (int i = 0; i < 1000; ++i) {
@@ -843,7 +848,7 @@
 
   const monotonic_clock::time_point start = monotonic_clock::now();
 
-  for (int32_t i = 0; i < FLAGS_messages; ++i) {
+  for (int32_t i = 0; i < absl::GetFlag(FLAGS_messages); ++i) {
     PingPongerInterface::Data *to_send = ping_ponger->PingData();
     memset(*to_send, i % 123, sizeof(*to_send));
     const PingPongerInterface::Data *received = ping_ponger->Ping();
@@ -865,8 +870,10 @@
   server.join();
 
   AOS_LOG(INFO, "Took %f seconds to send %" PRId32 " messages\n",
-          ::aos::time::DurationInSeconds(end - start), FLAGS_messages);
-  const chrono::nanoseconds per_message = (end - start) / FLAGS_messages;
+          ::aos::time::DurationInSeconds(end - start),
+          absl::GetFlag(FLAGS_messages));
+  const chrono::nanoseconds per_message =
+      (end - start) / absl::GetFlag(FLAGS_messages);
   if (per_message >= chrono::seconds(1)) {
     AOS_LOG(INFO, "More than 1 second per message ?!?\n");
   } else {
@@ -880,7 +887,7 @@
 }  // namespace aos
 
 int main(int argc, char **argv) {
-  ::gflags::SetUsageMessage(
+  absl::SetProgramUsageMessage(
       ::std::string("Compares various forms of IPC. Usage:\n") + argv[0] +
       " --method=METHOD\n"
       "METHOD can be one of the following:\n"
@@ -905,7 +912,7 @@
       "\ttcp\n"
       "\ttcp_nodelay\n"
       "\tudp\n");
-  ::aos::InitGoogle(&argc, &argv);
+  aos::InitGoogle(&argc, &argv);
 
-  return ::aos::Main(argc, argv);
+  return ::aos::Main();
 }
diff --git a/aos/ipc_lib/latency_lib.h b/aos/ipc_lib/latency_lib.h
index 8206f3e..fe68941 100644
--- a/aos/ipc_lib/latency_lib.h
+++ b/aos/ipc_lib/latency_lib.h
@@ -5,7 +5,8 @@
 #include <string.h>
 #include <unistd.h>
 
-#include "glog/logging.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 
 #include "aos/time/time.h"
 
diff --git a/aos/ipc_lib/lockless_queue.cc b/aos/ipc_lib/lockless_queue.cc
index ae3a493..986ca62 100644
--- a/aos/ipc_lib/lockless_queue.cc
+++ b/aos/ipc_lib/lockless_queue.cc
@@ -16,16 +16,17 @@
 #include <string>
 #include <string_view>
 
+#include "absl/flags/flag.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 #include "absl/strings/escaping.h"
-#include "gflags/gflags.h"
-#include "glog/logging.h"
 
 #include "aos/ipc_lib/lockless_queue_memory.h"
 #include "aos/util/compiler_memory_barrier.h"
 
-DEFINE_bool(dump_lockless_queue_data, false,
-            "If true, print the data out when dumping the queue.");
-DECLARE_bool(skip_realtime_scheduler);
+ABSL_FLAG(bool, dump_lockless_queue_data, false,
+          "If true, print the data out when dumping the queue.");
+ABSL_DECLARE_FLAG(bool, skip_realtime_scheduler);
 
 namespace aos::ipc_lib {
 namespace {
@@ -821,7 +822,7 @@
       // Inline the setscheduler call rather than using aos/realtime.h.  This is
       // quite performance sensitive, and halves the time needed to send a
       // message when pi boosting is in effect.
-      if (!FLAGS_skip_realtime_scheduler) {
+      if (!absl::GetFlag(FLAGS_skip_realtime_scheduler)) {
         // TODO(austin): Do we need to boost the soft limit here too like we
         // were before?
         struct sched_param param;
@@ -859,7 +860,7 @@
 
     // Drop back down if we were boosted.
     if (max_priority > current_priority && current_priority > 0) {
-      if (!FLAGS_skip_realtime_scheduler) {
+      if (!absl::GetFlag(FLAGS_skip_realtime_scheduler)) {
         struct sched_param param;
         param.sched_priority = current_priority;
         PCHECK(sched_setscheduler(0, SCHED_FIFO, &param) == 0)
@@ -1643,7 +1644,7 @@
     }
     ::std::cout << "      data: {";
 
-    if (FLAGS_dump_lockless_queue_data) {
+    if (absl::GetFlag(FLAGS_dump_lockless_queue_data)) {
       const char *const m_data = m->data(memory->message_data_size());
       std::cout << absl::BytesToHexString(std::string_view(
           m_data, corrupt ? memory->message_data_size() : m->header.length));
diff --git a/aos/ipc_lib/lockless_queue.h b/aos/ipc_lib/lockless_queue.h
index ce067e6..1fdbb39 100644
--- a/aos/ipc_lib/lockless_queue.h
+++ b/aos/ipc_lib/lockless_queue.h
@@ -11,8 +11,9 @@
 #include <utility>
 #include <vector>
 
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 #include "absl/types/span.h"
-#include "glog/logging.h"
 
 #include "aos/events/context.h"
 #include "aos/ipc_lib/aos_sync.h"
diff --git a/aos/ipc_lib/lockless_queue_death_test.cc b/aos/ipc_lib/lockless_queue_death_test.cc
index c61c62c..fa2bdf6 100644
--- a/aos/ipc_lib/lockless_queue_death_test.cc
+++ b/aos/ipc_lib/lockless_queue_death_test.cc
@@ -8,7 +8,8 @@
 #include <optional>
 #include <ostream>
 
-#include "glog/logging.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 #include "gtest/gtest.h"
 
 #include "aos/events/context.h"
diff --git a/aos/ipc_lib/lockless_queue_stepping.cc b/aos/ipc_lib/lockless_queue_stepping.cc
index a7bd233..8608ad5 100644
--- a/aos/ipc_lib/lockless_queue_stepping.cc
+++ b/aos/ipc_lib/lockless_queue_stepping.cc
@@ -21,7 +21,8 @@
 #include <thread>
 #include <utility>
 
-#include "glog/logging.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 #include "gtest/gtest.h"
 
 #include "aos/ipc_lib/aos_sync.h"
diff --git a/aos/ipc_lib/lockless_queue_test.cc b/aos/ipc_lib/lockless_queue_test.cc
index 4169c93..bdb9755 100644
--- a/aos/ipc_lib/lockless_queue_test.cc
+++ b/aos/ipc_lib/lockless_queue_test.cc
@@ -17,7 +17,7 @@
 #include <thread>
 #include <type_traits>
 
-#include "gflags/gflags.h"
+#include "absl/flags/flag.h"
 #include "gtest/gtest.h"
 
 #include "aos/events/epoll.h"
@@ -29,20 +29,20 @@
 #include "aos/realtime.h"
 #include "aos/util/phased_loop.h"
 
-DEFINE_int32(min_iterations, 100,
-             "Minimum number of stress test iterations to run");
-DEFINE_int32(duration, 5, "Number of seconds to test for");
-DEFINE_int32(print_rate, 60, "Number of seconds between status prints");
+ABSL_FLAG(int32_t, min_iterations, 100,
+          "Minimum number of stress test iterations to run");
+ABSL_FLAG(int32_t, duration, 5, "Number of seconds to test for");
+ABSL_FLAG(int32_t, print_rate, 60, "Number of seconds between status prints");
 
 // The roboRIO can only handle 10 threads before exploding.  Set the default for
 // ARM to 10.
-DEFINE_int32(thread_count,
+ABSL_FLAG(int32_t, thread_count,
 #if defined(__ARM_EABI__)
-             10,
+          10,
 #else
-             100,
+          100,
 #endif
-             "Number of threads to race");
+          "Number of threads to race");
 
 namespace aos::ipc_lib::testing {
 
@@ -299,7 +299,7 @@
 
 // Races a bunch of sending threads to see if it all works.
 TEST_F(LocklessQueueTest, SendRace) {
-  const size_t kNumMessages = 10000 / FLAGS_thread_count;
+  const size_t kNumMessages = 10000 / absl::GetFlag(FLAGS_thread_count);
 
   ::std::mt19937 generator(0);
   ::std::uniform_int_distribution<> write_wrap_count_distribution(0, 10);
@@ -308,17 +308,19 @@
   ::std::bernoulli_distribution should_read_result_distribution;
   ::std::bernoulli_distribution wrap_writes_distribution;
 
-  const chrono::seconds print_frequency(FLAGS_print_rate);
+  const chrono::seconds print_frequency(absl::GetFlag(FLAGS_print_rate));
 
-  QueueRacer racer(queue(), FLAGS_thread_count, kNumMessages);
+  QueueRacer racer(queue(), absl::GetFlag(FLAGS_thread_count), kNumMessages);
   const monotonic_clock::time_point start_time = monotonic_clock::now();
   const monotonic_clock::time_point end_time =
-      start_time + chrono::seconds(FLAGS_duration);
+      start_time + chrono::seconds(absl::GetFlag(FLAGS_duration));
 
   monotonic_clock::time_point monotonic_now = start_time;
   monotonic_clock::time_point next_print_time = start_time + print_frequency;
   uint64_t messages = 0;
-  for (int i = 0; i < FLAGS_min_iterations || monotonic_now < end_time; ++i) {
+  for (int i = 0;
+       i < absl::GetFlag(FLAGS_min_iterations) || monotonic_now < end_time;
+       ++i) {
     const bool race_reads = race_reads_distribution(generator);
     const bool set_should_read = set_should_read_distribution(generator);
     const bool should_read_result = should_read_result_distribution(generator);
@@ -402,7 +404,7 @@
   PinForTest pin_cpu;
   uint64_t kNumMessages = 1000000;
   QueueRacer racer(queue(),
-                   {FLAGS_thread_count,
+                   {absl::GetFlag(FLAGS_thread_count),
                     kNumMessages,
                     {LocklessQueueSender::Result::GOOD,
                      LocklessQueueSender::Result::MESSAGES_SENT_TOO_FAST},
diff --git a/aos/ipc_lib/memory_mapped_queue.cc b/aos/ipc_lib/memory_mapped_queue.cc
index 8daf5a1..9ba21a9 100644
--- a/aos/ipc_lib/memory_mapped_queue.cc
+++ b/aos/ipc_lib/memory_mapped_queue.cc
@@ -11,9 +11,10 @@
 #include <ostream>
 #include <thread>
 
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 #include "absl/strings/str_cat.h"
 #include "flatbuffers/string.h"
-#include "glog/logging.h"
 
 #include "aos/ipc_lib/index.h"
 #include "aos/util/file.h"
diff --git a/aos/ipc_lib/named_pipe_latency.cc b/aos/ipc_lib/named_pipe_latency.cc
index 023853d..240bf78 100644
--- a/aos/ipc_lib/named_pipe_latency.cc
+++ b/aos/ipc_lib/named_pipe_latency.cc
@@ -11,10 +11,12 @@
 #include <ratio>
 #include <thread>
 
-#include "gflags/gflags.h"
-#include "glog/logging.h"
+#include "absl/flags/flag.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 
 #include "aos/events/epoll.h"
+#include "aos/init.h"
 #include "aos/ipc_lib/latency_lib.h"
 #include "aos/logging/implementations.h"
 #include "aos/realtime.h"
@@ -24,37 +26,37 @@
 // It measures both latency of a random timer thread, and latency of the
 // pipe.
 
-DEFINE_bool(sender, true, "If true, send signals to the other process.");
-DEFINE_string(fifo, "/dev/shm/aos/named_pipe_latency",
-              "FIFO to use for the test.");
-DEFINE_int32(seconds, 10, "Duration of the test to run");
-DEFINE_int32(
-    latency_threshold, 1000,
+ABSL_FLAG(bool, sender, true, "If true, send signals to the other process.");
+ABSL_FLAG(std::string, fifo, "/dev/shm/aos/named_pipe_latency",
+          "FIFO to use for the test.");
+ABSL_FLAG(int32_t, seconds, 10, "Duration of the test to run");
+ABSL_FLAG(
+    int32_t, latency_threshold, 1000,
     "Disable tracing when anything takes more than this many microseoncds");
-DEFINE_int32(core, 7, "Core to pin to");
-DEFINE_int32(sender_priority, 53, "RT priority to send at");
-DEFINE_int32(receiver_priority, 52, "RT priority to receive at");
-DEFINE_int32(timer_priority, 51, "RT priority to spin the timer at");
+ABSL_FLAG(int32_t, core, 7, "Core to pin to");
+ABSL_FLAG(int32_t, sender_priority, 53, "RT priority to send at");
+ABSL_FLAG(int32_t, receiver_priority, 52, "RT priority to receive at");
+ABSL_FLAG(int32_t, timer_priority, 51, "RT priority to spin the timer at");
 
-DEFINE_bool(log_latency, false, "If true, log the latency");
+ABSL_FLAG(bool, log_latency, false, "If true, log the latency");
 
 namespace chrono = ::std::chrono;
 
 namespace aos {
 
 void SenderThread() {
-  int pipefd =
-      open(FLAGS_fifo.c_str(), FD_CLOEXEC | O_NONBLOCK | O_WRONLY | O_NOATIME);
+  int pipefd = open(absl::GetFlag(FLAGS_fifo).c_str(),
+                    FD_CLOEXEC | O_NONBLOCK | O_WRONLY | O_NOATIME);
   const monotonic_clock::time_point end_time =
-      monotonic_clock::now() + chrono::seconds(FLAGS_seconds);
+      monotonic_clock::now() + chrono::seconds(absl::GetFlag(FLAGS_seconds));
   // Standard mersenne_twister_engine seeded with 0
   ::std::mt19937 generator(0);
 
   // Sleep between 1 and 15 ms.
   ::std::uniform_int_distribution<> distribution(1000, 15000);
 
-  SetCurrentThreadAffinity(MakeCpusetFromCpus({FLAGS_core}));
-  SetCurrentThreadRealtimePriority(FLAGS_sender_priority);
+  SetCurrentThreadAffinity(MakeCpusetFromCpus({absl::GetFlag(FLAGS_core)}));
+  SetCurrentThreadRealtimePriority(absl::GetFlag(FLAGS_sender_priority));
   while (true) {
     const monotonic_clock::time_point wakeup_time =
         monotonic_clock::now() + chrono::microseconds(distribution(generator));
@@ -83,8 +85,8 @@
 }
 
 void ReceiverThread() {
-  int pipefd =
-      open(FLAGS_fifo.c_str(), O_CLOEXEC | O_NONBLOCK | O_RDONLY | O_NOATIME);
+  int pipefd = open(absl::GetFlag(FLAGS_fifo).c_str(),
+                    O_CLOEXEC | O_NONBLOCK | O_RDONLY | O_NOATIME);
   Tracing t;
   t.Start();
 
@@ -118,21 +120,22 @@
 
     max_wakeup_latency = ::std::max(wakeup_latency, max_wakeup_latency);
 
-    if (wakeup_latency > chrono::microseconds(FLAGS_latency_threshold)) {
+    if (wakeup_latency >
+        chrono::microseconds(absl::GetFlag(FLAGS_latency_threshold))) {
       t.Stop();
       AOS_LOG(INFO, "Stopped tracing, latency %" PRId64 "\n",
               static_cast<int64_t>(wakeup_latency.count()));
     }
 
-    if (FLAGS_log_latency) {
+    if (absl::GetFlag(FLAGS_log_latency)) {
       AOS_LOG(INFO, "dt: %8d.%03d\n",
               static_cast<int>(wakeup_latency.count() / 1000),
               static_cast<int>(wakeup_latency.count() % 1000));
     }
   });
 
-  SetCurrentThreadAffinity(MakeCpusetFromCpus({FLAGS_core}));
-  SetCurrentThreadRealtimePriority(FLAGS_receiver_priority);
+  SetCurrentThreadAffinity(MakeCpusetFromCpus({absl::GetFlag(FLAGS_core)}));
+  SetCurrentThreadRealtimePriority(absl::GetFlag(FLAGS_receiver_priority));
   epoll.Run();
   UnsetCurrentThreadRealtimePriority();
   epoll.DeleteFd(pipefd);
@@ -152,12 +155,13 @@
 }
 
 int Main(int /*argc*/, char ** /*argv*/) {
-  mkfifo(FLAGS_fifo.c_str(), 0777);
+  mkfifo(absl::GetFlag(FLAGS_fifo).c_str(), 0777);
 
   AOS_LOG(INFO, "Main!\n");
   ::std::thread t([]() {
-    TimerThread(monotonic_clock::now() + chrono::seconds(FLAGS_seconds),
-                FLAGS_timer_priority);
+    TimerThread(
+        monotonic_clock::now() + chrono::seconds(absl::GetFlag(FLAGS_seconds)),
+        absl::GetFlag(FLAGS_timer_priority));
   });
 
   ::std::thread st([]() { SenderThread(); });
@@ -172,7 +176,7 @@
 }  // namespace aos
 
 int main(int argc, char **argv) {
-  ::gflags::ParseCommandLineFlags(&argc, &argv, true);
+  aos::InitGoogle(&argc, &argv);
 
   return ::aos::Main(argc, argv);
 }
diff --git a/aos/ipc_lib/print_lockless_queue_memory.cc b/aos/ipc_lib/print_lockless_queue_memory.cc
index 4bad81c..8c6e18d 100644
--- a/aos/ipc_lib/print_lockless_queue_memory.cc
+++ b/aos/ipc_lib/print_lockless_queue_memory.cc
@@ -5,7 +5,8 @@
 
 #include <ostream>
 
-#include "glog/logging.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 
 #include "aos/ipc_lib/lockless_queue.h"
 
diff --git a/aos/ipc_lib/queue_racer.cc b/aos/ipc_lib/queue_racer.cc
index 67ed6c5..a25d10a 100644
--- a/aos/ipc_lib/queue_racer.cc
+++ b/aos/ipc_lib/queue_racer.cc
@@ -10,8 +10,9 @@
 #include <ostream>
 #include <thread>
 
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 #include "absl/types/span.h"
-#include "glog/logging.h"
 #include "gtest/gtest.h"
 
 #include "aos/events/context.h"
diff --git a/aos/ipc_lib/robust_ownership_tracker.h b/aos/ipc_lib/robust_ownership_tracker.h
index 34c8b7a..bc2db17 100644
--- a/aos/ipc_lib/robust_ownership_tracker.h
+++ b/aos/ipc_lib/robust_ownership_tracker.h
@@ -13,7 +13,8 @@
 #include <ostream>
 #include <string>
 
-#include "glog/logging.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 
 #include "aos/ipc_lib/aos_sync.h"
 #include "aos/util/top.h"
diff --git a/aos/ipc_lib/shared_mem.cc b/aos/ipc_lib/shared_mem.cc
index 30dd173..861f02e 100644
--- a/aos/ipc_lib/shared_mem.cc
+++ b/aos/ipc_lib/shared_mem.cc
@@ -12,7 +12,8 @@
 #include <cstring>
 #include <ostream>
 
-#include "glog/logging.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 
 #include "aos/ipc_lib/aos_sync.h"
 
diff --git a/aos/ipc_lib/shm_base.cc b/aos/ipc_lib/shm_base.cc
index 5db25d3..eebed6f 100644
--- a/aos/ipc_lib/shm_base.cc
+++ b/aos/ipc_lib/shm_base.cc
@@ -2,10 +2,15 @@
 
 #include <string>
 
-DEFINE_string(shm_base, "/dev/shm/aos",
-              "Directory to place queue backing mmaped files in.");
+#include "absl/flags/flag.h"
+
+ABSL_FLAG(std::string, shm_base, "/dev/shm/aos",
+          "Directory to place queue backing mmaped files in.");
+
 namespace aos::testing {
+
 void SetShmBase(const std::string_view base) {
-  FLAGS_shm_base = std::string(base) + "/aos";
+  absl::SetFlag(&FLAGS_shm_base, std::string(base) + "/aos");
 }
+
 }  // namespace aos::testing
diff --git a/aos/ipc_lib/shm_base.h b/aos/ipc_lib/shm_base.h
index 1d06a69..9a56d29 100644
--- a/aos/ipc_lib/shm_base.h
+++ b/aos/ipc_lib/shm_base.h
@@ -3,11 +3,12 @@
 
 #include <string_view>
 
-#include "gflags/gflags.h"
+#include "absl/flags/declare.h"
 
-DECLARE_string(shm_base);
+ABSL_DECLARE_FLAG(std::string, shm_base);
 
 namespace aos::testing {
 void SetShmBase(const std::string_view base);
 }
+
 #endif  // AOS_IPC_LIB_SHM_BASE_H_
diff --git a/aos/ipc_lib/signal_stress.cc b/aos/ipc_lib/signal_stress.cc
index b2749af..d5d1323 100644
--- a/aos/ipc_lib/signal_stress.cc
+++ b/aos/ipc_lib/signal_stress.cc
@@ -10,10 +10,12 @@
 #include <ratio>
 #include <thread>
 
-#include "gflags/gflags.h"
-#include "glog/logging.h"
+#include "absl/flags/flag.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 
 #include "aos/events/epoll.h"
+#include "aos/init.h"
 #include "aos/ipc_lib/latency_lib.h"
 #include "aos/logging/implementations.h"
 #include "aos/realtime.h"
@@ -26,18 +28,18 @@
 // To enable function graph:
 //   echo "function_graph" > current_tracer
 
-DEFINE_bool(sender, true, "If true, send signals to the other process.");
-DEFINE_int32(other_pid, -1, "PID of other process to ping");
-DEFINE_int32(seconds, 10, "Duration of the test to run");
-DEFINE_int32(
-    latency_threshold, 1000,
+ABSL_FLAG(bool, sender, true, "If true, send signals to the other process.");
+ABSL_FLAG(int32_t, other_pid, -1, "PID of other process to ping");
+ABSL_FLAG(int32_t, seconds, 10, "Duration of the test to run");
+ABSL_FLAG(
+    int32_t, latency_threshold, 1000,
     "Disable tracing when anything takes more than this many microseoncds");
-DEFINE_int32(core, 7, "Core to pin to");
-DEFINE_int32(sender_priority, 53, "RT priority to send at");
-DEFINE_int32(receiver_priority, 52, "RT priority to receive at");
-DEFINE_int32(timer_priority, 51, "RT priority to spin the timer at");
+ABSL_FLAG(int32_t, core, 7, "Core to pin to");
+ABSL_FLAG(int32_t, sender_priority, 53, "RT priority to send at");
+ABSL_FLAG(int32_t, receiver_priority, 52, "RT priority to receive at");
+ABSL_FLAG(int32_t, timer_priority, 51, "RT priority to spin the timer at");
 
-DEFINE_bool(log_latency, false, "If true, log the latency");
+ABSL_FLAG(bool, log_latency, false, "If true, log the latency");
 
 const uint32_t kSignalNumber = SIGRTMIN + 1;
 const uint32_t kQuitSignalNumber = SIGRTMIN + 2;
@@ -48,7 +50,7 @@
 
 void SenderThread() {
   const monotonic_clock::time_point end_time =
-      monotonic_clock::now() + chrono::seconds(FLAGS_seconds);
+      monotonic_clock::now() + chrono::seconds(absl::GetFlag(FLAGS_seconds));
   // Standard mersenne_twister_engine seeded with 0
   ::std::mt19937 generator(0);
 
@@ -56,13 +58,13 @@
   ::std::uniform_int_distribution<> distribution(1000, 15000);
 
   int pid = getpid();
-  if (FLAGS_other_pid != -1) {
-    pid = FLAGS_other_pid;
+  if (absl::GetFlag(FLAGS_other_pid) != -1) {
+    pid = absl::GetFlag(FLAGS_other_pid);
   }
   AOS_LOG(INFO, "Current PID: %d\n", pid);
 
-  SetCurrentThreadAffinity(MakeCpusetFromCpus({FLAGS_core}));
-  SetCurrentThreadRealtimePriority(FLAGS_sender_priority);
+  SetCurrentThreadAffinity(MakeCpusetFromCpus({absl::GetFlag(FLAGS_core)}));
+  SetCurrentThreadRealtimePriority(absl::GetFlag(FLAGS_sender_priority));
   while (true) {
     const monotonic_clock::time_point wakeup_time =
         monotonic_clock::now() + chrono::microseconds(distribution(generator));
@@ -137,21 +139,22 @@
 
     max_wakeup_latency = ::std::max(wakeup_latency, max_wakeup_latency);
 
-    if (wakeup_latency > chrono::microseconds(FLAGS_latency_threshold)) {
+    if (wakeup_latency >
+        chrono::microseconds(absl::GetFlag(FLAGS_latency_threshold))) {
       t.Stop();
       AOS_LOG(INFO, "Stopped tracing, latency %" PRId64 "\n",
               static_cast<int64_t>(wakeup_latency.count()));
     }
 
-    if (FLAGS_log_latency) {
+    if (absl::GetFlag(FLAGS_log_latency)) {
       AOS_LOG(INFO, "signo: %d, sending pid: %d, dt: %8d.%03d\n", si.ssi_signo,
               si.ssi_pid, static_cast<int>(wakeup_latency_int64 / 1000),
               static_cast<int>(wakeup_latency_int64 % 1000));
     }
   });
 
-  SetCurrentThreadAffinity(MakeCpusetFromCpus({FLAGS_core}));
-  SetCurrentThreadRealtimePriority(FLAGS_receiver_priority);
+  SetCurrentThreadAffinity(MakeCpusetFromCpus({absl::GetFlag(FLAGS_core)}));
+  SetCurrentThreadRealtimePriority(absl::GetFlag(FLAGS_receiver_priority));
   epoll.Run();
   UnsetCurrentThreadRealtimePriority();
   epoll.DeleteFd(signalfd_fd);
@@ -178,8 +181,9 @@
 
   AOS_LOG(INFO, "Main!\n");
   ::std::thread t([]() {
-    TimerThread(monotonic_clock::now() + chrono::seconds(FLAGS_seconds),
-                FLAGS_timer_priority);
+    TimerThread(
+        monotonic_clock::now() + chrono::seconds(absl::GetFlag(FLAGS_seconds)),
+        absl::GetFlag(FLAGS_timer_priority));
   });
 
   ::std::thread st([]() { SenderThread(); });
@@ -194,7 +198,7 @@
 }  // namespace aos
 
 int main(int argc, char **argv) {
-  ::gflags::ParseCommandLineFlags(&argc, &argv, true);
+  aos::InitGoogle(&argc, &argv);
 
   return ::aos::Main(argc, argv);
 }
diff --git a/aos/ipc_lib/signalfd.cc b/aos/ipc_lib/signalfd.cc
index c9634a5..9f3c972 100644
--- a/aos/ipc_lib/signalfd.cc
+++ b/aos/ipc_lib/signalfd.cc
@@ -12,7 +12,8 @@
 
 #include <initializer_list>
 
-#include "glog/logging.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 
 namespace aos::ipc_lib {
 namespace {
diff --git a/aos/ipc_lib/signalfd_test.cc b/aos/ipc_lib/signalfd_test.cc
index 025d66b..bc6f460 100644
--- a/aos/ipc_lib/signalfd_test.cc
+++ b/aos/ipc_lib/signalfd_test.cc
@@ -3,7 +3,8 @@
 #include <memory>
 #include <thread>
 
-#include "glog/logging.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 #include "gtest/gtest.h"
 
 #include "aos/testing/test_logging.h"