#### Beyond Linux® From Scratch (System V Edition) - Version 12.3

### Chapter 9. General Libraries

- Prev

  SPIRV-Headers-1.4.304.1

- Next

  SPIRV-LLVM-Translator-19.1.4

- Up
- Home

# SPIRV-Tools-1.4.304.1

## Introduction to SPIRV-Tools

The SPIRV-Tools package contains libraries and utilities for processing SPIR-V modules.

This package is known to build and work properly using an LFS 12.3 platform.

### Package Information

- Download (HTTP): https://github.com/KhronosGroup/SPIRV-Tools/archive/vulkan-sdk-1.4.304.1/SPIRV-Tools-vulkan-sdk-1.4.304.1.tar.gz

- Download MD5 sum: b7fe16af4e1954b5479f3c55ca3eea9b

- Download size: 3.1 MB

- Estimated disk space required: 63 MB

- Estimated build time: 1.0 SBU (with tests; both using parallelism=8)

### SPIRV-Tools Dependencies

#### Required

CMake-3.31.5 and SPIRV-Headers-1.4.304.1

## Installation of SPIRV-Tools

Install SPIRV-Tools by running the following commands:

    mkdir build &&
    cd    build &&

    cmake -D CMAKE_INSTALL_PREFIX=/usr     \
          -D CMAKE_BUILD_TYPE=Release      \
          -D SPIRV_WERROR=OFF              \
          -D BUILD_SHARED_LIBS=ON          \
          -D SPIRV_TOOLS_BUILD_STATIC=OFF  \
          -D SPIRV-Headers_SOURCE_DIR=/usr \
          -G Ninja .. &&
    ninja

To test the results, issue: ninja test.

Now, as the `root` user:

    ninja install

## Command Explanations

`-D SPIRV_WERROR=OFF`: This switch stops the build system from treating warnings as errors.

`-D BUILD_SHARED_LIBS=ON`: This switch forces the build system to install shared libraries instead of static libraries.

`-D SPIRV_TOOLS_BUILD_STATIC=OFF`: This switch disables building static versions of the libraries.

`-D SPIRV-Headers_SOURCE_DIR`: This switch tells the build system that SPIRV-Headers-1.4.304.1 is installed in /usr. This is needed since the build system tries to use a copy at `external/spirv-headers` in the source directory by default and the copy is not shipped (i.e. you need to manually extract SPIRV-Headers-1.4.304.1 there if you want to build with the copy).

## Contents

Installed Programs: spirv-as, spirv-cfg, spirv-dis, spirv-lesspipe.sh, spirv-link, spirv-lint, spirv-objdump, spirv-opt, spirv-reduce, and spirv-val
Installed Libraries: libSPIRV-Tools-diff.so, libSPIRV-Tools-link.so, libSPIRV-Tools-lint.so, libSPIRV-Tools-opt.so, libSPIRV-Tools-reduce.so, libSPIRV-Tools-shared.so, and libSPIRV-Tools.so
Installed Directories: /usr/include/spirv-tools and /usr/lib/cmake/SPIRV-Tools

### Short Descriptions

spirv-as | creates a SPIR-V binary module from SPIR-V assembly text
spirv-cfg | shows the control flow graph in "dot" format
spirv-dis | disassembles a SPIR-V binary module
spirv-lesspipe.sh | automatically disassembles a .SPV file for 'less'
spirv-link | links SPIR-V binary files together
spirv-lint | checks a SPIR-V binary module for errors
spirv-objdump | dumps information from a SPIR-V binary
spirv-opt | performs optimizations on SPIR-V binary files
spirv-reduce | reduces a SPIR-V binary file
spirv-val | validates a SPIR-V binary file
`libSPIRV-Tools.so` | contains functions for processing SPIR-V modules

- Prev

  SPIRV-Headers-1.4.304.1

- Next

  SPIRV-LLVM-Translator-19.1.4

- Up
- Home