fakecgo: use libthr.so.3 instead of libpthread.so on FreeBSD#481
Merged
Conversation
Member
|
Resolve the conflicts |
FreeBSD 15 removed the libpthread.so compatibility symlink to libthr.so from base. This caused Go binaries built with CGO_ENABLED=0 using purego's FreeBSD fakecgo path to have an unresolvable NEEDED entry for libpthread.so. libthr.so.3 is FreeBSD's actual threading implementation and has been present since at least FreeBSD 12.x. Updated gen.go and regenerated zsymbols_freebsd.go accordingly. Tested on FreeBSD 15.1-STABLE amd64: examples/libc builds and runs correctly with CGO_ENABLED=0, and readelf confirms the binary now links against libthr.so.3 instead of libpthread.so.
rcina
force-pushed
the
fix-freebsd-libpthread
branch
from
July 18, 2026 13:02
853a2cd to
77319b6
Compare
Contributor
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
Files not reviewed (2)
- internal/fakecgo/gen.go: Generated file
- internal/fakecgo/zsymbols_freebsd.go: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Author
|
Yes, I'd really appreciate that — a stable-branch cherry-pick would let |
Member
Is this a reply for the original issue? |
7 tasks
hajimehoshi
pushed a commit
that referenced
this pull request
Jul 18, 2026
…#481) FreeBSD 15 removed the libpthread.so compatibility symlink to libthr.so from base. This caused Go binaries built with CGO_ENABLED=0 using purego's FreeBSD fakecgo path to have an unresolvable NEEDED entry for libpthread.so. libthr.so.3 is FreeBSD's actual threading implementation and has been present since at least FreeBSD 12.x. Updated gen.go and regenerated zsymbols_freebsd.go accordingly. Tested on FreeBSD 15.1-STABLE amd64: examples/libc builds and runs correctly with CGO_ENABLED=0, and readelf confirms the binary now links against libthr.so.3 instead of libpthread.so. Closes #480
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What issue is this addressing?
Closes #480
What type of issue is this addressing?
bug
What this PR does | solves
FreeBSD 15 removed the libpthread.so compatibility symlink (historically
a symlink to libthr.so) from base. This left any Go binary built with
CGO_ENABLED=0 using purego's FreeBSD fakecgo path with an unresolvable
NEEDED entry for libpthread.so, since it no longer exists anywhere on
FreeBSD 15+.
This change updates gen.go to target libthr.so.3 — FreeBSD's actual
threading implementation, present since at least FreeBSD 12.x — instead
of libpthread.so, and regenerates zsymbols_freebsd.go accordingly via
go generate.
Tested on FreeBSD 15.1-STABLE amd64:
I haven't touched netbsd's zsymbols (same libpthread.so string appears
there too) since I don't have a NetBSD system to verify the correct
replacement library name — flagging that as a possible follow-up if
maintainers know the right target.