Skip to content

Werror in CMake Build propogates warnings from subprojects as errors #246

Closed

Description

@WillAyd

When using the CMake configuration, dependencies that need to be built may throw warnings. With the current CMake configuration, these warnings cause the build to fail:

[ 62%] Building CXX object src/iceberg/CMakeFiles/iceberg_static.dir/manifest_entry.cc.o
/home/will/clones/iceberg-cpp/build/_deps/vendoredarrow-src/cpp/src/arrow/array/array_nested.cc: In member function ‘const std::shared_ptr<arrow::Array>& arrow::StructArray::field(int) const’:
/home/will/clones/iceberg-cpp/build/_deps/vendoredarrow-src/cpp/src/arrow/array/array_nested.cc:1080:51: error: ‘std::shared_ptr<_Tp> std::atomic_load(const shared_ptr<_Tp>*) [with _Tp = arrow::Array]’ is deprecated: use 'std::atomic<std::shared_ptr<T>>' instead [-Werror=deprecated-declarations]
 1080 |   std::shared_ptr<Array> result = std::atomic_load(&boxed_fields_[i]);
      |                                   ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/memory:81,
                 from /home/will/clones/iceberg-cpp/build/_deps/vendoredarrow-src/cpp/src/arrow/array/array_nested.h:24,
                 from /home/will/clones/iceberg-cpp/build/_deps/vendoredarrow-src/cpp/src/arrow/array/array_nested.cc:18:
/usr/include/c++/14/bits/shared_ptr_atomic.h:142:5: note: declared here
  142 |     atomic_load(const shared_ptr<_Tp>* __p)
      |     ^~~~~~~~~~~
/home/will/clones/iceberg-cpp/build/_deps/vendoredarrow-src/cpp/src/arrow/array/array_nested.cc:1089:22: error: ‘void std::atomic_store(shared_ptr<_Tp>*, shared_ptr<_Tp>) [with _Tp = arrow::Array]’ is deprecated: use 'std::atomic<std::shared_ptr<T>>' instead [-Werror=deprecated-declarations]
 1089 |     std::atomic_store(&boxed_fields_[i], std::move(result));
      |     ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/shared_ptr_atomic.h:183:5: note: declared here
  183 |     atomic_store(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r)
      |     ^~~~~~~~~~~~
/home/will/clones/iceberg-cpp/build/_deps/vendoredarrow-src/cpp/src/arrow/array/array_nested.cc: In member function ‘std::shared_ptr<arrow::Array> arrow::UnionArray::field(int) const’:
/home/will/clones/iceberg-cpp/build/_deps/vendoredarrow-src/cpp/src/arrow/array/array_nested.cc:1360:51: error: ‘std::shared_ptr<_Tp> std::atomic_load(const shared_ptr<_Tp>*) [with _Tp = arrow::Array]’ is deprecated: use 'std::atomic<std::shared_ptr<T>>' instead [-Werror=deprecated-declarations]
 1360 |   std::shared_ptr<Array> result = std::atomic_load(&boxed_fields_[i]);
      |                                   ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/shared_ptr_atomic.h:142:5: note: declared here
  142 |     atomic_load(const shared_ptr<_Tp>* __p)
      |     ^~~~~~~~~~~
/home/will/clones/iceberg-cpp/build/_deps/vendoredarrow-src/cpp/src/arrow/array/array_nested.cc:1372:22: error: ‘void std::atomic_store(shared_ptr<_Tp>*, shared_ptr<_Tp>) [with _Tp = arrow::Array]’ is deprecated: use 'std::atomic<std::shared_ptr<T>>' instead [-Werror=deprecated-declarations]
 1372 |     std::atomic_store(&boxed_fields_[i], result);
      |     ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/shared_ptr_atomic.h:183:5: note: declared here
  183 |     atomic_store(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r)
      |     ^~~~~~~~~~~~

Activity

  1. zhjwpku commented on Sep 28, 2025

    @zhjwpku
    Member

    Hi @WillAyd Could you provide more details on how to reproduce this error? We've had CMAKE_COMPILE_WARNING_AS_ERROR enabled for about three months, not seeing CI errors on array_nested.cc[1]. But what you reported seems reasonable, I'd like to reproduce the issue locally to investigate further.

    [1] https://github.com/apache/iceberg-cpp/actions/runs/18053108795/job/51378485398?pr=242#step:4:1139

  2. zhjwpku commented on Sep 28, 2025

    @zhjwpku
    Member

    It seems we have CMAKE_COMPILE_WARNING_AS_ERROR disabled for subprojects.

    https://github.com/apache/iceberg-cpp/blob/main/cmake_modules/IcebergThirdpartyToolchain.cmake#L51

  3. wgtmac commented on Sep 28, 2025

    @wgtmac
    Member

    CMAKE_COMPILE_WARNING_AS_ERROR does not always work. I have seen the same issue in apache/orc#2416 that building Protobuf using FetchContent failed due to warnings are regarded as errors.

  4. yadavay-amzn commented on Jul 6, 2026

    @yadavay-amzn
    Contributor

    I would like to take this. Plan: scope the warnings-as-error settings (CMAKE_COMPILE_WARNING_AS_ERROR / -Werror) to this project's own targets so they do not propagate into FetchContent-built dependencies. Will disclose AI-assisted authoring in the PR per the Iceberg AI-contribution guidelines.

  5. added a commit that references this issue on Jul 7, 2026
    f4f6359
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions