Using Arrow C++ in your own project

This section assumes you already have the Arrow C++ libraries on your system, either after installing them using a package manager or after building them yourself.

The recommended way to integrate the Arrow C++ libraries in your own C++ project is to use CMake’s find_package function for locating and integrating dependencies. If you don’t use CMake as a build system, you can use pkg-config to find installed the Arrow C++ libraries.


Basic usage

This minimal CMakeLists.txt file compiles a source file into an executable linked with the Arrow C++ shared library:


find_package(Arrow REQUIRED)

target_link_libraries(my_example PRIVATE arrow_shared)

Available variables and targets

The directive find_package(Arrow REQUIRED) asks CMake to find an Arrow C++ installation on your system. When it returns, it will have set a few CMake variables:

  • ${Arrow_FOUND} is true if the Arrow C++ libraries have been found

  • ${ARROW_VERSION} contains the Arrow version string

  • ${ARROW_FULL_SO_VERSION} contains the Arrow DLL version string

In addition, it will have created some targets that you can link against (note these are plain strings, not variables):

  • arrow_shared links to the Arrow shared libraries

  • arrow_static links to the Arrow static libraries

In most cases, it is recommended to use the Arrow shared libraries.


CMake is case-sensitive. The names and variables listed above have to be spelt exactly that way!

See also

A Docker-based minimal build example.


Basic usage

You can get suitable build flags by the following command line:

pkg-config --cflags --libs arrow

If you want to link the Arrow C++ static library, you need to add --static option:

pkg-config --cflags --libs --static arrow

This minimal Makefile file compiles a source file into an executable linked with the Arrow C++ shared library:

     $(CXX) -o $@ $(CXXFLAGS) $< $$(pkg-config --cflags --libs arrow)

Many build systems support pkg-config. For example:

Available packages

The Arrow C++ provides a pkg-config package for each module. Here are all available packages:

  • arrow-csv

  • arrow-cuda

  • arrow-dataset

  • arrow-filesystem

  • arrow-flight-testing

  • arrow-flight

  • arrow-json

  • arrow-orc

  • arrow-python-flight

  • arrow-python

  • arrow-tensorflow

  • arrow-testing

  • arrow

  • gandiva

  • parquet

  • plasma

A Note on Linking

Some Arrow components have dependencies that you may want to use in your own project. Care must be taken to ensure that your project links the same version of these dependencies in the same way (statically or dynamically) as Arrow, else ODR violations may result and your program may crash or silently corrupt data.

In particular, Arrow Flight and its dependencies Protocol Buffers (Protobuf) and gRPC are likely to cause issues. When using Arrow Flight, note the following guidelines:

  • If statically linking Arrow Flight, Protobuf and gRPC must also be statically linked, and the same goes for dynamic linking.

  • Some platforms (e.g. Ubuntu 20.04 at the time of this writing) may ship a version of Protobuf and/or gRPC that is not recent enough for Arrow Flight. In that case, Arrow Flight bundles these dependencies, so care must be taken not to mix the Arrow Flight library with the platform Protobuf/gRPC libraries (as then you will have two versions of Protobuf and/or gRPC linked into your application).

It may be easiest to depend on a version of Arrow built from source, where you can control the source of each dependency and whether it is statically or dynamically linked. See Building Arrow C++ for instructions. Or alternatively, use Arrow from a package manager such as Conda or vcpkg which will manage consistent versions of Arrow and its dependencies.

Runtime Dependencies

While Arrow uses the OS-provided timezone database on Linux and macOS, it requires a user-provided database on Windows. You must download and extract the text version of the IANA timezone database and add the Windows timezone mapping XML. To download, you can use the following batch script:

curl --output tzdata.tar.gz
mkdir tzdata
tar --extract --file tzdata.tar.gz --directory tzdata
move tzdata %USERPROFILE%\Downloads\tzdata
@rem Also need Windows timezone mapping
curl ^
  --output %USERPROFILE%\Downloads\tzdata\windowsZones.xml

By default, the timezone database will be detected at %USERPROFILE%\Downloads\tzdata, but you can set a custom path at runtime in arrow::ArrowGlobalOptions:

arrow::GlobalOptions options;
options.timezone_db_path = "path/to/tzdata";