Skip to content

build: regression after #1021 — Arrow's arrow_SOURCE_DIR collides with FetchContent on CMake 3.28, breaks vendored Arrow build #1028

Closed

Description

@akshatgupta08

After #1021 (commit 31659e7), configuring iceberg-cpp with vendored Arrow fails on CMake 3.28 (Ubuntu 24.04 LTS). The rename of the FetchContent content name from VendoredArrow to Arrow creates a variable-name collision with Arrow's own project(arrow) call, which Arrow's cpp/cmake_modules/ThirdpartyToolchain.cmake relies on.

Environment

  • Ubuntu 24.04 LTS
  • CMake 3.28.3
  • GCC 14.2.0
  • Fresh clone of main

Reproduction

git clone https://github.com/apache/iceberg-cpp.git
cd iceberg-cpp
cmake -S . -B build -G Ninja -DCMAKE_C_COMPILER=gcc-14 -DCMAKE_CXX_COMPILER=g++-14

Error

CMake Error at build/_deps/arrow-src/cpp/cmake_modules/ThirdpartyToolchain.cmake:446 (file):
file STRINGS file
"/_deps/arrow-src/thirdparty/versions.txt"
cannot be read.

The file actually lives at _deps/arrow-src/cpp/thirdparty/versions.txt (inside cpp/). Because versions.txt can't be read, all *_BUILD_SHA256_CHECKSUM variables become empty and the subsequent Boost ExternalProject_Add fails with URL_HASH SHA256= (empty).

Root cause

Arrow's cpp/cmake_modules/ThirdpartyToolchain.cmake sets:

set(THIRDPARTY_DIR "${arrow_SOURCE_DIR}/thirdparty")

In a standalone Arrow build, project(arrow) in cpp/CMakeLists.txt sets arrow_SOURCE_DIR to the cpp/ directory. But when Arrow is pulled in by iceberg-cpp via FetchContent_Declare(Arrow ...), CMake pre-sets arrow_SOURCE_DIR to the tarball root (parent of cpp/). On CMake 3.28, the subsequent project(arrow) does not override the inherited arrow_SOURCE_DIR — PROJECT_SOURCE_DIR is updated, but arrow_SOURCE_DIR keeps the FetchContent value.

Verified with a minimal repro:

cmake_minimum_required(VERSION 3.25)
project(TestFC)

cmake_minimum_required(VERSION 3.25)
project(TestFC)
include(FetchContent)
FetchContent_Declare(Arrow URL file:///path/to/apache-arrow-25.0.0.tar.gz SOURCE_SUBDIR cpp)
FetchContent_Populate(Arrow)

arrow_SOURCE_DIR is set by FetchContent to the tarball root

Add a subdir that calls project(arrow)

→ PROJECT_SOURCE_DIR updates to /subdir, but arrow_SOURCE_DIR does NOT change

Before #1021 this worked because the FetchContent name was VendoredArrow (variable vendoredarrow_SOURCE_DIR), separate from Arrow's own arrow_SOURCE_DIR.

Why CI didn't catch it

CI runs on ubuntu-26.04, which ships a newer CMake. Either the newer CMake behaves differently for project() overrides, or a system Arrow is picked up by FIND_PACKAGE_ARGS CONFIG. Either way, CMake 3.28 on Ubuntu 24.04 LTS — the current widely-used LTS — isn't exercised.

Suggested fix

Rename back to VendoredArrow (or any name other than Arrow/arrow) to avoid the collision. Alternatively, consider adding ubuntu-24.04 with its stock CMake to the CI matrix.

Workaround

git revert 31659e7 locally.

Activity

  1. raulcd commented on Oct 16, 2026

    @raulcd
    Member

    I've been able to reproduce with a minimal docker container with ubuntu 24.04:

    #8 10.86 -- Using BUNDLED approach to find dependencies
    #8 10.86 CMake Error at build/_deps/arrow-src/cpp/cmake_modules/ThirdpartyToolchain.cmake:446 (file):
    #8 10.86   file STRINGS file
    #8 10.86   "/iceberg-cpp/build/_deps/arrow-src/thirdparty/versions.txt" cannot be
    #8 10.86   read.
    #8 10.86 Call Stack (most recent call first):
    #8 10.86   build/_deps/arrow-src/cpp/CMakeLists.txt:529 (include)
    #8 10.86 
    #8 10.86 
    #8 10.86 CMake Error at build/_deps/arrow-src/cpp/cmake_modules/ThirdpartyToolchain.cmake:742 (string):
    #8 10.86   string sub-command SUBSTRING requires four arguments.
    #8 10.86 Call Stack (most recent call first):
    #8 10.86   build/_deps/arrow-src/cpp/CMakeLists.txt:529 (include)
    #8 10.86 
    #8 10.86 
    #8 10.87 -- Looking for _M_ARM64
    #8 10.88 -- Looking for _M_ARM64 - not found
    #8 10.88 -- Looking for __SIZEOF_INT128__
    #8 10.93 -- Looking for __SIZEOF_INT128__ - found
    #8 10.93 -- Boost: Building from source
    #8 10.95 Boost: CMake Error at /usr/share/cmake-3.28/Modules/ExternalProject.cmake:3045 (message):
    #8 10.95 Boost:   URL_HASH is set to
    #8 10.95 Boost: 
    #8 10.95 Boost:     SHA256=
    #8 10.95 Boost: 
    #8 10.95 Boost:   but must be ALGO=value where ALGO is
    #8 10.95 Boost: 
    #8 10.95 Boost:     MD5|SHA1|SHA224|SHA256|SHA384|SHA512|SHA3_224|SHA3_256|SHA3_384|SHA3_512
    #8 10.95 Boost: 
    #8 10.95 Boost:   and value is a hex string.
    #8 10.95 Boost: Call Stack (most recent call first):
    #8 10.95 Boost:   /usr/share/cmake-3.28/Modules/ExternalProject.cmake:4418 (_ep_add_download_command)
    #8 10.95 Boost:   CMakeLists.txt:21 (ExternalProject_Add)
    #8 10.95 Boost: 
    #8 10.95 Boost: 
    #8 10.95 Boost: -- Configuring incomplete, errors occurred!
    #8 10.95 Boost: 
    #8 10.95 CMake Error at /usr/share/cmake-3.28/Modules/FetchContent.cmake:1667 (message):

    It can be reproduced with:

    # Minimal reproducer for apache/iceberg-cpp#1028:
    # vendored Arrow configure fails with the stock CMake 3.28 on Ubuntu 24.04.
    FROM ubuntu:24.04
    
    RUN apt-get update && \
        DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
          ca-certificates cmake g++-14 gcc-14 git ninja-build libcurl4-openssl-dev zlib1g-dev libssl-dev && \
        rm -rf /var/lib/apt/lists/*
    
    WORKDIR /iceberg-cpp
    COPY . .
    
    RUN cmake --version && \
        cmake -S . -B build -G Ninja \
          -DCMAKE_C_COMPILER=gcc-14 -DCMAKE_CXX_COMPILER=g++-14

    I think this is an issue on the Arrow side, I can work on it.

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