Skip to content

fix: add $(PTHREAD_FLAGS) to dash_util_LDFLAGS#7077

Merged
PastaPastaPasta merged 1 commit into
dashpay:developfrom
kwvg:fix_ldflags_guix
Dec 21, 2025
Merged

fix: add $(PTHREAD_FLAGS) to dash_util_LDFLAGS#7077
PastaPastaPasta merged 1 commit into
dashpay:developfrom
kwvg:fix_ldflags_guix

Conversation

@kwvg
Copy link
Copy Markdown
Collaborator

@kwvg kwvg commented Dec 20, 2025

Motivation

Resolving a regression in Guix builds (see below)

  AR       libtest_util.a
x86_64-linux-gnu-ld: dash_util-bitcoin-util.o: in function `std::thread::thread<void (&)(unsigned int, CBlockHeader&, unsigned int, unsigned int, std::atomic<bool>&), unsigned int&, std::reference_wrapper<CBlockHeader>, int&, int&, std::reference_wrapper<std::atomic<bool> >, void>(void (&)(unsigned int, CBlockHeader&, unsigned int, unsigned int, std::atomic<bool>&), unsigned int&, std::reference_wrapper<CBlockHeader>&&, int&, int&, std::reference_wrapper<std::atomic<bool> >&&)':
/usr/include/c++/bits/std_thread.h:163:(.text._ZNSt6vectorISt6threadSaIS0_EE17_M_realloc_insertIJRFvjR12CBlockHeaderjjRSt6atomicIbEERjSt17reference_wrapperIS4_ERiSE_SC_IS7_EEEEvN9__gnu_cxx17__normal_iteratorIPS0_S2_EEDpOT_[_ZNSt6vectorISt6threadSaIS0_EE17_M_realloc_insertIJRFvjR12CBlockHeaderjjRSt6atomicIbEERjSt17reference_wrapperIS4_ERiSE_SC_IS7_EEEEvN9__gnu_cxx17__normal_iteratorIPS0_S2_EEDpOT_]+0x103): undefined reference to `pthread_create'
x86_64-linux-gnu-ld: /usr/include/c++/bits/std_thread.h:163:(.text.startup+0x573): undefined reference to `pthread_create'
  CXXLD    test/test_dash
x86_64-linux-gnu-ld: /gnu/store/dxk5rbssn95i797xzxycj1vzzmhw5r1b-gcc-cross-x86_64-linux-gnu-12.4.0-lib/lib/gcc/x86_64-linux-gnu/12.4.0/../../../../x86_64-linux-gnu/lib/../lib64/libstdc++.a(thread.o): in function `std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)())':
(.text._ZNSt6thread15_M_start_threadESt10unique_ptrINS_6_StateESt14default_deleteIS1_EEPFvvE+0x28): undefined reference to `pthread_create'
x86_64-linux-gnu-ld: /gnu/store/dxk5rbssn95i797xzxycj1vzzmhw5r1b-gcc-cross-x86_64-linux-gnu-12.4.0-lib/lib/gcc/x86_64-linux-gnu/12.4.0/../../../../x86_64-linux-gnu/lib/../lib64/libstdc++.a(thread.o): in function `std::thread::_M_start_thread(std::shared_ptr<std::thread::_Impl_base>, void (*)())':
(.text._ZNSt6thread15_M_start_threadESt10shared_ptrINS_10_Impl_baseEEPFvvE+0x6f): undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:8039: dash-util] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/distsrc-base/distsrc-23.0.2-844-g6fbe514262c1-x86_64-linux-gnu/src'
make[1]: *** [Makefile:21926: all-recursive] Error 1
make[1]: Leaving directory '/distsrc-base/distsrc-23.0.2-844-g6fbe514262c1-x86_64-linux-gnu/src'
make: *** [Makefile:804: all-recursive] Error 1

Breaking Changes

None expected.

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas (note: N/A)
  • I have added or updated relevant unit/integration/functional/e2e tests (note: N/A)
  • I have made corresponding changes to the documentation (note: N/A)
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

@kwvg kwvg added this to the 23.1 milestone Dec 20, 2025
@github-actions
Copy link
Copy Markdown

✅ No Merge Conflicts Detected

This PR currently has no conflicts with other open PRs.

@DashCoreAutoGuix
Copy link
Copy Markdown

Guix Automation has began to build this PR tagged as v23.0.2-devpr7077.f8d5c004. A new comment will be made when the image is pushed.

@DashCoreAutoGuix
Copy link
Copy Markdown

Guix Automation has completed; a release should be present here: https://github.com/dashpay/dash-dev-branches/releases/tag/v23.0.2-devpr7077.f8d5c004. The image should be on dockerhub soon.

@kwvg
Copy link
Copy Markdown
Collaborator Author

kwvg commented Dec 20, 2025

Checksums for f8d5c00

f3f574161b9dfff29b6064bd08fbd1eb5b054efd9eb597550dd7882a4dfd4e7b  dashcore-23.0.2-880-gf8d5c004c627-aarch64-linux-gnu-debug.tar.gz
fe89177f372863ef31dc2d9387aaf5d4d557e82906e86ee269c78ab25361c3c4  dashcore-23.0.2-880-gf8d5c004c627-aarch64-linux-gnu.tar.gz
5bd4b3d15148e8a064667a1bb2459e6687fff0b29c22374cdc9f9c1ca791856e  dashcore-23.0.2-880-gf8d5c004c627-arm64-apple-darwin-unsigned.tar.gz
02a7851edcc8535b25d6a0507ae668544f4830a825f3f40a8aab7025b4329383  dashcore-23.0.2-880-gf8d5c004c627-arm64-apple-darwin-unsigned.zip
190757c63d4119f7284c936b2adbd237dec8913dac14e38b9000dda4612131f3  dashcore-23.0.2-880-gf8d5c004c627-arm64-apple-darwin.tar.gz
e1d4c89e8c3f38c7921283e6fa84bec13be2637d9873d877fb5ea4cdd6dec7ee  dashcore-23.0.2-880-gf8d5c004c627.tar.gz
ca26db2e6bcaffb775baa941932d49813c813d9479879243437581da7e6ca2a8  dashcore-23.0.2-880-gf8d5c004c627-riscv64-linux-gnu-debug.tar.gz
aefd909cf43e955cca9cafae3f221539d06daa22ed76183a2bdb0b86998690f2  dashcore-23.0.2-880-gf8d5c004c627-riscv64-linux-gnu.tar.gz
c8e454b6f4168006b7717fe108027aa5adba66ce9d769a53e058a92e3592b477  dashcore-23.0.2-880-gf8d5c004c627-x86_64-apple-darwin-unsigned.tar.gz
33933e4ab2c683e67496b1c2bcfa05dccecffa911fe527c94d80a719c3fa207d  dashcore-23.0.2-880-gf8d5c004c627-x86_64-apple-darwin-unsigned.zip
5672ad9dd9fe2858a671c930cbcbb2e462722b684cbf0d64a2e77b8faa358a7e  dashcore-23.0.2-880-gf8d5c004c627-x86_64-apple-darwin.tar.gz
f835764001f917acb5443c5f6735d8457c8293cd88d92c35b8446c34b80f1f3d  dashcore-23.0.2-880-gf8d5c004c627-x86_64-linux-gnu-debug.tar.gz
ebbcaada685aaae7e131f9c1720555ec74c15898a87f291c5c7f85334cba6024  dashcore-23.0.2-880-gf8d5c004c627-x86_64-linux-gnu.tar.gz
b56b886d6ff643cf54b36b239998446386fd9c14189c50099084bf0e245a7218  dashcore-23.0.2-880-gf8d5c004c627-win64-debug.zip
6125c60526f559b7e00db1f6aa9ffde3ce755bb69e0b0ec945e97860b81d26ab  dashcore-23.0.2-880-gf8d5c004c627-win64-setup-unsigned.exe
896c060329160d08d92d40f99e65095ed30fbfa42dc7542ba457d132b9ad6112  dashcore-23.0.2-880-gf8d5c004c627-win64-unsigned.tar.gz
e56d58def5b28eef308382e1ef31bf003cf743e024a57bd997fc38d1bdcca2ca  dashcore-23.0.2-880-gf8d5c004c627-win64.zip

@kwvg kwvg marked this pull request as ready for review December 20, 2025 17:40
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 20, 2025

Walkthrough

The pull request updates the dash_util_LDFLAGS variable in src/Makefile.am to append the $(PTHREAD_FLAGS) linker flag. This change enables pthread support when linking the dash_util target, ensuring that pthread libraries and symbols are properly linked during the build process.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Single file modified with a straightforward linker flag addition
  • No logic changes or functional behavior alterations
  • Configuration-only change affecting build system

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding pthread flags to dash_util linker flags to resolve undefined pthread_create references.
Description check ✅ Passed The description is directly related to the changeset, providing clear motivation (resolving Guix build regression), build error context, and checklist confirmation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0455eb8 and f8d5c00.

📒 Files selected for processing (1)
  • src/Makefile.am (1 hunks)
🧰 Additional context used
🧠 Learnings (6)
📚 Learning: 2025-07-23T09:30:34.631Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6761
File: src/chainlock/signing.h:5-6
Timestamp: 2025-07-23T09:30:34.631Z
Learning: Dash Core uses BITCOIN_ prefix for header guards as the standard convention, inherited from Bitcoin Core. Only a few BLS-specific files in src/bls/ use DASH_ prefix. The vast majority of files (385+) use BITCOIN_ prefix.

Applied to files:

  • src/Makefile.am
📚 Learning: 2025-11-24T16:41:22.457Z
Learnt from: CR
Repo: dashpay/dash PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T16:41:22.457Z
Learning: Applies to src/{masternode,evo,llmq,governance,coinjoin}/**/*.{cpp,h} : Use Dash-specific database implementations: CFlatDB for persistent storage (MasternodeMetaStore, GovernanceStore, SporkStore, NetFulfilledRequestStore) and CDBWrapper extensions for Evolution/DKG/InstantSend/Quorum/RecoveredSigs data

Applied to files:

  • src/Makefile.am
📚 Learning: 2025-08-11T17:16:36.654Z
Learnt from: PastaPastaPasta
Repo: dashpay/dash PR: 6804
File: src/qt/proposalwizard.cpp:40-42
Timestamp: 2025-08-11T17:16:36.654Z
Learning: In the Dash repository, when a PR adds new files that are not from Bitcoin backports, these files must be added to the list in test/util/data/non-backported.txt. This applies to newly created files like qt/proposalwizard.{h,cpp} and forms/proposalwizard.ui. Limited exemptions may exist for subtrees and similar cases.

Applied to files:

  • src/Makefile.am
📚 Learning: 2025-11-24T16:41:22.457Z
Learnt from: CR
Repo: dashpay/dash PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T16:41:22.457Z
Learning: Dash extends Bitcoin Core through composition with minimal changes to the Bitcoin Core foundation

Applied to files:

  • src/Makefile.am
📚 Learning: 2025-11-24T16:41:22.457Z
Learnt from: CR
Repo: dashpay/dash PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T16:41:22.457Z
Learning: Applies to src/{masternode,llmq,evo,coinjoin,governance}/**/*.{cpp,h} : Use unordered_lru_cache for efficient caching with LRU eviction in Dash-specific data structures

Applied to files:

  • src/Makefile.am
📚 Learning: 2025-11-24T16:41:22.457Z
Learnt from: CR
Repo: dashpay/dash PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T16:41:22.457Z
Learning: Applies to src/**/*.{cpp,h,hpp,cc} : Dash Core implementation must be written in C++20, requiring at least Clang 16 or GCC 11.1

Applied to files:

  • src/Makefile.am
🔇 Additional comments (1)
src/Makefile.am (1)

1133-1133: LGTM! Correctly resolves pthread linking regression.

The addition of $(PTHREAD_FLAGS) to dash_util_LDFLAGS is necessary and correct. This change:

  • Aligns with all other binary targets in this Makefile (dashd, dash-node, dash-cli, dash-tx, dash-wallet all include PTHREAD_FLAGS in their LDFLAGS)
  • Resolves the Guix build regression with undefined pthread symbols, since dash_util links against LIBBITCOIN_UTIL which contains threading code (util/thread.cpp, bls/bls_worker.cpp, sync.cpp)
  • Follows the established pattern for linking pthread support

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

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

@PastaPastaPasta PastaPastaPasta merged commit a77ef57 into dashpay:develop Dec 21, 2025
39 of 40 checks passed
Copy link
Copy Markdown
Collaborator

@knst knst left a comment

Choose a reason for hiding this comment

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

post-utACK

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants