Index: src/google/protobuf/compiler/command_line_interface.cc
--- src/google/protobuf/compiler/command_line_interface.cc.orig
+++ src/google/protobuf/compiler/command_line_interface.cc
@@ -232,6 +232,11 @@ bool GetProtocAbsolutePath(std::string* path) {
   if (sysctl(mib, 4, &buffer, &len, nullptr, 0) != 0) {
     len = 0;
   }
+#elif defined(__OpenBSD__)
+  std::string protocpath("${LOCALBASE}/bin/protoc");
+  char buffer[PATH_MAX]{};
+  protocpath.copy(buffer, sizeof buffer - 1);
+  int len = protocpath.length();
 #else
   char buffer[PATH_MAX];
   int len = readlink("/proc/self/exe", buffer, PATH_MAX);
