SPIRV-LLVM-Translator-21.1.3

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

### Chapter 10. Graphics APIs

- Prev

  Vulkan-SDK-1.4.341.0

- Next

  libatomic_ops-7.10.0

- Up
- Home

# SPIRV-LLVM-Translator-21.1.3

## Introduction to SPIRV-LLVM-Translator

SPIRV-LLVM-Translator is a tool and a library for bi-directional translation between SPIR-V and LLVM IR.

- Download: https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/v21.1.3/SPIRV-LLVM-Translator-21.1.3.tar.gz

### SPIRV-LLVM-Translator Dependencies

Required
CMake-4.2.3, libxml2-2.15.1, LLVM-21.1.8 (with Clang), and Vulkan-SDK-1.4.341.0

## Installation of SPIRV-LLVM-Translator

Install SPIRV-LLVM-Translator by running the following commands:

    mkdir build &&
    cd    build &&

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

    ninja

Now, as the `root` user:

    ninja install

## lib32 Installation of SPIRV-LLVM-Translator

Install lib32-SPIRV-LLVM-Translator by running the following commands:

    rm -rf * &&
    CC="gcc -m32" CXX="g++ -m32"                         \
    PKG_CONFIG_PATH=/usr/lib32/pkgconfig                 \
    cmake -D CMAKE_INSTALL_PREFIX=/usr                   \
          -D CMAKE_INSTALL_LIBDIR=lib32                  \
          -D CMAKE_BUILD_TYPE=Release                    \
          -D CMAKE_SKIP_INSTALL_RPATH=ON                 \
          -D BUILD_SHARED_LIBS=ON                        \
          -D LLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=/usr \
          -G Ninja .. &&

    ninja

Now, as the `root` user:

    DESTDIR=$PWD/DESTDIR ninja install    &&
    cp -vr DESTDIR/usr/lib32/* /usr/lib32 &&
    rm -rf DESTDIR                        &&
    ldconfig

## Command Explanations

### Note

For a full list of options and values, make sure you are in a build directory, then run cmake -LAH ...

`-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.

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

`-D LLVM_EXTERNAL_SPIRV_HEADERS_*`: These switches tells the build system that Vulkan-SDK-1.4.341.0 is installed in /usr. This is needed since the build system tries to download and use the downloaded headers not on the system if the switch isn't invoked.

## Contents

Installed Programs: llvm-spirv
Installed Libraries: libLLVMSPIRVLib
Installed Directories: /usr/include/libLLVMSPIRVLib

### Short Descriptions

llvm-spirv | translates LLVM bitcode and SPIR-V binaries
`libLLVMSPIRVLib` | contains functions for translating between SPIR-V and LLVM IR

- Prev

  Vulkan-SDK-1.4.341.0

- Next

  libatomic_ops-7.10.0

- Up
- Home