fix: FreeBSD compilation errors (issue #174) #176
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes the FreeBSD compilation errors reported in issue #174.
Problems Fixed
1. Missing semaphore implementation for FreeBSD
Error:
semaphore.cpp:69:5: error: no member named 'sync' in namespace 'ipc::detail'Cause: The conditional compilation in
semaphore.cpphad an empty branch forLIBIPC_OS_FREEBSD, sosemaphore_impl.hwas not included.Fix: Include
posix/semaphore_impl.hfor FreeBSD since it supports POSIX semaphore APIs.2. Missing LIBIPC_LOG() macro calls
Error:
mutex.h:130:13: error: unexpected namespace name 'log': expected expressionCause: Several functions used the
logvariable (created byLIBIPC_LOG()macro) without first calling the macro. The compiler then interpretedlogas theipc::lognamespace instead of a variable.Fix:
LIBIPC_LOG()calls at the beginning of affected functions&logwhere neededChanges
src/libipc/sync/semaphore.cpp: Includesemaphore_impl.hfor FreeBSDsrc/libipc/platform/posix/mutex.h: AddLIBIPC_LOG()toopen()andtry_lock(); fix lambda captures inclose()andclear()src/libipc/platform/posix/condition.h: AddLIBIPC_LOG()toclear(),notify(), andbroadcast()Testing
These changes fix the compilation errors on FreeBSD platform as reported in the build log.
Closes #174