simutrans

Simutrans 依存関係リファレンス

概要

このドキュメントでは、Simutrans のすべての依存ライブラリとその詳細を説明します。

目的

このドキュメントは以下の目的で作成されています:

対象読者:

必須依存関係

zlib

使用箇所

インストール

Ubuntu/Debian:

sudo apt-get install zlib1g-dev

Arch Linux:

sudo pacman -S zlib

macOS:

brew install zlib

Windows (vcpkg):

vcpkg install zlib:x64-windows-static

libpng

使用箇所

インストール

Ubuntu/Debian:

sudo apt-get install libpng-dev

Arch Linux:

sudo pacman -S libpng

macOS:

brew install libpng

Windows (vcpkg):

vcpkg install libpng:x64-windows-static

FreeType

使用箇所

インストール

Ubuntu/Debian:

sudo apt-get install libfreetype6-dev

Arch Linux:

sudo pacman -S freetype2

macOS:

brew install freetype

Windows (vcpkg):

vcpkg install freetype:x64-windows-static

bzip2

使用箇所

注意: bzip2 と zstd のどちらか一方が必要です。

vcpkg を使用する場合: vcpkg.json では zstd が指定されているため、Windows で vcpkg を使用する場合は zstd が自動的にインストールされます。

インストール

Ubuntu/Debian:

sudo apt-get install libbz2-dev

Arch Linux:

sudo pacman -S bzip2

macOS:

brew install bzip2

Windows (vcpkg):

vcpkg install bzip2:x64-windows-static

SDL2 (条件付き必須)

プラットフォーム要件

使用箇所

インストール

Ubuntu/Debian:

sudo apt-get install libsdl2-dev

Arch Linux:

sudo pacman -S sdl2

macOS:

brew install sdl2

Windows (vcpkg):

vcpkg install sdl2:x64-windows-static

オプション依存関係

zstd (Zstandard)

利点

欠点

インストール

Ubuntu/Debian:

sudo apt-get install libzstd-dev

Arch Linux:

sudo pacman -S zstd

macOS:

brew install zstd

Windows (vcpkg):

vcpkg install zstd:x64-windows-static

miniUPnPc

機能

インストール

Ubuntu/Debian:

sudo apt-get install libminiupnpc-dev

Arch Linux:

sudo pacman -S miniupnpc

macOS:

brew install miniupnpc

Windows (vcpkg):

vcpkg install miniupnpc:x64-windows-static

FluidSynth

推奨環境

機能

インストール

Ubuntu/Debian:

sudo apt-get install libfluidsynth-dev

Arch Linux:

sudo pacman -S fluidsynth

macOS:

brew install fluid-synth

注意: SoundFont ファイル(.sf2)も別途必要

SDL2_mixer

機能

インストール

Ubuntu/Debian:

sudo apt-get install libsdl2-mixer-dev

Arch Linux:

sudo pacman -S sdl2_mixer

macOS:

brew install sdl2_mixer

Windows (vcpkg):

vcpkg install sdl2-mixer:x64-windows-static

fontconfig

プラットフォーム

機能

インストール

Ubuntu/Debian:

sudo apt-get install libfontconfig1-dev

Arch Linux:

sudo pacman -S fontconfig

macOS:

brew install fontconfig

開発ツール依存関係

ビルドツール

autoconf

インストール:

# Ubuntu/Debian
sudo apt-get install autoconf

# Arch Linux
sudo pacman -S autoconf

# macOS
brew install autoconf

CMake

インストール:

# Ubuntu/Debian
sudo apt-get install cmake

# Arch Linux
sudo pacman -S cmake

# macOS
brew install cmake

# Windows
# CMake公式サイトからインストーラーをダウンロード

pkg-config

インストール:

# Ubuntu/Debian
sudo apt-get install pkg-config

# Arch Linux
sudo pacman -S pkgconf

# macOS
brew install pkg-config

コンパイラ

GCC

インストール:

# Ubuntu/Debian
sudo apt-get install build-essential

# Arch Linux
sudo pacman -S base-devel

# macOS
xcode-select --install

Clang

インストール:

# Ubuntu/Debian
sudo apt-get install clang

# Arch Linux
sudo pacman -S clang

# macOS(デフォルト)
xcode-select --install

MSVC

ダウンロード:

vcpkg 統合(Windows)

vcpkg とは

vcpkg.json

プロジェクトルートに配置:

{
	"version-string": "1.0.0",
	"dependencies": ["freetype", "miniupnpc", "pthread", "zstd", "sdl2", "zlib"],
	"builtin-baseline": "3c76dc55f8bd2b7f4824bcd860055094bfbbb9ea"
}

自動インストール

CMake と vcpkg を使用する場合、依存関係は自動的にビルド・インストールされます:

cmake .. -DCMAKE_TOOLCHAIN_FILE=[vcpkg-root]/scripts/buildsystems/vcpkg.cmake
cmake --build .

依存関係マトリックス

プラットフォーム別必須ライブラリ

ライブラリ Linux macOS Windows (SDL2) Windows (GDI)
zlib
libpng
FreeType
bzip2/zstd
SDL2
pthread システム システム vcpkg システム

バックエンド別依存関係

バックエンド 必要なライブラリ プラットフォーム
SDL2 SDL2, SDL2_mixer (opt) すべて
GDI - Windows 専用
Server - すべて(GUI 無し)

オプションライブラリ機能マトリックス

機能 なし bzip2 zstd
セーブファイル圧縮 zlib 高圧縮率 高速
ファイルサイズ 基準 小さい 中程度
圧縮速度 基準 遅い 速い
解凍速度 基準 中程度 速い
機能 なし FluidSynth SDL2_mixer
MIDI 再生 高品質 標準
効果音 -
セットアップ 簡単 複雑 簡単
SoundFont -

ライセンス互換性

すべての依存ライブラリは、Simutrans のライセンス(Artistic License 1.0)と互換性があります:

ライブラリ ライセンス 互換性
zlib zlib License ✓ OSI 承認
libpng libpng License ✓ OSI 承認
FreeType FreeType License ✓ BSD-style
bzip2 BSD-style ✓ OSI 承認
SDL2 zlib License ✓ OSI 承認
zstd BSD License ✓ OSI 承認
miniUPnPc BSD License ✓ OSI 承認
FluidSynth LGPL ✓ 動的リンク
SDL2_mixer zlib License ✓ OSI 承認
fontconfig MIT License ✓ OSI 承認

注意: FluidSynth は LGPL ですが、動的リンクにより使用可能です。

トラブルシューティング

ライブラリが見つからない

症状: configurecmakeが依存関係を検出できない

解決方法:

  1. pkg-config のパスを確認:

    pkg-config --variable pc_path pkg-config
    
  2. ライブラリが実際にインストールされているか確認:

    dpkg -l | grep libsdl2  # Ubuntu/Debian
    pacman -Q | grep sdl2   # Arch Linux
    brew list | grep sdl2   # macOS
    
  3. 開発パッケージがインストールされているか確認:

    • ヘッダーファイル(-dev または-devel パッケージ)が必要

バージョン競合

症状: 異なるバージョンのライブラリが競合

解決方法:

  1. インストール済みバージョンを確認:

    pkg-config --modversion sdl2
    
  2. 古いバージョンを削除:

    sudo apt-get remove --purge libsdl2-dev
    sudo apt-get autoremove
    
  3. 再インストール:

    sudo apt-get update
    sudo apt-get install libsdl2-dev
    

リンクエラー

症状: ビルドは成功するが実行時にライブラリが見つからない

解決方法:

  1. 共有ライブラリのパスを確認 (Linux):

    ldd ./build/default/sim
    
  2. LD_LIBRARY_PATH を設定:

    export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
    
  3. ldconfig を実行 (要 root 権限):

    sudo ldconfig
    

Windows 特有の問題

症状: vcpkg がライブラリをビルドできない

解決方法:

  1. vcpkg を最新に更新:

    cd [vcpkg-root]
    git pull
    .\bootstrap-vcpkg.bat
    
  2. キャッシュをクリア:

    .\vcpkg remove --outdated
    .\vcpkg install [package]:x64-windows-static --recurse
    
  3. マニフェストモードを使用:

    • vcpkg.json をプロジェクトルートに配置
    • CMake で自動管理

参考リンク

公式ドキュメント

ライブラリドキュメント


関連ファイル

依存関係管理

インストールスクリプト


まとめ

Simutrans の依存関係は、安定性と互換性を優先して設計されています:

主な特徴:

依存関係を準備したら、次は DEVELOPMENT_SETUP.md で開発環境を構築しましょう。


更新履歴

このドキュメントは定期的に更新されます。最新情報は以下で確認してください: