OpenJKDF2 icon indicating copy to clipboard operation
OpenJKDF2 copied to clipboard

Compilation error on Debian 12

Open toadkarter opened this issue 1 year ago • 1 comments

I'm trying to compile for Debian 12, and the build script seems to be failing at the point where it's trying to set up SDL_Mixer. Any idea what I might be doing wrong / what I should tweak in the CMake files? Error logs below.

-- Using vendored vorbis + vorbisfile
-- Configuring vorbis 1.3.7
-- Configuring done
CMake Error in external/vorbis/lib/CMakeLists.txt:
  export called with target "vorbis" which requires target "ogg" that is not
  in any export set.


-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.
make[3]: *** [CMakeFiles/SDL_mixer.dir/build.make:92: SDL_mixer-prefix/src/SDL_mixer-stamp/SDL_mixer-configure] Error 1
make[2]: *** [CMakeFiles/Makefile2:273: CMakeFiles/SDL_mixer.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:371: CMakeFiles/openjkdf2.dir/rule] Error 2
make: *** [Makefile:241: openjkdf2] Error 2

toadkarter avatar Apr 01 '25 21:04 toadkarter

Had the same issue

Fix

Edit file lib/SDL_mixer/external/ogg/CMakeLists.txt

around line 136

if(0)  # libsdl-org: cannot export a target twice (fixes 'export called with target "vorbis" which requires target "ogg" that is not in this export set, but in multiple other export sets')
export(EXPORT OggTargets NAMESPACE Ogg:: FILE OggTargets.cmake)
endif()

Should be export without the if statement

export(EXPORT OggTargets NAMESPACE Ogg:: FILE OggTargets.cmake)

Setup

Here is my setup using pod-man & docker-file mount the code as volume to /opt/openjkdf2

FROM debian:latest
# DOCKER BUILD FOR OpenJKDF2 will mount to /opt/openjkdf2
# 1. Build Docker / Podman
# 
#    podman build --tag openjkdf2 .
#
# 2. Compile code
#
#    podman run --rm -v ./:/opt/openjkdf2 openjkdf2 /usr/bin/bash /opt/run.sh
#
# 3. Run code:
#
#    LD_LIBRARY_PATH=build_linux64 ./build_linux64/openjkdf2

USER root:root
# Debain libcurl-dev  ==> libcurl4-openssl-dev
RUN  apt-get update && \
     apt-get install -y \ 
        git \
        build-essential \
        cmake \
        make \
        python3 \
        python3-pip \
        bison \
        imagemagick \
        libgtk-3-dev \
        protobuf-compiler \
        zsh \
        libpng-dev \
        libcurl4-openssl-dev

RUN python3 -m pip install --break-system-packages cogapp

# WIN 32

# RUN  apt-get install -y \
#         mingw-w64 \ 
# Linux 32-bit
# RUN  apt-get install -y \
#     multilib-devel lib32-sdl2 lib32-glew lib32-openal

# Linux 64-bit
RUN  apt-get install -y \ 
    clang libsdl2-dev libsdl2-mixer-dev libopenal-dev libglew-dev libssl-dev libprotobuf-dev


    # WebAssembly
# TODO find equivalents: emscripten

# Flatpak
# RUN  apt-get install -y \
#     flatpak qemu-user-static && \
#     flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo && \
#     flatpak install flathub org.freedesktop.Platform/aarch64/22.08 org.freedesktop.Sdk/aarch64/22.08 && \
#     flatpak install flathub org.freedesktop.Platform/x86_64/22.08 org.freedesktop.Sdk/x86_64/22.08 
ENV CC=clang
ENV CXX=clang++
RUN echo "cd /opt/openjkdf2 && /usr/bin/bash /opt/openjkdf2/build_linux64.sh" > /opt/run.sh

bluemner avatar May 10 '25 17:05 bluemner