[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Any Hurd porters interested in getting MariaDB working?



Le 2025-12-21 17:52, crupest@crupest.life a écrit :

On 2025-12-21 21:50, crupest@crupest.life wrote:
On 2025-12-20 10:28, Otto Kekäläinen wrote:
Are there any Hurd porters with an interest in getting MariaDB working
in the port?

I am happy to take your patches, do additional testing and do uploads.
Unfortunately I can't do the actual port fixing myself as there is too
much work and the domain is something I am not strong in. My attempt
at fixes at https://salsa.debian.org/mariadb-team/mariadb-server/-/merge_requests/145
did get some progress, so if you want to take on this challenge, you
don't need to start from zero.

I've looked at that MR and found that the patch is mainly about disabling cracklib related features of MariaDB. I guess it might be because cracklib is failed to build on Hurd. So I've tried to fix cracklib build on Hurd and created a MR on it at https://salsa.debian.org/debian/pkg-cracklib/-/merge_requests/6. If cracklib can be built successfully on Hurd, I think MariaDB can be built successfully automatically. If I'm wrong, please point out.

I've re-checked the MR and I'm a little wrong. Besides cracklib problem, there are some other compiling issues, which have already been described in MR comment. Sorry that I didn't check it carefully.
 
Hi,
 
I have taken a look at it and successfully built it.
 
Regarding the build rules, I had to disable some features. I didn't aim for polish—I first wanted something that works. However, I know I had to disable PLUGIN_AUTH_SOCKET and PLUGIN_CRACKLIB_PASSWORD_CHECK
 
I m currentely use amd 64
debian rules
# Cracklib is missing on hurd-amd64
ifeq ($(DEB_HOST_ARCH),hurd-amd64)
    CMAKEFLAGS += -DPLUGIN_AUTH_SOCKET=NO
    CMAKEFLAGS += -DWITH_DTRACE=OFF
    CMAKEFLAGS += -DENABLE_DTRACE=OFF
    CMAKEFLAGS += -DWITH_PLUGIN_AUTH_PAM=NO
    CMAKEFLAGS += -DWITH_PLUGIN_AUTH_GSSAPI=NO
    # Add cracklib flag if needed
    CMAKEFLAGS += -DPLUGIN_CRACKLIB_PASSWORD_CHECK=NO
endif
 
I started building from the GitHub source and it worked, with tests passing except for two.
 
For Debian, I'm currently building it, but I won't submit a patch soon. The build process is quite slow, and polishing everything will take time.
 
I adapt the patch from Otto
see attached 
 
0001-rocksdb-port-to-GNU-HURD.patch for https://github.com/MariaDB/server.git 
0001-port-GNU-HURD-OS.patch for submodule https://github.com/facebook/rocksdb.git 
From f02db71a2ae232a95658aa9be730e5a88b588829 Mon Sep 17 00:00:00 2001
From: gfleury <gfleury@disroot.org>
Date: Sun, 21 Dec 2025 08:10:00 +0000
Subject: [PATCH] port GNU HURD OS

---
 CMakeLists.txt   |  2 ++
 env/env_posix.cc | 14 +++++++-------
 env/fs_posix.cc  | 14 +++++++++-----
 3 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ec59d44..9d92cae 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -537,6 +537,8 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
   add_definitions(-DOS_MACOSX)
 elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
   add_definitions(-DOS_LINUX)
+elseif(CMAKE_SYSTEM_NAME MATCHES "GNU")
+  add_definitions(-DOS_GNU_HURD)
 elseif(CMAKE_SYSTEM_NAME MATCHES "SunOS")
   add_definitions(-DOS_SOLARIS)
 elseif(CMAKE_SYSTEM_NAME MATCHES "kFreeBSD")
diff --git a/env/env_posix.cc b/env/env_posix.cc
index 609d169..dff39a0 100644
--- a/env/env_posix.cc
+++ b/env/env_posix.cc
@@ -41,8 +41,8 @@
 
 #include <algorithm>
 // Get nano time includes
-#if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_GNU_KFREEBSD)
-#elif defined(__MACH__)
+#if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_GNU_KFREEBSD) || defined(OS_GNU_HURD)
+#elif defined(__MACH__) && !defined(__GNU__)
 #include <Availability.h>
 #include <mach/clock.h>
 #include <mach/mach.h>
@@ -141,13 +141,13 @@ class PosixClock : public SystemClock {
 
   uint64_t NowNanos() override {
 #if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_GNU_KFREEBSD) || \
-    defined(OS_AIX)
+    defined(OS_AIX) || defined(OS_GNU_HURD)
     struct timespec ts;
     clock_gettime(CLOCK_MONOTONIC, &ts);
     return static_cast<uint64_t>(ts.tv_sec) * 1000000000 + ts.tv_nsec;
 #elif defined(OS_SOLARIS)
     return gethrtime();
-#elif defined(__MACH__)
+#elif defined(__MACH__) && !defined(__GNU)
     clock_serv_t cclock;
     mach_timespec_t ts;
     host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
@@ -163,7 +163,7 @@ class PosixClock : public SystemClock {
 
   uint64_t CPUMicros() override {
 #if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_GNU_KFREEBSD) || \
-    defined(OS_AIX) || (defined(__MACH__) && defined(__MAC_10_12))
+    defined(OS_AIX) || (defined(__MACH__) && defined(__MAC_10_12)) && !defined(__GNU__)
     struct timespec ts;
     clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts);
     return (static_cast<uint64_t>(ts.tv_sec) * 1000000000 + ts.tv_nsec) / 1000;
@@ -173,7 +173,7 @@ class PosixClock : public SystemClock {
 
   uint64_t CPUNanos() override {
 #if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_GNU_KFREEBSD) || \
-    defined(OS_AIX) || (defined(__MACH__) && defined(__MAC_10_12))
+    defined(OS_AIX) || (defined(__MACH__) && defined(__MAC_10_12)) && !defined(__GNU__)
     struct timespec ts;
     clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts);
     return static_cast<uint64_t>(ts.tv_sec) * 1000000000 + ts.tv_nsec;
@@ -309,7 +309,7 @@ class PosixEnv : public CompositeEnv {
 
   uint64_t GetThreadID() const override {
     uint64_t thread_id = 0;
-#if defined(_GNU_SOURCE) && defined(__GLIBC_PREREQ)
+#if defined(_GNU_SOURCE) && defined(__GLIBC_PREREQ) && !defined(__GNU__)
 #if __GLIBC_PREREQ(2, 30)
     thread_id = ::gettid();
 #else   // __GLIBC_PREREQ(2, 30)
diff --git a/env/fs_posix.cc b/env/fs_posix.cc
index ab4dead..8932830 100644
--- a/env/fs_posix.cc
+++ b/env/fs_posix.cc
@@ -35,7 +35,7 @@
 #include <algorithm>
 // Get nano time includes
 #if defined(OS_LINUX) || defined(OS_FREEBSD)
-#elif defined(__MACH__)
+#elif defined(__MACH__) && !defined(__GNU__)
 #include <Availability.h>
 #include <mach/clock.h>
 #include <mach/mach.h>
@@ -46,6 +46,10 @@
 #include <set>
 #include <vector>
 
+#if defined(OS_GNU_HURD)
+#include <sys/sysmacros.h>
+#endif
+
 #include "env/composite_env_wrapper.h"
 #include "env/io_posix.h"
 #include "logging/posix_logger.h"
@@ -167,7 +171,7 @@ class PosixFileSystem : public FileSystem {
       return IOStatus::IOError(fname,
                                "Direct I/O not supported in RocksDB lite");
 #endif  // !ROCKSDB_LITE
-#if !defined(OS_MACOSX) && !defined(OS_OPENBSD) && !defined(OS_SOLARIS)
+#if !defined(OS_MACOSX) && !defined(OS_OPENBSD) && !defined(OS_SOLARIS) && !defined(OS_GNU_HURD)
       flags |= O_DIRECT;
       TEST_SYNC_POINT_CALLBACK("NewSequentialFile:O_DIRECT", &flags);
 #endif
@@ -222,7 +226,7 @@ class PosixFileSystem : public FileSystem {
       return IOStatus::IOError(fname,
                                "Direct I/O not supported in RocksDB lite");
 #endif  // !ROCKSDB_LITE
-#if !defined(OS_MACOSX) && !defined(OS_OPENBSD) && !defined(OS_SOLARIS)
+#if !defined(OS_MACOSX) && !defined(OS_OPENBSD) && !defined(OS_SOLARIS) && !defined(OS_GNU_HURD)
       flags |= O_DIRECT;
       TEST_SYNC_POINT_CALLBACK("NewRandomAccessFile:O_DIRECT", &flags);
 #endif
@@ -300,7 +304,7 @@ class PosixFileSystem : public FileSystem {
                                "Direct I/O not supported in RocksDB lite");
 #endif  // ROCKSDB_LITE
       flags |= O_WRONLY;
-#if !defined(OS_MACOSX) && !defined(OS_OPENBSD) && !defined(OS_SOLARIS)
+#if !defined(OS_MACOSX) && !defined(OS_OPENBSD) && !defined(OS_SOLARIS) && !defined(OS_GNU_HURD)
       flags |= O_DIRECT;
 #endif
       TEST_SYNC_POINT_CALLBACK("NewWritableFile:O_DIRECT", &flags);
@@ -392,7 +396,7 @@ class PosixFileSystem : public FileSystem {
                                "Direct I/O not supported in RocksDB lite");
 #endif  // !ROCKSDB_LITE
       flags |= O_WRONLY;
-#if !defined(OS_MACOSX) && !defined(OS_OPENBSD) && !defined(OS_SOLARIS)
+#if !defined(OS_MACOSX) && !defined(OS_OPENBSD) && !defined(OS_SOLARIS) && !defined(OS_GNU_HURD)
       flags |= O_DIRECT;
 #endif
       TEST_SYNC_POINT_CALLBACK("NewWritableFile:O_DIRECT", &flags);
-- 
2.51.0

From 532c9f1fbb4537b9f5e9530069c5a46bafb20154 Mon Sep 17 00:00:00 2001
From: gfleury <gfleury@disroot.org>
Date: Sun, 21 Dec 2025 04:34:32 +0000
Subject: [PATCH] rocksdb: port to GNU HURD

---
 .../build_configurations/mysql_release.cmake  |  2 +-
 storage/rocksdb/build_rocksdb.cmake           |  2 ++
 storage/rocksdb/rdb_io_watchdog.cc            | 26 ++++++++++++-------
 storage/rocksdb/rdb_io_watchdog.h             | 20 +++++++++-----
 4 files changed, 32 insertions(+), 18 deletions(-)

diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake
index 6b7b4d69..9da8c07d 100644
--- a/cmake/build_configurations/mysql_release.cmake
+++ b/cmake/build_configurations/mysql_release.cmake
@@ -121,7 +121,7 @@ ELSEIF(DEB)
   SET(WITH_LIBWRAP ON)
   SET(HAVE_EMBEDDED_PRIVILEGE_CONTROL ON)
   # No hurd implementation
-  IF(NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "i686-AT386")
+  IF(NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "GNU")
     SET(PLUGIN_AUTH_SOCKET YES CACHE STRING "")
   ENDIF()
   SET(WITH_EMBEDDED_SERVER ON CACHE BOOL "")
diff --git a/storage/rocksdb/build_rocksdb.cmake b/storage/rocksdb/build_rocksdb.cmake
index 8866f26f..2e79094e 100644
--- a/storage/rocksdb/build_rocksdb.cmake
+++ b/storage/rocksdb/build_rocksdb.cmake
@@ -92,6 +92,8 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "SunOS")
   add_definitions(-DOS_SOLARIS)
 elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
   add_definitions(-DOS_FREEBSD)
+elseif(CMAKE_SYSTEM_NAME MATCHES "GNU")
+  add_definitions(-DOS_GNU_HURD)
 elseif(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
   add_definitions(-DOS_NETBSD)
 elseif(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
diff --git a/storage/rocksdb/rdb_io_watchdog.cc b/storage/rocksdb/rdb_io_watchdog.cc
index 07834118..b8d815f3 100644
--- a/storage/rocksdb/rdb_io_watchdog.cc
+++ b/storage/rocksdb/rdb_io_watchdog.cc
@@ -27,7 +27,7 @@
 namespace myrocks {
 
 void Rdb_io_watchdog::expire_io_callback(union sigval timer_data) {
-  DBUG_ASSERT(timer_data.sival_ptr != nullptr);
+  DBUG_ASSERT(timer_data.sival_ptr != RDB_NULL_TIMER);
 
   // The treatment of any pending signal generated by the deleted timer is
   // unspecified. Therefore we still need to handle the rare case where we
@@ -52,14 +52,14 @@ void Rdb_io_watchdog::expire_io_callback(union sigval timer_data) {
 void Rdb_io_watchdog::io_check_callback(union sigval timer_data) {
   RDB_MUTEX_LOCK_CHECK(m_reset_mutex);
 
-  DBUG_ASSERT(timer_data.sival_ptr != nullptr);
+  DBUG_ASSERT(timer_data.sival_ptr != RDB_NULL_TIMER);
 
   struct sigevent e;
 
   e.sigev_notify = SIGEV_THREAD;
   e.sigev_notify_function = &Rdb_io_watchdog::expire_io_callback_wrapper;
   e.sigev_value.sival_ptr = this;
-  e.sigev_notify_attributes = nullptr;
+  e.sigev_notify_attributes = RDB_NULL_TIMER;
 
   int ret = timer_create(CLOCK_MONOTONIC, &e, &m_io_check_watchdog_timer);
 
@@ -76,7 +76,7 @@ void Rdb_io_watchdog::io_check_callback(union sigval timer_data) {
   // One time execution only for the watchdog. No interval.
   timer_spec.it_value.tv_sec = m_write_timeout;
 
-  ret = timer_settime(m_io_check_watchdog_timer, 0, &timer_spec, nullptr);
+  ret = timer_settime(m_io_check_watchdog_timer, 0, &timer_spec, RDB_NULL_TIMER);
 
   if (unlikely(ret)) {
     // NO_LINT_DEBUG
@@ -111,21 +111,27 @@ void Rdb_io_watchdog::io_check_callback(union sigval timer_data) {
     sql_print_warning("Deleting the watchdog I/O timer failed with %d.", errno);
   }
 
-  m_io_check_watchdog_timer = nullptr;
+  m_io_check_watchdog_timer = RDB_NULL_TIMER;
 
   RDB_MUTEX_UNLOCK_CHECK(m_reset_mutex);
 }
 
 int Rdb_io_watchdog::check_write_access(const std::string &dirname) const {
   DBUG_ASSERT(!dirname.empty());
-  DBUG_ASSERT(m_buf != nullptr);
+  DBUG_ASSERT(m_buf != RDB_NULL_TIMER);
 
   const std::string fname = dirname + FN_DIRSEP + RDB_IO_DUMMY_FILE_NAME;
 
   // O_DIRECT is a key flag here to make sure that we'll bypass the kernel's
   // buffer cache.
+  #ifdef __GNU__
+  int fd = open(fname.c_str(), O_WRONLY | O_CREAT | O_SYNC,
+                S_IRWXU | S_IWUSR);
+
+  #else
   int fd = open(fname.c_str(), O_WRONLY | O_DIRECT | O_CREAT | O_SYNC,
                 S_IRWXU | S_IWUSR);
+  #endif
 
   if (unlikely(fd == -1)) {
     return fd;
@@ -187,13 +193,13 @@ int Rdb_io_watchdog::reset_timeout(const uint32_t write_timeout) {
                        RDB_IO_WRITE_BUFFER_SIZE, RDB_IO_WRITE_BUFFER_SIZE);
 
   if (unlikely(ret)) {
-    m_buf = nullptr;
+    m_buf = RDB_NULL_TIMER;
     RDB_MUTEX_UNLOCK_CHECK(m_reset_mutex);
     // NB! The value of errno is not set.
     return ret;
   }
 
-  DBUG_ASSERT(m_buf != nullptr);
+  DBUG_ASSERT(m_buf != RDB_NULL_TIMER);
   memset(m_buf, 0, RDB_IO_WRITE_BUFFER_SIZE);
 
   // Common case gets handled here - we'll create a timer with a specific
@@ -203,7 +209,7 @@ int Rdb_io_watchdog::reset_timeout(const uint32_t write_timeout) {
   e.sigev_notify = SIGEV_THREAD;
   e.sigev_notify_function = &Rdb_io_watchdog::io_check_callback_wrapper;
   e.sigev_value.sival_ptr = this;
-  e.sigev_notify_attributes = nullptr;
+  e.sigev_notify_attributes = RDB_NULL_TIMER;
 
   ret = timer_create(CLOCK_MONOTONIC, &e, &m_io_check_timer);
 
@@ -221,7 +227,7 @@ int Rdb_io_watchdog::reset_timeout(const uint32_t write_timeout) {
   timer_spec.it_value.tv_sec = m_write_timeout;
   timer_spec.it_interval.tv_sec = m_write_timeout;
 
-  ret = timer_settime(m_io_check_timer, 0, &timer_spec, nullptr);
+  ret = timer_settime(m_io_check_timer, 0, &timer_spec, RDB_NULL_TIMER);
 
   if (unlikely(ret)) {
     // NO_LINT_DEBUG
diff --git a/storage/rocksdb/rdb_io_watchdog.h b/storage/rocksdb/rdb_io_watchdog.h
index 8ee5b1f6..3f889f42 100644
--- a/storage/rocksdb/rdb_io_watchdog.h
+++ b/storage/rocksdb/rdb_io_watchdog.h
@@ -32,6 +32,12 @@
 /* MyRocks header files */
 #include "./rdb_utils.h"
 
+#ifdef __GNU__
+#define RDB_NULL_TIMER ((timer_t)0)
+#else
+#define RDB_NULL_TIMER nullptr
+#endif
+
 namespace myrocks {
 
 // Rdb_io_watchdog does not support Windows ATM.
@@ -60,7 +66,7 @@ class Rdb_io_watchdog {
       ret = timer_delete(m_io_check_watchdog_timer);
 
       if (!ret) {
-        m_io_check_watchdog_timer = nullptr;
+        m_io_check_watchdog_timer = RDB_NULL_TIMER;
       }
     }
 
@@ -68,7 +74,7 @@ class Rdb_io_watchdog {
       ret = timer_delete(m_io_check_timer);
 
       if (!ret) {
-        m_io_check_timer = nullptr;
+        m_io_check_timer = RDB_NULL_TIMER;
       }
     }
 
@@ -78,7 +84,7 @@ class Rdb_io_watchdog {
   static void io_check_callback_wrapper(union sigval timer_data) {
     Rdb_io_watchdog *io_watchdog =
         static_cast<Rdb_io_watchdog *>(timer_data.sival_ptr);
-    DBUG_ASSERT(io_watchdog != nullptr);
+    DBUG_ASSERT(io_watchdog != RDB_NULL_TIMER);
 
     io_watchdog->io_check_callback(timer_data);
   }
@@ -86,18 +92,18 @@ class Rdb_io_watchdog {
   static void expire_io_callback_wrapper(union sigval timer_data) {
     Rdb_io_watchdog *io_watchdog =
         static_cast<Rdb_io_watchdog *>(timer_data.sival_ptr);
-    DBUG_ASSERT(io_watchdog != nullptr);
+    DBUG_ASSERT(io_watchdog != RDB_NULL_TIMER);
 
     io_watchdog->expire_io_callback(timer_data);
   }
 
  public:
   explicit Rdb_io_watchdog(std::vector<std::string> &&directories)
-      : m_io_check_timer(nullptr),
-        m_io_check_watchdog_timer(nullptr),
+      : m_io_check_timer(RDB_NULL_TIMER),
+        m_io_check_watchdog_timer(RDB_NULL_TIMER),
         m_io_in_progress(false),
         m_dirs_to_check(std::move(directories)),
-        m_buf(nullptr) {
+        m_buf(RDB_NULL_TIMER) {
     DBUG_ASSERT(m_dirs_to_check.size() > 0);
     mysql_mutex_init(0, &m_reset_mutex, MY_MUTEX_INIT_FAST);
   }
-- 
2.51.0


Reply to: