Skip to content

[C++] Build fails in util/pcre.h due to missing #include <cstdint> #43350

@sergeibelov113

Description

@sergeibelov113

Describe the bug, including details regarding any error messages, version, and platform.

Description

Building the project fails with the following error in util/pcre.h:

/arrow/cpp/re2_ep-prefix/src/re2_ep/util/pcre.h:503:11: error: 'int32_t' does not name a type

Environment

  • OS: Docker Alpine 3.20
  • Compiler: g++ (Alpine 13.2.1_git20240309) 13.2.1 20240309
  • Build System: Ninja

Steps to Reproduce

apk update && apk add --no-cache \
    gcc \
    g++ \
    curl \
    unixodbc-dev \
    bash \
    libffi-dev \
    openssl-dev \
    cargo \
    musl-dev \
    postgresql-dev \
    cmake \
    rust \
    linux-headers \
    libc-dev \
    libgcc \
    libstdc++ \
    ca-certificates \
    zlib-dev \
    bzip2-dev \
    xz-dev \
    lz4-dev \
    zstd-dev \
    snappy-dev \
    brotli-dev \
    py3-numpy \
    py3-pandas \
    build-base \
    autoconf \
    boost-dev \
    flex \
    libxml2-dev \
    libxslt-dev \
    libjpeg-turbo-dev \
    ninja \
    git

export ARROW_VERSION=17.0.0
export ARROW_SHA256=8379554d89f19f2c8db63620721cabade62541f47a4e706dfb0a401f05a713ef
export ARROW_BUILD_TYPE=release
export ARROW_HOME=/usr/local
export PARQUET_HOME=/usr/local

 mkdir /arrow \
    && wget -q https://github.com/apache/arrow/archive/apache-arrow-${ARROW_VERSION}.tar.gz -O /tmp/apache-arrow.tar.gz \
    && echo "${ARROW_SHA256} *apache-arrow.tar.gz" | sha256sum /tmp/apache-arrow.tar.gz \
    && tar -xvf /tmp/apache-arrow.tar.gz -C /arrow --strip-components 1

cd /arrow/cpp \
    && cmake --preset ninja-release-python \
    && cmake --build . --target install \

Suggested Fix

Adding #include <cstdint> to util/pcre.h resolves the issue:

patch -p1 < /arrow/re2_patch.diff

diff --git a/util/pcre.h b/util/pcre.h
index e69de29..b6f3e31 100644
--- a/util/pcre.h
+++ b/util/pcre.h
@@ -21,6 +21,7 @@
 #include "re2/filtered_re2.h"
 #include "re2/pod_array.h"
 #include "re2/stringpiece.h"
+#include <cstdint>
#include <cstdint>



### Component(s)

C++

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions