Skip to content

[Tool] fix connector library link order for thirdparty deps#76292

Merged
alvin-phoenix-ai merged 1 commit into
StarRocks:mainfrom
wangruin:tool/fix-connector-link-order
Jul 13, 2026
Merged

[Tool] fix connector library link order for thirdparty deps#76292
alvin-phoenix-ai merged 1 commit into
StarRocks:mainfrom
wangruin:tool/fix-connector-link-order

Conversation

@wangruin

@wangruin wangruin commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Why I'm doing:

The daily release / benchmark BE build (starrocks_benchmark_main_cloud) fails at the final link of starrocks_be with a flood of undefined references to thirdparty symbols:

[100%] Linking CXX executable /root/starrocks/be/output/lib/starrocks_be
be/src/connector/file/scanner/parquet_reader.cpp:216: undefined reference to 'parquet::ParquetFileReader::Open(...)'
be/src/connector/file/scanner/avro_scanner.cpp:145: undefined reference to 'serdes_conf_new'
be/src/formats/avro/cpp/avro_reader.cpp:514: undefined reference to 'avro::DataFileReaderBase::close()'
be/src/formats/deletion_bitmap.cpp:28: undefined reference to 'roaring64_iterator_create'
be/src/formats/paimon/paimon_delete_file_builder.cpp:61: undefined reference to 'roaring64_bitmap_move_from_roaring32'
collect2: error: ld returned 1 exit status

Root cause: after the connector-module refactor (#76143 / #76232 / #76237 / #76238), the concrete connector modules (Connector / ConnectorLake / ConnectorFile / ConnectorHive / ConnectorIceberg / ...) reach the starrocks_be binary only as transitive PRIVATE deps of ModuleBootstrap / Exec. CMake appends those transitive deps after the thirdparty dependency group, so the connector objects (parquet_reader, avro_scanner, the iceberg/paimon/delta delete builders, deletion_bitmap) end up behind their thirdparty archives (avro/avrocpp, arrow/parquet, roaring) on the static link line, leaving their references unresolved.

Why the PR gates stayed green while the release build broke: the PR BUILD gate does fully link starrocks_be, but it runs on the Ubuntu toolchain image, which sets STARROCKS_LINKER=lld (docker/dockerfiles/toolchains/toolchains-ubuntu.Dockerfile). lld resolves backward references into already-scanned archives by default (--warn-backrefs is off), so the misordered link line still succeeds silently. The release/benchmark build runs on the CentOS 7 image, which has no lld: glibc 2.17 < 2.29 makes be/CMakeLists.txt force the gold linker, and gold (like GNU ld) does strict single-pass left-to-right archive scanning — the connector objects behind the thirdparty group fail with undefined references. (The BE UT gate additionally builds with MAKE_TEST=ON, which never links starrocks_be at all.)

So this class of link-order regression is invisible to the PR gates today. A follow-up worth considering: pass -Wl,--warn-backrefs to lld in the Ubuntu build so archive-order breakage fails in PR CI instead of in the CentOS release build.

This is the same class of link-order bug that #75841 fixed for the concrete format libraries.

What I'm doing:

List the concrete connector modules explicitly in STARROCKS_LINK_LIBS, ahead of the format libraries and the thirdparty dependency group, mirroring the existing format-library fix. The list mirrors exactly the connector set ModuleBootstrap pulls: the six always-on connectors (including ConnectorCacheStats) plus the optional benchmark/Elasticsearch/JDBC/MySQL connectors under the same WITH_CONNECTOR_* guards. The DIRECT_CONNECTOR_LINK_LIBS definition is moved above STARROCKS_LINK_LIBS so it can be reused there; the test/benchmark link lists are left untouched (the now-redundant explicit copy is harmless for static libs and keeps the already-green test/bench link unchanged).

Fixes the release BE build break at main.

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
    • This pr needs auto generate documentation
  • This is a backport pr

@CelerData-Reviewer

Copy link
Copy Markdown

@codex review

@github-actions github-actions Bot requested review from kevincai and stdpain July 13, 2026 11:06

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6b5f043a52

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread be/CMakeLists.txt
The concrete connector modules (Connector/ConnectorLake/ConnectorFile/
ConnectorHive/ConnectorIceberg) reference thirdparty archives such as
avro/avrocpp, arrow/parquet and roaring, but they reach the starrocks_be
binary only as transitive PRIVATE deps of ModuleBootstrap/Exec. CMake
appends those transitive deps after the thirdparty dependency group, so the
connector objects (parquet_reader, avro_scanner, iceberg/paimon/delta delete
builders, deletion_bitmap) end up behind their thirdparty archives on the
static link line and their references are left unresolved -> the release BE
build fails with a flood of undefined references to avro/roaring/parquet.

The unit-test and benchmark binaries already link the connectors explicitly
(DIRECT_CONNECTOR_LINK_LIBS) so they were unaffected, which is why PR gates
stayed green while the release/daily build broke.

List the connector modules explicitly in STARROCKS_LINK_LIBS ahead of the
format libraries and the thirdparty group, mirroring the existing fix for the
concrete format libraries.
@wangruin wangruin force-pushed the tool/fix-connector-link-order branch from 6b5f043 to bf3d0f3 Compare July 13, 2026 11:18
@wangruin

Copy link
Copy Markdown
Contributor Author

Good catch, fixed in the latest push.

Confirmed the facts: WITH_CONNECTOR_BENCHMARK/ELASTICSEARCH/JDBC/MYSQL default to ON, ModuleBootstrap also brings in ConnectorCacheStats unconditionally, and these connectors pull thirdparty archives (ConnectorMySQLmysql, ConnectorBenchmarkarrow, ConnectorJDBClibxml2, …). The original early group only expanded the 5 core connectors, so those extra ones stayed in the transitive tail behind STARROCKS_DEPENDENCIES.

DIRECT_CONNECTOR_LINK_LIBS now enumerates every connector ModuleBootstrap pulls: ConnectorCacheStats added unconditionally, and ConnectorBenchmark/ConnectorElasticsearch/ConnectorJDBC/ConnectorMySQL appended under the same WITH_CONNECTOR_* options so an OFF build doesn't reference a non-existent target. This keeps the whole set ahead of the thirdparty group in every default and optional configuration.

@github-actions

Copy link
Copy Markdown
Contributor

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

@github-actions

Copy link
Copy Markdown
Contributor

[FE Incremental Coverage Report]

pass : 0 / 0 (0%)

@github-actions

Copy link
Copy Markdown
Contributor

[BE Incremental Coverage Report]

pass : 0 / 0 (0%)

@alvin-phoenix-ai alvin-phoenix-ai merged commit 5db2040 into StarRocks:main Jul 13, 2026
58 of 61 checks passed
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.

3 participants