Skip to content

Haiku: Fix native component build#126701

Merged
jkoritzinsky merged 2 commits intodotnet:mainfrom
trungnt2910:dev/trungnt2910/haiku-native-libs-build
Apr 28, 2026
Merged

Haiku: Fix native component build#126701
jkoritzinsky merged 2 commits intodotnet:mainfrom
trungnt2910:dev/trungnt2910/haiku-native-libs-build

Conversation

@trungnt2910
Copy link
Copy Markdown
Contributor

This contains the missing configuration updates required to build the native component for Haiku with the latest .NET source.

Part of #55803.

Copilot AI review requested due to automatic review settings April 9, 2026 11:50
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Apr 9, 2026
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates native build configuration to improve compatibility with Haiku when building dotnet/runtime native components, primarily by feature-detecting pthread robust-mutex APIs and adjusting Haiku linker behavior in CMake.

Changes:

  • Add CMake feature checks for pthread_mutex_consistent and pthread_mutexattr_setrobust, and expose them via pal_config.h.
  • Conditionally compile robust-mutex initialization and recovery paths in pal_crossprocessmutex.c based on those feature macros.
  • Adjust Haiku CMake linker-group settings as a workaround for missing upstream CMake support.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/native/libs/System.Native/pal_crossprocessmutex.c Guard robust mutex attr usage and EOWNERDEAD recovery logic behind feature macros.
src/native/libs/configure.cmake Add configure-time detection for robust-mutex related pthread APIs.
src/native/libs/Common/pal_config.h.in Export new HAVE_PTHREAD_MUTEX_* feature macros to native builds.
eng/native/configurecompiler.cmake Set Haiku linker-group rescan settings and adjust Haiku linker flags.

Comment thread src/native/libs/System.Native/pal_crossprocessmutex.c
Comment thread src/native/libs/System.Native/pal_crossprocessmutex.c Outdated
Comment thread src/native/libs/System.Native/CMakeLists.txt Outdated
Copilot AI review requested due to automatic review settings April 14, 2026 08:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment thread eng/native/configurecompiler.cmake
Comment thread src/native/libs/System.Native/CMakeLists.txt Outdated
@am11
Copy link
Copy Markdown
Member

am11 commented Apr 24, 2026

No problem, I can take a look after this round of PRs are in. I was under the impression that the Haiku’s llvm port is in progress. We can also use llvm’s libc++ (instead of GNU’s libstdc++) these days using -p: TargetCxxStandardLibrary=libc++ etc. to keep build solely rely on llvm-toolchain.

Comment thread eng/native/configurecompiler.cmake
Copilot AI review requested due to automatic review settings April 24, 2026 14:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment thread eng/native/configurecompiler.cmake
Comment thread eng/native/configurecompiler.cmake
Comment thread eng/native/configurecompiler.cmake
@am11
Copy link
Copy Markdown
Member

am11 commented Apr 25, 2026

@jkoritzinsky, this one. is also ready. (needed to actually build runtime repo for Haiku)

This contains the missing configuration updates required to build the
native component for Haiku with the latest .NET source.
Comment thread src/native/libs/System.Native/CMakeLists.txt Outdated
@trungnt2910
Copy link
Copy Markdown
Contributor Author

For documentation purposes:

Haiku does not support robust mutexes: https://dev.haiku-os.org/ticket/20033
There is a WIP attempt to implement this API: https://review.haiku-os.org/c/haiku/+/10707, but it does not work due to lack of kernel-mode support for unlocking mutexes when the owner process dies.

Copilot AI review requested due to automatic review settings April 28, 2026 10:29
Seems like the priority is runtime code size, not portability.

Reverted the cross-process mutex implementation choice to a OS-based
list instead of a dynamic configure-time check.

Also tell the managed counterpart that Haiku does not support this
feature to prevent future issues.
@trungnt2910 trungnt2910 force-pushed the dev/trungnt2910/haiku-native-libs-build branch from 5f29a8b to 4d24579 Compare April 28, 2026 10:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@jkoritzinsky
Copy link
Copy Markdown
Member

/ba-g ios infra failure unrelated

@jkoritzinsky jkoritzinsky merged commit e7cf08e into dotnet:main Apr 28, 2026
170 of 178 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Infrastructure community-contribution Indicates that the PR has been added by a community member os-haiku

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants