Skip to content

fix(go): require compatible lld for native builds - #7

Merged
ethan7zhanghx merged 1 commit into
feat/querit-search-toolfrom
agent/fix-go-lld-version-guard
Jul 29, 2026
Merged

ethan7zhanghx merged 1 commit into
feat/querit-search-toolfrom
agent/fix-go-lld-version-guard

Conversation

@ethan7zhanghx

Copy link
Copy Markdown

What changed

  • reject Linux Go builds when ld.lld is missing, unparseable, or older than 20
  • explain that older linkers can silently drop SHT_CREL relocations and produce a startup-crashing binary
  • resolve the real LLD binary directory and pass it through -B in CGO_LDFLAGS

Why

The previous build only checked whether ld.lld existed. With Ubuntu LLD 18, ./build.sh --go completed successfully, but the resulting ragflow_server crashed with SIGSEGV before normal startup.

The linked PDFium libc++.a contains SHT_CREL compressed relocation sections. The affected cached cgo host object retained zero-displacement calls in operator new, so the final executable was invalid despite a successful link.

The repository development guide already requires Clang/LLD 20. This change makes the build fail early and makes the resolved, versioned linker directory part of the cgo flag string so switching linker installations invalidates the relevant Go cache key.

Impact

Developers using an incompatible linker now receive an actionable build error instead of a binary that crashes at startup.

Validation

  • bash -n build.sh
  • shellcheck build.sh
  • controlled LLD 18 negative test: build rejected before compilation
  • ./build.sh --go with LLD 20.1.2
  • ragflow_server --help
  • ./build.sh --test ./internal/agent/tool/...
  • ./build.sh --test ./internal/agent/component/...
  • Go API container startup and GET :9384/health returning HTTP 200

@ethan7zhanghx
ethan7zhanghx marked this pull request as ready for review July 29, 2026 09:19
@ethan7zhanghx
ethan7zhanghx merged commit 29dfd29 into feat/querit-search-tool Jul 29, 2026
ethan7zhanghx added a commit that referenced this pull request Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant