Skip to content

Port library to GNU Hurd. - #5293

Merged
matejk merged 1 commit into
pocoproject:mainfrom
petterreinholdtsen:gnu-hurd-support
Apr 8, 2026
Merged

Port library to GNU Hurd.#5293
matejk merged 1 commit into
pocoproject:mainfrom
petterreinholdtsen:gnu-hurd-support

Conversation

@petterreinholdtsen

Copy link
Copy Markdown

Recognize using the gnu_hurd preprosessor macro and adjust to pick correct posix thread naming operations and sendfile() method.

The build was done using Debian Sid and GCC 15. I suspect the quill related changes are required by GCC 15, and not GNU Hurd specific.

@matejk matejk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on GNU Hurd support! The POCO-specific changes (Platform.h, Types.h, Thread_POSIX.cpp, SocketImpl.cpp) look correct. However, the quill changes need to be dropped from this PR.

POCO changes (looks good)

  • Platform.h: POCO_OS_GNU_HURD detection and placement is correct.
  • Types.h: Adding Hurd to POCO_INT64_IS_LONG is correct for glibc LP64.
  • Thread_POSIX.cpp: Grouping with FreeBSD for pthread_setname_np/pthread_getname_np is the right approach — the #else fallback uses prctl() which is Linux-specific and unavailable on Hurd.
  • SocketImpl.cpp: Routing to Linux-compatible sendfile() and excluding sendfile64 is correct for Hurd's glibc.

Quill changes (please remove)

These modify vendored third-party code and should not be part of this PR:

  1. ThreadUtilities.h: static_cast change is a regression. The change from reinterpret_cast<uintptr_t>(pthread_self()) to static_cast<uintptr_t>(pthread_self()) will break compilation on platforms where pthread_t is a pointer type (e.g., musl libc). static_cast from pointer to integer is ill-formed in C++ — only reinterpret_cast is valid there. The original code is the correct portable choice.

  2. BackendWorkerLock.h: (sem_t*)SEM_FAILED casts are unnecessary. SEM_FAILED is already defined as ((sem_t *) ...) on POSIX-conforming systems. These casts add noise without fixing a real issue.

We confirmed that GCC 15 on Ubuntu (Questing) compiles the existing quill code without issues, so these changes are not required. If there is a Hurd-specific compiler issue with quill, that should be reported and fixed upstream in the quill project.

Could you please drop the two quill file changes and resubmit with only the POCO platform files?

Comment thread dependencies/quill/include/quill/backend/BackendWorkerLock.h Outdated
Comment thread Net/src/SocketImpl.cpp
Recognize using the __gnu_hurd__ preprosessor macro and adjust to
pick correct posix thread naming operations and sendfile() method.
@petterreinholdtsen

Copy link
Copy Markdown
Author

I adjusted the pull request to drop the quill related stuff, and expect the quill part to be handled separately.

petterreinholdtsen pushed a commit to petterreinholdtsen/poco that referenced this pull request Apr 6, 2026
Fixes the following compiler errors:

[  7%] Building CXX object Foundation/CMakeFiles/Foundation.dir/src/FastLogger.cpp.o
In file included from /home/pere/src/poco-upstream/dependencies/quill/include/quill/backend/BackendWorker.h:15,
                 from /home/pere/src/poco-upstream/dependencies/quill/include/quill/backend/BackendManager.h:10,
                 from /home/pere/src/poco-upstream/dependencies/quill/include/quill/Backend.h:9,
                 from /home/pere/src/poco-upstream/Foundation/src/FastLogger.cpp:56:
/home/pere/src/poco-upstream/dependencies/quill/include/quill/backend/BackendWorkerLock.h:134:25: error: invalid conversion from 'void*' to 'sem_t*' [-fpermissive]
  134 |   sem_t* _sem{SEM_FAILED};
      |                         ^
      |                         |
      |                         void*
In file included from /usr/include/semaphore.h:28,
                 from /usr/include/c++/15/bits/semaphore_base.h:47,
                 from /usr/include/c++/15/semaphore:39,
                 from /usr/include/c++/15/stop_token:42,
                 from /usr/include/c++/15/thread:44,
                 from /home/pere/src/poco-upstream/Foundation/include/Poco/Mutex.h:26,
                 from /home/pere/src/poco-upstream/Foundation/include/Poco/Channel.h:23,
                 from /home/pere/src/poco-upstream/Foundation/include/Poco/FastLogger.h:27,
                 from /home/pere/src/poco-upstream/Foundation/src/FastLogger.cpp:22:
/home/pere/src/poco-upstream/dependencies/quill/include/quill/backend/BackendWorkerLock.h: In destructor 'quill::v11::detail::BackendWorkerLock::~BackendWorkerLock()':
/home/pere/src/poco-upstream/dependencies/quill/include/quill/backend/BackendWorkerLock.h:121:14: error: invalid conversion from 'void*' to 'sem_t*' [-fpermissive]
  121 |       _sem = SEM_FAILED;
      |              ^~~~~~~~~~
      |              |
      |              void*
In file included from /home/pere/src/poco-upstream/dependencies/quill/include/quill/backend/BackendWorker.h:19:
/home/pere/src/poco-upstream/dependencies/quill/include/quill/backend/ThreadUtilities.h: In function 'uint32_t quill::v11::detail::get_thread_id()':
/home/pere/src/poco-upstream/dependencies/quill/include/quill/backend/ThreadUtilities.h:217:10: error: invalid cast from type 'pthread_t' {aka 'long int'} to type 'uintptr_t' {aka 'long unsigned int'}
  217 |   return reinterpret_cast<uintptr_t>(pthread_self()); // (Ab)use pthread_self as a last resort option
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Note, the SEM_FAILED issue is actually a problem with glibc on Hurd and will be fixed there, see pocoproject#5293.
petterreinholdtsen pushed a commit to petterreinholdtsen/poco that referenced this pull request Apr 6, 2026
Fixes the following compiler errors:

[  7%] Building CXX object Foundation/CMakeFiles/Foundation.dir/src/FastLogger.cpp.o
In file included from /home/pere/src/poco-upstream/dependencies/quill/include/quill/backend/BackendWorker.h:15,
                 from /home/pere/src/poco-upstream/dependencies/quill/include/quill/backend/BackendManager.h:10,
                 from /home/pere/src/poco-upstream/dependencies/quill/include/quill/Backend.h:9,
                 from /home/pere/src/poco-upstream/Foundation/src/FastLogger.cpp:56:
/home/pere/src/poco-upstream/dependencies/quill/include/quill/backend/BackendWorkerLock.h:134:25: error: invalid conversion from 'void*' to 'sem_t*' [-fpermissive]
  134 |   sem_t* _sem{SEM_FAILED};
      |                         ^
      |                         |
      |                         void*
In file included from /usr/include/semaphore.h:28,
                 from /usr/include/c++/15/bits/semaphore_base.h:47,
                 from /usr/include/c++/15/semaphore:39,
                 from /usr/include/c++/15/stop_token:42,
                 from /usr/include/c++/15/thread:44,
                 from /home/pere/src/poco-upstream/Foundation/include/Poco/Mutex.h:26,
                 from /home/pere/src/poco-upstream/Foundation/include/Poco/Channel.h:23,
                 from /home/pere/src/poco-upstream/Foundation/include/Poco/FastLogger.h:27,
                 from /home/pere/src/poco-upstream/Foundation/src/FastLogger.cpp:22:
/home/pere/src/poco-upstream/dependencies/quill/include/quill/backend/BackendWorkerLock.h: In destructor 'quill::v11::detail::BackendWorkerLock::~BackendWorkerLock()':
/home/pere/src/poco-upstream/dependencies/quill/include/quill/backend/BackendWorkerLock.h:121:14: error: invalid conversion from 'void*' to 'sem_t*' [-fpermissive]
  121 |       _sem = SEM_FAILED;
      |              ^~~~~~~~~~
      |              |
      |              void*
In file included from /home/pere/src/poco-upstream/dependencies/quill/include/quill/backend/BackendWorker.h:19:
/home/pere/src/poco-upstream/dependencies/quill/include/quill/backend/ThreadUtilities.h: In function 'uint32_t quill::v11::detail::get_thread_id()':
/home/pere/src/poco-upstream/dependencies/quill/include/quill/backend/ThreadUtilities.h:217:10: error: invalid cast from type 'pthread_t' {aka 'long int'} to type 'uintptr_t' {aka 'long unsigned int'}
  217 |   return reinterpret_cast<uintptr_t>(pthread_self()); // (Ab)use pthread_self as a last resort option
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Note, the SEM_FAILED issue is actually a problem with glibc on Hurd and will be fixed there, see pocoproject#5293.
@matejk matejk added this to the Release 1.15.2 milestone Apr 8, 2026
@matejk
matejk merged commit b17d4d8 into pocoproject:main Apr 8, 2026
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants