Compiling libtiff Third-Party Component

Backgorund

The libtiff component in the stxdio_wrapper repository includes pre-built static library files. Since there were no existing build scripts, this guide explores creating a compilation script for libtiff.

Compilation Process

1. Source Repository

The source code can be found at: https://github.com/Hexagon-HTC/libtiff/tags

2. Build Script

#!/bin/bash
set -ex

# Set installation directory
INSTALL_DIR=$(cd "$(dirname "$0")";pwd)
echo "${INSTALL_DIR}"

# Prepare source directory
chmod -R 777 LibTIFF-v4.6.0
cd LibTIFF-v4.6.0

# Generate build configuration
./autogen.sh

# Configure and build
./configure --prefix=${INSTALL_DIR}/libtiff_output
make -j$(nproc)
make install

Key points about the script:

  • Uses ./autogen.sh instead of direct autogen.sh call
  • Specifies custom installation path with --prefix
  • Uses $(nproc) for optimal parallel compilation

3. Runtime Configuration

After isntallation, update library search path:

export LD_LIBRARY_PATH=${INSTALL_DIR}/libtiff_output/lib:$LD_LIBRARY_PATH

4. Build Dependencies

The autogen script reveals external dependencies:

#!/bin/sh
set -x
case `uname` in
  Darwin*)
    glibtoolize --force --copy
    ;;
  *)
    libtoolize --force --copy
    ;;
esac
aclocal -I ./m4
autoheader
automake --foreign --add-missing --copy
autoconf

# Fetch latest config files
for config_file in config.guess config.sub
do
    wget -q --timeout=5 -O config/${config_file}.tmp \
      "https://git.savannah.gnu.org/cgit/config.git/plain/${config_file}" \
      && mv -f config/${config_file}.tmp config/${config_file} \
      && chmod a+x config/${config_file}
    [ $? -eq 0 ] || exit $?
    rm -f config/${config_file}.tmp
done

This explains why pre-built libraries are often committed - the build process requires internet access to download configuration files.

Tags: libtiff compilation build-scripts third-party-libraries

Posted on Sat, 22 Aug 2026 16:42:34 +0000 by kris81