yajl-2.1.0

#### Supplemental Linux® From Scratch - Version 13.0

### Chapter 2. General Libraries

- Prev

  websocketpp-0.8.2

- Next

  yyjson-0.12.0

- Up
- Home

# yajl-2.1.0

## Introduction to yajl

The yajl package provides a JSON library.

- Download: https://github.com/lloyd/yajl/archive/refs/tags/2.1.0/yajl-2.1.0.tar.gz

### Additional Downloads

- Required patch: https://gitlab.archlinux.org/archlinux/packaging/packages/yajl/-/raw/main/yajl-2.1.0-CVE-2017-16516.patch

- Required patch: https://gitlab.archlinux.org/archlinux/packaging/packages/yajl/-/raw/main/yajl-2.1.0-CVE-2022-24795.patch

- Required patch: https://gitlab.archlinux.org/archlinux/packaging/packages/yajl/-/raw/main/yajl-2.1.0-memory_leak.patch

- Required patch: https://github.com/lloyd/yajl/commit/6fe59ca50dfd65bdb3d1c87a27245b2dd1a072f9.patch

### yajl Dependencies

#### Required

CMake

## Installation of yajl

Since the last commit to this package is almost a decade old, issues have came up and need to be fixed before building. Apply required patches to fix the important ones:

    patch -Np1 -i ../yajl-2.1.0-CVE-2017-16516.patch &&
    patch -Np1 -i ../yajl-2.1.0-CVE-2022-24795.patch &&
    patch -Np1 -i ../yajl-2.1.0-memory_leak.patch

Fix building with CMake-4.0.0:

    patch -Np1 -i ../6fe59ca50dfd65bdb3d1c87a27245b2dd1a072f9.patch

Install yajl by running the following commands:

    mkdir build &&
    cd    build &&

    cmake -D CMAKE_INSTALL_PREFIX=/usr   \
          -D CMAKE_BUILD_TYPE=Release    \
          -D BUILD_SHARED_LIBS=ON        \
          -D CMAKE_SKIP_INSTALL_RPATH=ON \
          -W no-dev -G Ninja .. &&

    ninja

Now, as the `root` user:

    ninja install &&
    rm -vf /usr/lib/libyajl_s.a

## Command Explanations

`-D CMAKE_SKIP_INSTALL_RPATH=ON`: This switch makes cmake remove hardcoded library search paths (rpath) when installing a binary executable file or a shared library. This package does not need rpath once it's installed into the standard location, and rpath may sometimes cause unwanted effects or even security issues.

rm -vf /usr/lib/libyajl_s.a: This command removes a useless static library.

## Contents

Installed Programs: json_reformat and json_verify
Installed Libraries: libyajl
Installed Directories: /usr/include/yajl

### Short Descriptions

json_reformat | reformats JSON from STDIN
json_verify | validates JSON from STDIN
`libyajl` | provides functions that can help with parsing JSON in C

- Prev

  websocketpp-0.8.2

- Next

  yyjson-0.12.0

- Up
- Home