Skip to content

Add OpenBSD support for ICU library loading#129124

Open
am11 wants to merge 3 commits into
dotnet:mainfrom
am11:feature/port/openbsd-libs-loading
Open

Add OpenBSD support for ICU library loading#129124
am11 wants to merge 3 commits into
dotnet:mainfrom
am11:feature/port/openbsd-libs-loading

Conversation

@am11
Copy link
Copy Markdown
Member

@am11 am11 commented Jun 8, 2026

OpenBSD uses ABI versioning in SONAME rather than ICU version numbering. Use unversioned dlopen calls and probe symbol versioning instead of attempting to load versioned library names.

Contributes to #124911.

OpenBSD uses ABI versioning in SONAME rather than ICU version numbering.
Use unversioned dlopen calls and probe symbol versioning instead of
attempting to load versioned library names.
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Jun 8, 2026
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

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

.
Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com>
@am11 am11 added the os-openbsd OpenBSD OS, currently not officially supported label Jun 8, 2026
@am11
Copy link
Copy Markdown
Member Author

am11 commented Jun 8, 2026

Hello world was working with the override:

am11@foo:~$ DOTNET_ICU_VERSION_OVERRIDE=22 th/artifacts/bin/testhost/net11.0-openbsd-Debug-x64/dotnet exec ~/projects/hw1/hw1/bin/Debug/net11.0/hw1.dll

Hello, World!
Environment.Version: 11.0.0
RuntimeInformation.OSDescription: OpenBSD 7.8 GENERIC.MP#54

This makes it work without.

@tarekgh
Copy link
Copy Markdown
Member

tarekgh commented Jun 8, 2026

Two important caveats this PR introduces

  1. The manually installed ICU must be built --disable-renaming. The OpenBSD path calls FindSymbolVersion(-1, -1, -1, ...), which only matches the unversioned u_strlen. If you drop in a stock upstream ICU build (renaming enabled → u_strlen_78), dlopen succeeds but symbol resolution returns false and ICU fails to load. So a "more recent ICU" has to be packaged the OpenBSD way (unversioned symbols), not a vanilla ./configure && make build.

  2. DOTNET_ICU_VERSION_OVERRIDE no longer works on OpenBSD after this PR. This is the subtle one. FindLibUsingOverride (which reads DOTNET_ICU_VERSION_OVERRIDE) lives only in the #else generic-Unix branch (lines 332-432). The new OpenBSD #elif branch never calls it. Pre-PR, OpenBSD fell through to #else, which is exactly why the author's DOTNET_ICU_VERSION_OVERRIDE=22 workaround worked. Post-PR, that env var is silently ignored on OpenBSD. So the one knob that let you force a particular major version on the Linux path is gone for OpenBSD — you'd have to use LD_LIBRARY_PATH or app-local ICU instead.

@am11
Copy link
Copy Markdown
Member Author

am11 commented Jun 8, 2026

@tarekgh, I think it’s fine to make it work with OpenBSD packaging convention in a standard install just like we have for Android (at least for the bringup). Unlike some other desktop OS, OpenBSD seem to have one package version at a time policy, pkg_info -Q icu4c reports a single v77 option, same with other packages.

If someone wants to use .NET with a custom build of ICU, they can use LD_LIBRARY_PATH or symlink type of mechanism to prioritize their copy. So far there is no use case for overriding and I intentionally left it out because it looks weird to use DOTNET_ICU_VERSION_OVERRIDE=22 because this env var refers to API/packaging version on Linux, FreeBSD and Solaris and we are supporting v60 onwards; while OpenBSD is using ABI versions in SONAME part.

@tarekgh
Copy link
Copy Markdown
Member

tarekgh commented Jun 8, 2026

If someone wants to use .NET with a custom build of ICU, they can use LD_LIBRARY_PATH or symlink type of mechanism to prioritize their copy. So far there is no use case for overriding and I intentionally left it out because it looks weird to use DOTNET_ICU_VERSION_OVERRIDE=22 because this env var refers to API/packaging version on Linux, FreeBSD and Solaris and we are supporting v60 onwards; while OpenBSD is using ABI versions in SONAME part.

I am not objecting, I am just pointing out OpenBSD will be kind of special case. At least we should document the new behavior in https://learn.microsoft.com/en-us/dotnet/core/extensions/globalization-icu for completeness.

Copy link
Copy Markdown
Member

@tarekgh tarekgh left a comment

Choose a reason for hiding this comment

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

CC @jkotas and @janvorli if they have feedback too.

@tarekgh tarekgh added this to the 11.0.0 milestone Jun 8, 2026
Copy link
Copy Markdown
Member

@janvorli janvorli left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

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

Labels

area-System.Globalization community-contribution Indicates that the PR has been added by a community member os-openbsd OpenBSD OS, currently not officially supported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants