0

I've successfully built and ran a game engine I'm writing in Rust and am powering the graphics by SDL. The only problem is, SDL does not have the ability to load graphics support while compiled for x86_64-linux-musl.

When I compiled the X Server Client for Musl and tried to turn on X support, it refuses to turn on.

Portion of build-linux.yml

# Install Dependencies
- name: Update APT Package Manager
  run: sudo apt update
- name: Install APT Packages
  run: sudo apt -y install unzip musl-tools binutils patchelf # libtool autoconf musl musl-dev cmake gcc g++ libc6-dev-amd64-cross libgl1-mesa-dev libegl1-mesa-dev
- name: Install X Client Related APT Packages
  run: sudo apt -y install automake xutils-dev x11proto-dev libxcb1-dev xcb-proto python3-xcbgen

# ----------------------------------------
# Setup Build Environment
- name: Make Build Directory
  run: mkdir ${{ github.workspace }}/build
- name: Setup Build Environment
  run: |
    mkdir -p ${{ github.workspace }}/build/include
    ln -s /usr/include/X11 ${{ github.workspace }}/build/include/X11
    # ln -s /usr/include/xcb ${{ github.workspace }}/build/include/xcb

# Build Xauthority Handler
- name: Clone Xauthority Handler
  working-directory: ${{ github.workspace }}/build
  run: git clone https://gitlab.freedesktop.org/xorg/lib/libxau
- name: Create Configure Script
  working-directory: ${{ github.workspace }}/build/libxau
  run: ${{ github.workspace }}/build/libxau/autogen.sh
- name: Run Configure Script
  working-directory: ${{ github.workspace }}/build/libxau
  run: CFLAGS="-I${{ github.workspace }}/build/include" CC=musl-gcc ./configure --host x86_64-linux-gnu
- name: Make X C Binding
  working-directory: ${{ github.workspace }}/build/libxau
  run: make

# Build X C Binding
- name: Clone X C Binding
  working-directory: ${{ github.workspace }}/build
  run: git clone https://gitlab.freedesktop.org/xorg/lib/libxcb
- name: Create Configure Script
  working-directory: ${{ github.workspace }}/build/libxcb
  run: ${{ github.workspace }}/build/libxcb/autogen.sh
- name: Run Configure Script
  working-directory: ${{ github.workspace }}/build/libxcb
  run: CFLAGS="-I${{ github.workspace }}/build/libxau/include -I${{ github.workspace }}/build/include -L${{ github.workspace }}/build/libxau/.libs" CC=musl-gcc ./configure --host x86_64-linux-gnu
- name: Make X C Binding
  working-directory: ${{ github.workspace }}/build/libxcb
  run: make

# Build X Server Client
- name: Clone X Server Client
  working-directory: ${{ github.workspace }}/build
  run: git clone https://gitlab.freedesktop.org/xorg/lib/libx11.git
- name: Create Configure Script
  working-directory: ${{ github.workspace }}/build/libx11
  run: ${{ github.workspace }}/build/libx11/autogen.sh
- name: Run Configure Script
  working-directory: ${{ github.workspace }}/build/libx11
  run: CFLAGS="-I${{ github.workspace }}/build/include -L${{ github.workspace }}/build/libxcb/src/.libs" CC=musl-gcc ./configure --host x86_64-linux-gnu
- name: Make X Server Client
  working-directory: ${{ github.workspace }}/build/libx11
  run: make
# ----------------------------------------

# Build SDL2
- name: Deleting Old CMake Cache
  run: rm -rf ${{ github.workspace }}/android/app/jni/SDL/build
- name: Initialize CMake
  run: cmake -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/.toolchains/TC-musl-gcc.cmake -S ${{ github.workspace }}/android/app/jni/SDL -B ${{ github.workspace }}/android/app/jni/SDL/build -DCMAKE_BUILD_RPATH=/lib/x86_64-linux-musl # -DSDL_WAYLAND=OFF -DSDL_PULSEAUDIO=OFF -DSDL_IBUS=OFF
- name: Make SDL2
  run: cmake --build ${{ github.workspace }}/android/app/jni/SDL/build

I'm trying to make my game engine run on any x86_64 Linux distro without hassle or different distro specific packages. The project went from trying to not be stuck on a minimum version of glibc which was newer than what my own laptop used to now trying to add support for all the drivers you'd expect. This includes graphics, sound, bluetooth controller support, etc...

The goal is to make this run on any x86_64 Linux system without hassle on the end user and without licensing issues on my end (I use Zlib license to match SDL).

I mention licensing issues on my end as I'm packaging these libraries with my game engine and setting the runpaths in order to make the engine as standalone as possible. The only library I didn't package is libc.so from musl as there's a package for it in the Debian repo, but may have to package it anyway for other systems.

My laptop runs the latest glibc that Debian provides and the glibc on the Github Ubuntu Runner is significantly newer than that.

While this shouldn't be relevant to this question, as my question is more about building SDL than my game engine, but my game engine is written in Rust.

Alexis
  • 81
  • 7

0 Answers0