「Building Arrow C++」してみる。`--preset ninja-debug-maximal -DARROW_BUILD_SHARED=OFF`

# 概要

[「Building Arrow C++」してみる](https://qiita.com/abetomo/items/57329b6b2cd64486c2f4)　でとりあえずビルドしました。

引き続きCMake、Ninja、その他もろもろの理解ができていないので、違うpresetでビルドして理解する狙いです。

## 今回のゴール

```
$ cmake .. --preset ninja-debug-maximal -DARROW_BUILD_SHARED=OFF
```

の実行が正常終了する

# 環境

```
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.1 LTS"
```

[「Building Arrow C++」してみる](https://qiita.com/abetomo/items/57329b6b2cd64486c2f4) のあとの状態。



# 実行したコマンド

## ライブラリのインストール

不足しているライブラリをインストールして正常終了を目指します。

* [Could NOT find CURL](#could-not-find-curl)
    ```
    $ sudo apt install libcurl4-openssl-dev
    ```

* [Could NOT find OpenSSL,...](#could-not-find-openssl)
    ```
    $ sudo apt install libssl-dev
    ```

* [Could not find nvcc,...](#could-not-find-nvcc)
    ```
    $ sudo apt install nvidia-cuda-toolkit
    ```

* [Could NOT find LLVMAlt](#could-not-find-llvmalt)
    ```
    $ sudo apt install clang
    ```

* [Could NOT find librados](#could-not-find-librados)
    ```
    $ sudo apt install libradospp-dev
    ```

## cmake

```
  If using static linkage for unit tests, must also pass
  ARROW_BUILD_STATIC=on
```

と言われたので、よくわかってないまま追加して、[今回のゴール](#今回のゴール) のコマンドと違うけど、エラーなく終了できたコマンド

```
$ cmake .. --preset ninja-debug-maximal -DARROW_BUILD_SHARED=OFF \
    -DARROW_BUILD_STATIC=ON
```

# まとめ

以下のコマンドが実行できた。

```
$ cmake .. --preset ninja-debug-maximal -DARROW_BUILD_SHARED=OFF \
    -DARROW_BUILD_STATIC=ON
```

## 課題

`-DARROW_BUILD_SHARED=OFF` と `-DARROW_BUILD_STATIC=ON` の意味の理解。


# 補足: 出たエラー

## If using static linkage for unit tests,...

```
CMake Error at CMakeLists.txt:873 (message):
  If using static linkage for unit tests, must also pass
  ARROW_BUILD_STATIC=on
```

## Could NOT find CURL

```
CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find CURL (missing: CURL_LIBRARY CURL_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.22/Modules/FindCURL.cmake:181 (find_package_handle_standard_args)
  cmake_modules/ThirdpartyToolchain.cmake:1234 (find_package)
  cmake_modules/ThirdpartyToolchain.cmake:4180 (find_curl)
  cmake_modules/ThirdpartyToolchain.cmake:169 (build_google_cloud_cpp_storage)
  cmake_modules/ThirdpartyToolchain.cmake:274 (build_dependency)
  cmake_modules/ThirdpartyToolchain.cmake:4365 (resolve_dependency)
  CMakeLists.txt:504 (include)
```

## Could NOT find OpenSSL,...

```
CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
  system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY
  OPENSSL_INCLUDE_DIR) (Required is at least version "1.0.2")
Call Stack (most recent call first):
  /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.22/Modules/FindOpenSSL.cmake:574 (find_package_handle_standard_args)
  cmake_modules/ThirdpartyToolchain.cmake:280 (find_package)
  cmake_modules/ThirdpartyToolchain.cmake:4182 (resolve_dependency)
  cmake_modules/ThirdpartyToolchain.cmake:169 (build_google_cloud_cpp_storage)
  cmake_modules/ThirdpartyToolchain.cmake:274 (build_dependency)
  cmake_modules/ThirdpartyToolchain.cmake:4365 (resolve_dependency)
  CMakeLists.txt:504 (include)
```

## Could not find nvcc,...

```
CMake Error at /usr/share/cmake-3.22/Modules/FindCUDAToolkit.cmake:675 (message):
  Could not find nvcc, please set CUDAToolkit_ROOT.
Call Stack (most recent call first):
  src/arrow/gpu/CMakeLists.txt:41 (find_package)
```

## Could NOT find LLVMAlt

```
CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find LLVMAlt (missing: LLVM_PACKAGE_VERSION CLANG_EXECUTABLE
  LLVM_FOUND LLVM_LINK_EXECUTABLE)
Call Stack (most recent call first):
  /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  cmake_modules/FindLLVMAlt.cmake:103 (find_package_handle_standard_args)
  src/gandiva/CMakeLists.txt:28 (find_package)
```

## Could NOT find librados

```
CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find librados (missing: LIBRADOS_LIBRARY LIBRADOS_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  cmake_modules/Findlibrados.cmake:29 (find_package_handle_standard_args)
  src/skyhook/CMakeLists.txt:26 (find_package)
```

# 参考: ninja-debug-minimal　と ninja-debug-maximal

## ninja-debug-minimal

```
  "ninja-debug-minimal"          - Debug build without anything enabled
```

```
$ cmake --preset -N ninja-debug-minimal
Preset CMake variables:

  ARROW_BUILD_INTEGRATION="OFF"
  ARROW_BUILD_STATIC="OFF"
  ARROW_BUILD_TESTS="OFF"
  ARROW_EXTRA_ERROR_CONTEXT="ON"
  ARROW_WITH_RE2="OFF"
  ARROW_WITH_UTF8PROC="OFF"
  CMAKE_BUILD_TYPE="Debug"
```

## ninja-debug-maximal

```
  "ninja-debug-maximal"          - Debug build with everything enabled (except benchmarks)
```

```
$ cmake --preset -N ninja-debug-maximal
Preset CMake variables:

  ARROW_BUILD_EXAMPLES="ON"
  ARROW_BUILD_INTEGRATION="ON"
  ARROW_BUILD_STATIC="OFF"
  ARROW_BUILD_TESTS="ON"
  ARROW_BUILD_UTILITIES="ON"
  ARROW_COMPUTE="ON"
  ARROW_CSV="ON"
  ARROW_CUDA="ON"
  ARROW_DATASET="ON"
  ARROW_EXTRA_ERROR_CONTEXT="ON"
  ARROW_FILESYSTEM="ON"
  ARROW_FLIGHT="ON"
  ARROW_GANDIVA="ON"
  ARROW_GCS="ON"
  ARROW_HDFS="ON"
  ARROW_JSON="ON"
  ARROW_MIMALLOC="ON"
  ARROW_ORC="ON"
  ARROW_PARQUET="ON"
  ARROW_S3="ON"
  ARROW_SKYHOOK="ON"
  ARROW_SUBSTRAIT="ON"
  ARROW_TENSORFLOW="ON"
  ARROW_WITH_BROTLI="ON"
  ARROW_WITH_BZ2="ON"
  ARROW_WITH_LZ4="ON"
  ARROW_WITH_RE2="ON"
  ARROW_WITH_SNAPPY="ON"
  ARROW_WITH_UTF8PROC="ON"
  ARROW_WITH_ZLIB="ON"
  ARROW_WITH_ZSTD="ON"
  CMAKE_BUILD_TYPE="Debug"
  PARQUET_BUILD_EXAMPLES="ON"
  PARQUET_BUILD_EXECUTABLES="ON"
  PARQUET_REQUIRE_ENCRYPTION="ON"
```