Skip to content

Conversation

@genspark-ai-developer
Copy link

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.cpp had an empty branch for LIBIPC_OS_FREEBSD, so semaphore_impl.h was not included.

Fix: Include posix/semaphore_impl.h for FreeBSD since it supports POSIX semaphore APIs.

2. Missing LIBIPC_LOG() macro calls

Error: mutex.h:130:13: error: unexpected namespace name 'log': expected expression

Cause: Several functions used the log variable (created by LIBIPC_LOG() macro) without first calling the macro. The compiler then interpreted log as the ipc::log namespace instead of a variable.

Fix:

  • Added LIBIPC_LOG() calls at the beginning of affected functions
  • Fixed lambda captures to include &log where needed

Changes

  • src/libipc/sync/semaphore.cpp: Include semaphore_impl.h for FreeBSD
  • src/libipc/platform/posix/mutex.h: Add LIBIPC_LOG() to open() and try_lock(); fix lambda captures in close() and clear()
  • src/libipc/platform/posix/condition.h: Add LIBIPC_LOG() to clear(), notify(), and broadcast()

Testing

These changes fix the compilation errors on FreeBSD platform as reported in the build log.

Closes #174

mutouyun added 2 commits January 29, 2026 03:20
Fix issue #174: FreeBSD was excluded from including the POSIX semaphore
implementation header. The previous conditional compilation had an empty
branch for LIBIPC_OS_FREEBSD, causing 'no member named sync in namespace
ipc::detail' errors.

FreeBSD supports POSIX semaphore APIs (sem_open, sem_wait, sem_post, etc.),
so it should use the same semaphore_impl.h as Linux and QNX.
Fix issue #174: Several functions in mutex.h and condition.h were using
the 'log' variable without first calling LIBIPC_LOG() macro, which
defines the 'log' variable. This caused FreeBSD compiler errors like
'unexpected namespace name log: expected expression'.

Changes in mutex.h:
- Add LIBIPC_LOG() at the beginning of open()
- Add LIBIPC_LOG() at the beginning of try_lock()
- Fix lambda capture in close() to include '&log'
- Fix lambda capture in clear() to include '&log'

Changes in condition.h:
- Add LIBIPC_LOG() at the beginning of clear()
- Add LIBIPC_LOG() at the beginning of notify()
- Add LIBIPC_LOG() at the beginning of broadcast()
@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.20%. Comparing base (f7a1812) to head (8b1dca8).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #176      +/-   ##
==========================================
- Coverage   75.33%   75.20%   -0.13%     
==========================================
  Files          68       68              
  Lines        4265     4263       -2     
  Branches      470      470              
==========================================
- Hits         3213     3206       -7     
- Misses        846      849       +3     
- Partials      206      208       +2     
Files with missing lines Coverage Δ
src/libipc/sync/semaphore.cpp 90.00% <ø> (ø)

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cscd98
Copy link
Contributor

cscd98 commented Jan 29, 2026

Yes this fixes the compiler failure thank you 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

freebsd compiler error: semaphore.cpp:69:5: error: no member named 'sync' in namespace 'ipc::detail'

2 participants