Skip to content

Build failed when without RTTI (dynamic_cast not permitted with -fno-rtti) #1027

@owent

Description

@owent

Describe your environment

Can not build with ENABLE_METRICS_PREVIEW and without RTTI -fno-rtti .

Steps to reproduce

cmake [...] -DWITH_METRICS_PREVIEW=ON "-DCMAKE_CXX_FLAGS=-fno-rtti"

What is the actual behavior?

2021-10-23T10:53:26.5426468Z /home/runner/work/cmake-toolset/cmake-toolset/test/third_party/packages/opentelemetry-cpp-v1.0.1/sdk/include/opentelemetry/sdk/metrics/sync_instruments.h:408:31:   required from here
2021-10-23T10:53:26.5428857Z /home/runner/work/cmake-toolset/cmake-toolset/test/third_party/packages/opentelemetry-cpp-v1.0.1/sdk/include/opentelemetry/sdk/metrics/sync_instruments.h:419:22: error: ‘dynamic_cast’ not permitted with ‘-fno-rtti’
2021-10-23T10:53:26.5430685Z   419 |       auto agg_ptr = dynamic_cast<BoundValueRecorder<T> *>(x.second.get())->GetAggregator();
2021-10-23T10:53:26.5431433Z       |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021-10-23T10:53:26.5502316Z /home/runner/work/cmake-toolset/cmake-toolset/test/third_party/packages/opentelemetry-cpp-v1.0.1/sdk/include/opentelemetry/sdk/metrics/sync_instruments.h: In instantiation of ‘std::vector<opentelemetry::v1::sdk::metrics::Record> opentelemetry::v1::sdk::metrics::ValueRecorder<T>::GetRecords() [with T = float]’:
2021-10-23T10:53:26.5504767Z /home/runner/work/cmake-toolset/cmake-toolset/test/third_party/packages/opentelemetry-cpp-v1.0.1/sdk/include/opentelemetry/sdk/metrics/sync_instruments.h:408:31:   required from here
2021-10-23T10:53:26.5507189Z /home/runner/work/cmake-toolset/cmake-toolset/test/third_party/packages/opentelemetry-cpp-v1.0.1/sdk/include/opentelemetry/sdk/metrics/sync_instruments.h:419:22: error: ‘dynamic_cast’ not permitted with ‘-fno-rtti’
2021-10-23T10:53:26.5600746Z /home/runner/work/cmake-toolset/cmake-toolset/test/third_party/packages/opentelemetry-cpp-v1.0.1/sdk/include/opentelemetry/sdk/metrics/sync_instruments.h: In instantiation of ‘std::vector<opentelemetry::v1::sdk::metrics::Record> opentelemetry::v1::sdk::metrics::ValueRecorder<T>::GetRecords() [with T = int]’:
2021-10-23T10:53:26.5603182Z /home/runner/work/cmake-toolset/cmake-toolset/test/third_party/packages/opentelemetry-cpp-v1.0.1/sdk/include/opentelemetry/sdk/metrics/sync_instruments.h:408:31:   required from here
2021-10-23T10:53:26.5605249Z /home/runner/work/cmake-toolset/cmake-toolset/test/third_party/packages/opentelemetry-cpp-v1.0.1/sdk/include/opentelemetry/sdk/metrics/sync_instruments.h:419:22: error: ‘dynamic_cast’ not permitted with ‘-fno-rtti’
2021-10-23T10:53:26.5683511Z /home/runner/work/cmake-toolset/cmake-toolset/test/third_party/packages/opentelemetry-cpp-v1.0.1/sdk/include/opentelemetry/sdk/metrics/sync_instruments.h: In instantiation of ‘std::vector<opentelemetry::v1::sdk::metrics::Record> opentelemetry::v1::sdk::metrics::ValueRecorder<T>::GetRecords() [with T = short int]’:
2021-10-23T10:53:26.5685919Z /home/runner/work/cmake-toolset/cmake-toolset/test/third_party/packages/opentelemetry-cpp-v1.0.1/sdk/include/opentelemetry/sdk/metrics/sync_instruments.h:408:31:   required from here
2021-10-23T10:53:26.5688332Z /home/runner/work/cmake-toolset/cmake-toolset/test/third_party/packages/opentelemetry-cpp-v1.0.1/sdk/include/opentelemetry/sdk/metrics/sync_instruments.h:419:22: error: ‘dynamic_cast’ not permitted with ‘-fno-rtti’
2021-10-23T10:53:26.5715576Z /home/runner/work/cmake-toolset/cmake-toolset/test/third_party/packages/opentelemetry-cpp-v1.0.1/sdk/include/opentelemetry/sdk/metrics/sync_instruments.h: In instantiation of ‘std::vector<opentelemetry::v1::sdk::metrics::Record> opentelemetry::v1::sdk::metrics::UpDownCounter<T>::GetRecords() [with T = double]’:
2021-10-23T10:53:26.5718040Z /home/runner/work/cmake-toolset/cmake-toolset/test/third_party/packages/opentelemetry-cpp-v1.0.1/sdk/include/opentelemetry/sdk/metrics/sync_instruments.h:279:31:   required from here
2021-10-23T10:53:26.5720128Z /home/runner/work/cmake-toolset/cmake-toolset/test/third_party/packages/opentelemetry-cpp-v1.0.1/sdk/include/opentelemetry/sdk/metrics/sync_instruments.h:290:22: error: ‘dynamic_cast’ not permitted with ‘-fno-rtti’
2021-10-23T10:53:26.5721716Z   290 |       auto agg_ptr = dynamic_cast<BoundUpDownCounter<T> *>(x.second.get())->GetAggregator();
2021-10-23T10:53:26.5722357Z       |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdo-not-stalehelp wantedGood for taking. Extra help will be provided by maintainersmetrics

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions