Skip to content

v1.22.0 no longer respects BUILD_SHARED_LIBS: ON #3620

@vkrevs

Description

@vkrevs

Describe your environment
openSUSE 15.6, gcc 7.5.0, cmake 4.0.3

We're trying to upgrade from v1.16.1 to v.1.22.0 and configuring opentelemetry-cpp v1.22.0 using the following command:

cmake <BUILD_ROOT>/opentelemetry-cpp-1.22.0 -DCMAKE_CXX_FLAGS="-std=c++14 -m64" \
-DCMAKE_TOOLCHAIN_FILE=build64.toolchain.cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DWITH_ABI_VERSION=2 -DWITH_ABI_VERSION_2=ON -DWITH_ABI_VERSION_1=OFF \
-DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DWITH_ABSEIL=ON \
-DWITH_DEPRECATED_SDK_FACTORY=OFF -DWITH_OTLP_GRPC=OFF -DWITH_OTLP_FILE=ON \
-DWITH_OTLP_HTTP=ON -DWITH_OTLP_HTTP_COMPRESSION=ON -DWITH_EXAMPLES_HTTP=OFF \
-DWITH_OTLP_HTTP_SSL_PREVIEW=ON -DWITH_OTLP_HTTP_SSL_TLS_PREVIEW=ON \
-DOTELCPP_PROTO_PATH=<BUILD_ROOT>/opentelemetry-proto-1.7.0 \
-DCMAKE_PREFIX_PATH=\
<BUILD_ROOT>/json-3.12.0-bin;\
<BUILD_ROOT>/zlib-1.3.1-bin;\
<BUILD_ROOT>/googletest-1.14.0-bin;\
<BUILD_ROOT>/benchmark-1.8.3-bin;\
<BUILD_ROOT>/protobuf-26.1-bin;\
<BUILD_ROOT>/abseil-cpp-20240116.2-bin

All dependencies including protobuf and abseil are built as static libraries. Dependency versions:

OPENTELEMETRY_VERSION=1.22.0
   OTEL_PROTO_VERSION=1.7.0
NLOHMANN_JSON_VERSION=3.12.0
     PROTOBUF_VERSION=26.1
    ABSEILCPP_VERSION=20240116.2
        GTEST_VERSION=1.14.0
       GBENCH_VERSION=1.8.3
         ZLIB_VERSION=1.3.1

Steps to reproduce
Configure opentelemetry-cpp v1.22.0 using the above command. Then perform the "cmake --build" and "cmake --install" steps.

What is the expected behavior?
What did you expect to see?
The lib directory of the install location contains only shared libraries - just like it did in v1.16.1 - because of the -DBUILD_SHARED_LIBS=ON option.

What is the actual behavior?
What did you see instead?
The lib directory of the install location contains a mixture of shared and static libraries, despite the -DBUILD_SHARED_LIBS=ON option.

$ ls
libopentelemetry_common.so                     libopentelemetry_exporter_ostream_metrics.so  libopentelemetry_exporter_otlp_file_log.a         libopentelemetry_exporter_otlp_http_log.a       libopentelemetry_metrics.so         libopentelemetry_trace.so
libopentelemetry_exporter_in_memory_metric.so  libopentelemetry_exporter_ostream_span.so     libopentelemetry_exporter_otlp_file_metric.a      libopentelemetry_exporter_otlp_http64_metric.a  libopentelemetry_otlp_recordable.a  libopentelemetry_version.so
libopentelemetry_exporter_in_memory.so         libopentelemetry_exporter_otlp_file.a           libopentelemetry_exporter_otlp_http.a           libopentelemetry_http_client_curl.so            libopentelemetry_proto.a            pkgconfig
libopentelemetry_exporter_ostream_logs.so      libopentelemetry_exporter_otlp_file_client.a    libopentelemetry_exporter_otlp_http_client.a  libopentelemetry_logs.so                        libopentelemetry_resources.so

Additional context
Add any other context about the problem here.
I'm aware of #3405 and #3435. However, we're not using grpc at all, only protobuf and only indirectly - because opentelemetry-cpp requires it - and should not be affected by the problems with the latest protobuf versions - unless I misunderstand #3405 and #3435.

Tip: React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage/acceptedIndicates an issue or PR is ready to be actively worked on.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions