fix(linux): link libpthread alongside mimalloc.o#6435
Merged
FeodorFitsner merged 2 commits intorelease/v0.85.0from Apr 23, 2026
Merged
fix(linux): link libpthread alongside mimalloc.o#6435FeodorFitsner merged 2 commits intorelease/v0.85.0from
FeodorFitsner merged 2 commits intorelease/v0.85.0from
Conversation
Flutter's build UI swallows the actual ld stderr, leaving only a bare "clang: error: linker command failed with exit code 1" in CI logs. Temporary instrumentation to reveal what's failing: - flutter build linux --verbose to propagate cmake/ld output. - message(NOTICE ...) to dump MIMALLOC_LIB value and existence check. - LINKER:--verbose to emit ld's full invocation and error detail. To be reverted once the root cause is pinned down.
The Linux client has been failing to link on every distro since mimalloc was actually wired up (#6416): `mimalloc.o` references `pthread_setspecific` but `ld --as-needed` (default on Ubuntu 20.04+) won't pull `libpthread` in transitively through other DSOs, so the final link aborts with: undefined reference to symbol 'pthread_setspecific@@GLIBC_2.2.5' libpthread.so.0: error adding symbols: DSO missing from command line Pair the mimalloc link with `Threads::Threads` so libpthread is explicitly on the link line. Applied to both the client `CMakeLists.txt` and the `flet build linux` build template so end users don't hit this. Also revert the temporary diagnostic instrumentation added to surface the real linker error.
Deploying flet-examples with
|
| Latest commit: |
84d6433
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://df6fbe50.flet-examples.pages.dev |
| Branch Preview URL: | https://diag-mimalloc-ld.flet-examples.pages.dev |
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.
Summary
mimalloc.ousespthread_setspecific; withld --as-needed(default on Ubuntu 20.04+), libpthread won't be pulled in transitively and the final link aborts withundefined reference to symbol 'pthread_setspecific@@GLIBC_2.2.5'/libpthread.so.0: error adding symbols: DSO missing from command line.Threads::Threadsin both client/linux/CMakeLists.txt and theflet build linuxtemplate so libpthread is explicitly on the link line.Investigation
Flutter's build UI swallows
ldstderr, leaving only a bareclang: error: linker command failed with exit code 1in CI. I pushed a temporary diagnostic commit (reverted in this branch) that addedflutter build linux --verbose,LINKER:--verbose, andmessage(NOTICE ...)dumps forMIMALLOC_LIB. The diagnostic run (https://github.com/flet-dev/flet/actions/runs/24813135717) confirmed the undefined-symbol failure.Test plan
Summary by Sourcery
Ensure Linux client binaries explicitly link pthread when mimalloc is enabled to fix linker failures on modern distributions.
Build: