Index: Makefile
--- Makefile.orig	2024-06-25 01:48:34.000000000 +0200
+++ Makefile	2024-07-14 10:12:08.859454000 +0200
@@ -307,15 +307,7 @@
 $(foreach path, $(missing_make_config_paths), \
 	$(warning Warning: $(path) does not exist))
 
-ifeq ($(PLATFORM), OS_AIX)
-# no debug info
-else ifneq ($(PLATFORM), IOS)
-CFLAGS += -g
-CXXFLAGS += -g
-else
-# no debug info for IOS, that will make our library big
 OPT += -DNDEBUG
-endif
 
 ifeq ($(PLATFORM), OS_AIX)
 ARFLAGS = -X64 rs
@@ -559,9 +551,6 @@
 	WARNING_FLAGS += -Wno-unused-lambda-capture
 endif
 
-ifndef DISABLE_WARNING_AS_ERROR
-	WARNING_FLAGS += -Werror
-endif
 
 
 ifdef LUA_PATH
@@ -884,7 +873,7 @@
 	rocksdbjavastatic rocksdbjava install install-static install-shared \
 	uninstall analyze tools tools_lib check-headers checkout_folly
 
-all: $(LIBRARY) $(BENCHMARKS) tools tools_lib test_libs $(TESTS)
+all: $(LIBRARY)
 
 all_but_some_tests: $(LIBRARY) $(BENCHMARKS) tools tools_lib test_libs $(ROCKSDBTESTS_SUBSET)
 
Index: env/env_posix.cc
--- env/env_posix.cc.orig	2024-06-25 01:48:34.000000000 +0200
+++ env/env_posix.cc	2024-07-14 10:12:08.859588000 +0200
@@ -73,6 +73,11 @@
 #include "util/thread_local.h"
 #include "util/threadpool_imp.h"
 
+#if defined(OS_FREEBSD) || defined(__FreeBSD__)
+#define fdatasync      fsync
+#define fread_unlocked fread
+#endif
+
 #if !defined(TMPFS_MAGIC)
 #define TMPFS_MAGIC 0x01021994
 #endif
Index: port/port_posix.h
--- port/port_posix.h.orig	2024-06-25 01:48:34.000000000 +0200
+++ port/port_posix.h	2024-07-14 10:12:08.859676000 +0200
@@ -30,7 +30,7 @@
 #define PLATFORM_IS_LITTLE_ENDIAN \
   (__DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN)
 #endif
-#elif defined(OS_SOLARIS)
+#elif defined(OS_SOLARIS) || defined(__sun)
 #include <sys/isa_defs.h>
 #ifdef _LITTLE_ENDIAN
 #define PLATFORM_IS_LITTLE_ENDIAN true
@@ -44,7 +44,7 @@
 #define PLATFORM_IS_LITTLE_ENDIAN (BYTE_ORDER == LITTLE_ENDIAN)
 #include <alloca.h>
 #elif defined(OS_FREEBSD) || defined(OS_OPENBSD) || defined(OS_NETBSD) || \
-    defined(OS_DRAGONFLYBSD) || defined(OS_ANDROID)
+    defined(OS_DRAGONFLYBSD) || defined(OS_ANDROID) || defined(__FreeBSD__)
 #include <sys/endian.h>
 #include <sys/types.h>
 #define PLATFORM_IS_LITTLE_ENDIAN (_BYTE_ORDER == _LITTLE_ENDIAN)
Index: port/stack_trace.cc
--- port/stack_trace.cc.orig	2024-07-14 10:12:08.859801000 +0200
+++ port/stack_trace.cc	2024-07-14 10:13:01.215467000 +0200
@@ -39,6 +39,7 @@
 #endif  // OS_OPENBSD
 #ifdef OS_FREEBSD
 #include <sys/sysctl.h>
+#include <sys/types.h>
 #include <sys/wait.h>
 #endif  // OS_FREEBSD
 #ifdef OS_LINUX
Index: tools/ldb_cmd.cc
--- tools/ldb_cmd.cc.orig	2024-06-25 01:48:34.000000000 +0200
+++ tools/ldb_cmd.cc	2024-07-14 10:12:08.860333000 +0200
@@ -671,9 +671,9 @@
     LDBCommandExecuteResult& exec_state) {
   auto itr = option_map_.find(option);
   if (itr != option_map_.end()) {
-#if defined(CYGWIN)
+#if 1
     char* str_end = nullptr;
-    value = strtol(itr->second.c_str(), &str_end, 10);
+    value = (int)strtol(itr->second.c_str(), &str_end, 10);
     if (str_end == itr->second.c_str()) {
       exec_state =
           LDBCommandExecuteResult::Failed(option + " has an invalid value.");
@@ -2120,8 +2120,8 @@
   itr = options.find(ARG_MAX_KEYS);
   if (itr != options.end()) {
     try {
-#if defined(CYGWIN)
-      max_keys_ = strtol(itr->second.c_str(), 0, 10);
+#if 1
+      max_keys_ = (int)strtol(itr->second.c_str(), 0, 10);
 #else
       max_keys_ = std::stoi(itr->second);
 #endif
@@ -3491,8 +3491,8 @@
   itr = options.find(ARG_MAX_KEYS);
   if (itr != options.end()) {
     try {
-#if defined(CYGWIN)
-      max_keys_scanned_ = strtol(itr->second.c_str(), 0, 10);
+#if 1
+      max_keys_scanned_ = (int)strtol(itr->second.c_str(), 0, 10);
 #else
       max_keys_scanned_ = std::stoi(itr->second);
 #endif
@@ -4877,8 +4877,8 @@
   auto itr = options.find(ARG_MAX_KEYS);
   if (itr != options.end()) {
     try {
-#if defined(CYGWIN)
-      max_keys_ = strtol(itr->second.c_str(), 0, 10);
+#if 1
+      max_keys_ = (int)strtol(itr->second.c_str(), 0, 10);
 #else
       max_keys_ = std::stoi(itr->second);
 #endif
Index: util/string_util.cc
--- util/string_util.cc.orig	2024-06-25 01:48:34.000000000 +0200
+++ util/string_util.cc	2024-07-14 10:12:08.860451000 +0200
@@ -337,7 +337,7 @@
 
 uint64_t ParseUint64(const std::string& value) {
   size_t endchar;
-#ifndef CYGWIN
+#if 0
   uint64_t num = std::stoull(value.c_str(), &endchar);
 #else
   char* endptr;
@@ -389,11 +389,11 @@
 
 int ParseInt(const std::string& value) {
   size_t endchar;
-#ifndef CYGWIN
+#if 0
   int num = std::stoi(value.c_str(), &endchar);
 #else
   char* endptr;
-  int num = std::strtoul(value.c_str(), &endptr, 0);
+  int num = (int)std::strtoul(value.c_str(), &endptr, 0);
   endchar = endptr - value.c_str();
 #endif
 
@@ -412,7 +412,7 @@
 }
 
 double ParseDouble(const std::string& value) {
-#ifndef CYGWIN
+#if 0
   return std::stod(value);
 #else
   return std::strtod(value.c_str(), 0);
