Build fixes from fuzz target.
diff --git a/BUILD b/BUILD
index 1fbdda4..9913e91 100644
--- a/BUILD
+++ b/BUILD
@@ -43,6 +43,11 @@
     visibility = ["//visibility:public"],
 )
 
+config_setting(
+    name = "fuzz",
+    values = {"define": "fuzz=true"},
+)
+
 # Public C/C++ libraries #######################################################
 
 cc_library(
@@ -358,15 +363,20 @@
 
 # OSS-Fuzz test
 cc_binary(
+    testonly = 1,
     name = "file_descriptor_parsenew_fuzzer",
     srcs = ["tests/file_descriptor_parsenew_fuzzer.cc"],
-    copts = CPPOTS + ["-fsanitizer=fuzzer,address"],
+    copts = CPPOPTS + select({
+        "//conditions:default": [],
+        ":fuzz": ["-fsanitizer=fuzzer,address"],
+    }),
+    defines = select({
+        "//conditions:default": [],
+        ":fuzz": ["HAVE_FUZZER"],
+    }),
     deps = [
         ":descriptor_upbproto",
-        ":descriptor_upbreflection",
         ":upb",
-        ":upb_pb",
-        ":upb_test",
     ],
 )
 
diff --git a/bazel/upb_proto_library.bzl b/bazel/upb_proto_library.bzl
index 503925e..bf2e33a 100644
--- a/bazel/upb_proto_library.bzl
+++ b/bazel/upb_proto_library.bzl
@@ -175,7 +175,7 @@
              "_WrappedGeneratedSrcs (aspect should have handled this).")
     cc_info = dep[_WrappedCcInfo].cc_info
     srcs = dep[_WrappedGeneratedSrcs].srcs
-    lib = cc_info.linking_context.libraries_to_link[0]
+    lib = cc_info.linking_context.libraries_to_link.to_list()[0]
     files = _filter_none([
         lib.static_library,
         lib.pic_static_library,
diff --git a/tests/file_descriptor_parsenew_fuzzer.cc b/tests/file_descriptor_parsenew_fuzzer.cc
index 4166469..057e62d 100644
--- a/tests/file_descriptor_parsenew_fuzzer.cc
+++ b/tests/file_descriptor_parsenew_fuzzer.cc
@@ -1,16 +1,15 @@
-#include <cstddef>
 #include <cstdint>
-#include <cstdlib>
 
 #include "google/protobuf/descriptor.upb.h"
-#include "upb/def.h"
-#include "upb/msg.h"
 #include "upb/upb.h"
 
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
-  upb_strview strview =
-      upb_strview_make(reinterpret_cast<const char*>(data), size);
   upb::Arena arena;
-  google_protobuf_FileDescriptorProto_parsenew(strview, arena.ptr());
+  google_protobuf_FileDescriptorProto_parse(reinterpret_cast<const char*>(data),
+                                            size, arena.ptr());
   return 0;
 }
+
+#ifndef HAVE_FUZZER
+int main() {}
+#endif
diff --git a/tools/make_cmakelists.py b/tools/make_cmakelists.py
index 22f3757..a4923c8 100755
--- a/tools/make_cmakelists.py
+++ b/tools/make_cmakelists.py
@@ -48,7 +48,7 @@
         else:
             print("Warning: no such file: " + file)
 
-    if filter(IsSourceFile, files):
+    if list(filter(IsSourceFile, files)):
       # Has sources, make this a normal library.
       self.converter.toplevel += "add_library(%s\n  %s)\n" % (
           kwargs["name"],
@@ -272,8 +272,8 @@
 
 globs = GetDict(converter)
 
-execfile("WORKSPACE", GetDict(WorkspaceFileFunctions(converter)))
-execfile("BUILD", GetDict(BuildFileFunctions(converter)))
+exec(open("WORKSPACE").read(), GetDict(WorkspaceFileFunctions(converter)))
+exec(open("BUILD").read(), GetDict(BuildFileFunctions(converter)))
 
 with open(sys.argv[1], "w") as f:
   f.write(converter.convert())