Skip to content

Commit 4edefc3

Browse files
authored
GH-48750: [CI][Documentation] Disable Unity build for OpenTelemetry (#48751)
### Rationale for this change After commit cbd48a4 migrated `OpenTelemetry` from `ExternalProject` to `FetchContent`, the documentation build started failing with symbol redefinition errors: ``` error: redefinition of 'const google::protobuf::internal::MigrationSchema schemas []' ``` `FetchContent` integrates `OpenTelemetry` into the parent CMake configuration, causing it to inherit `CMAKE_UNITY_BUILD=ON`. Unity builds combine multiple `.pb.cc` files into a single compilation unit, which causes collision of `static` symbols (like `schemas[]` and `file_default_instances[]`) that exist in each `protobuf-generated` file. ### What changes are included in this PR? Added `set(CMAKE_UNITY_BUILD FALSE)` in the `build_opentelemetry()` function in `cpp/cmake_modules/ThirdpartyToolchain.cmake` to disallow Unity build in `protobuf-generated` files. ### Are these changes tested? Has to be tested via CI. ### Are there any user-facing changes? No, dev-only. * GitHub Issue: #48750 Authored-by: Hyukjin Kwon <[email protected]> Signed-off-by: Raúl Cumplido <[email protected]>
1 parent 3cbc27a commit 4edefc3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

cpp/cmake_modules/ThirdpartyToolchain.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3726,6 +3726,8 @@ function(build_opentelemetry)
37263726

37273727
prepare_fetchcontent()
37283728

3729+
# Unity build causes symbol redefinition errors in protobuf-generated code
3730+
set(CMAKE_UNITY_BUILD FALSE)
37293731
set(OTELCPP_PROTO_PATH "${opentelemetry_proto_SOURCE_DIR}")
37303732
set(WITH_EXAMPLES OFF)
37313733
set(WITH_OTLP_HTTP ON)

0 commit comments

Comments
 (0)