Port library to GNU Hurd. - #5293
Conversation
528107f to
3cae5c0
Compare
matejk
left a comment
There was a problem hiding this comment.
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_HURDdetection and placement is correct. - Types.h: Adding Hurd to
POCO_INT64_IS_LONGis correct for glibc LP64. - Thread_POSIX.cpp: Grouping with FreeBSD for
pthread_setname_np/pthread_getname_npis the right approach — the#elsefallback usesprctl()which is Linux-specific and unavailable on Hurd. - SocketImpl.cpp: Routing to Linux-compatible
sendfile()and excludingsendfile64is correct for Hurd's glibc.
Quill changes (please remove)
These modify vendored third-party code and should not be part of this PR:
-
ThreadUtilities.h:
static_castchange is a regression. The change fromreinterpret_cast<uintptr_t>(pthread_self())tostatic_cast<uintptr_t>(pthread_self())will break compilation on platforms wherepthread_tis a pointer type (e.g., musl libc).static_castfrom pointer to integer is ill-formed in C++ — onlyreinterpret_castis valid there. The original code is the correct portable choice. -
BackendWorkerLock.h:
(sem_t*)SEM_FAILEDcasts are unnecessary.SEM_FAILEDis 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?
Recognize using the __gnu_hurd__ preprosessor macro and adjust to pick correct posix thread naming operations and sendfile() method.
3cae5c0 to
ec3cb3b
Compare
|
I adjusted the pull request to drop the quill related stuff, and expect the quill part to be handled separately. |
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.
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.
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.