IceReaper / OpenKrush

A KKnD and KKnD2 mod on OpenRA engine.
https://kknd-game.com
GNU General Public License v3.0
101 stars 6 forks source link

Trying to package for AUR and getting the launch error: Could not find a part of the path '/usr/lib/glsl/combined.vert' #179

Open fusion809 opened 1 year ago

fusion809 commented 1 year ago

I've been trying to package this mod for the Arch User Repository (AUR), or rather update my existing package for it so that it builds and runs successfully. The problem is that I get the following error contained within graphics.log whenever I try and launch OpenKrush:

System.IO.DirectoryNotFoundException: Could not find a part of the path '/usr/lib/glsl/combined.vert'.
   at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream, String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
   at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize)
   at System.IO.File.InternalReadAllText(String path, Encoding encoding)
   at System.IO.File.ReadAllText(String path)
   at OpenRA.Platforms.Default.Shader.CompileShaderObject(Int32 type, String name)
   at OpenRA.Platforms.Default.Shader..ctor(String name)
   at OpenRA.Platforms.Default.Sdl2GraphicsContext.CreateShader(String name)
   at OpenRA.Platforms.Default.ThreadedGraphicsContext.<>c__DisplayClass23_0.<RenderThread>b__9(Object name)
   at OpenRA.Platforms.Default.ThreadedGraphicsContext.Message.Execute()
--- End of stack trace from previous location ---
   at OpenRA.Platforms.Default.ThreadedGraphicsContext.Message.Result()
   at OpenRA.Platforms.Default.ThreadedGraphicsContext.RunMessage(Message message)
   at OpenRA.Platforms.Default.ThreadedGraphicsContext.Send[T](Func`2 method, Object state)
   at OpenRA.Platforms.Default.ThreadedGraphicsContext.CreateShader(String name)
   at OpenRA.Renderer..ctor(IPlatform platform, GraphicSettings graphicSettings)
   at OpenRA.Game.Initialize(Arguments args)
System.IO.DirectoryNotFoundException: Could not find a part of the path '/usr/lib/glsl/combined.vert'.
   at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream, String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
   at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize)
   at System.IO.File.InternalReadAllText(String path, Encoding encoding)
   at System.IO.File.ReadAllText(String path)
   at OpenRA.Platforms.Default.Shader.CompileShaderObject(Int32 type, String name)
   at OpenRA.Platforms.Default.Shader..ctor(String name)
   at OpenRA.Platforms.Default.Sdl2GraphicsContext.CreateShader(String name)
   at OpenRA.Platforms.Default.ThreadedGraphicsContext.<>c__DisplayClass23_0.<RenderThread>b__9(Object name)
   at OpenRA.Platforms.Default.ThreadedGraphicsContext.Message.Execute()
--- End of stack trace from previous location ---
   at OpenRA.Platforms.Default.ThreadedGraphicsContext.Message.Result()
   at OpenRA.Platforms.Default.ThreadedGraphicsContext.RunMessage(Message message)
   at OpenRA.Platforms.Default.ThreadedGraphicsContext.Send[T](Func`2 method, Object state)
   at OpenRA.Platforms.Default.ThreadedGraphicsContext.CreateShader(String name)
   at OpenRA.Renderer..ctor(IPlatform platform, GraphicSettings graphicSettings)
   at OpenRA.Game.Initialize(Arguments args)

I have stored the .dll, .so and *.json files from the engine directory (and its bin subdirectory) in /usr/lib/openra-kknd. I've also stored glsl, lua, mods/{common,modcontent,openkrush,openkrush_gen1} in /usr/lib/openra-kknd. To make it clear what the structure of this folder is this is what tree -L 2 /usr/lib/openra-kknd returns:

/usr/lib/openra-kknd ├── AUTHORS ├── BeaconLib.dll ├── COPYING ├── DiscordRPC.dll ├── Eluant.dll ├── Eluant.dll.config ├── freetype6.so ├── FuzzyLogicLibrary.dll ├── global mix database.dat ├── glsl │   ├── combined.frag │   ├── combined.vert │   ├── model.frag │   └── model.vert ├── ICSharpCode.SharpZipLib.dll ├── Linguini.Bundle.dll ├── Linguini.Shared.dll ├── Linguini.Syntax.dll ├── lua │   ├── sandbox.lua │   ├── scriptwrapper.lua │   └── stacktraceplus.lua ├── lua51.so ├── Microsoft.Extensions.DependencyModel.dll ├── mod.config ├── mods │   ├── common │   ├── modcontent │   ├── openkrush │   └── openkrush_gen1 ├── Mono.Nat.dll ├── MP3Sharp.dll ├── Newtonsoft.Json.dll ├── NVorbis.dll ├── OpenAL-CS.Core.dll ├── OpenAL-CS.Core.dll.config ├── OpenRA.deps.json ├── OpenRA.dll ├── OpenRA.dll.config ├── OpenRA.Game.deps.json ├── OpenRA.Game.dll ├── OpenRA.Mods.Cnc.deps.json ├── OpenRA.Mods.Cnc.dll ├── OpenRA.Mods.Common.deps.json ├── OpenRA.Mods.Common.dll ├── OpenRA.Mods.D2k.deps.json ├── OpenRA.Mods.D2k.dll ├── OpenRA.Mods.OpenKrush.deps.json ├── OpenRA.Mods.OpenKrush.dll ├── OpenRA.Platforms.Default.deps.json ├── OpenRA.Platforms.Default.dll ├── OpenRA.Platforms.Default.dll.config ├── OpenRA.runtimeconfig.json ├── OpenRA.Server.deps.json ├── OpenRA.Server.dll ├── OpenRA.Server.runtimeconfig.json ├── OpenRA.Utility.deps.json ├── OpenRA.Utility.dll ├── OpenRA.Utility.runtimeconfig.json ├── Pfim.dll ├── SDL2-CS.dll ├── SDL2-CS.dll.config ├── SDL2.so ├── soft_oal.so ├── TagLibSharp.dll └── VERSION

I launch the game using a script with the contents:

#!/bin/sh

set -e
if ! command -v mono >/dev/null 2>&1; then
    command -v dotnet >/dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK requires dotnet or mono."; exit 1; }
fi

if command -v python3 >/dev/null 2>&1; then
    PYTHON="python3"
else
    command -v python >/dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK requires python."; exit 1; }
    PYTHON="python"
fi

require_variables() {
    missing=""
    for i in "$@"; do
        eval check="\$$i"
        [ -z "${check}" ] && missing="${missing}   ${i}\n"
    done
    if [ ! -z "${missing}" ]; then
        echo "Required mod.config variables are missing:\n${missing}Repair your mod.config (or user.config) and try again."
        exit 1
    fi
}

TEMPLATE_LAUNCHER=$(${PYTHON} -c "import os; print(os.path.realpath('$0'))")
PRELIM_MOD_ID=$(echo $TEMPLATE_LAUNCHER | cut -d '/' -f 4)
TEMPLATE_ROOT=/usr/lib/$PRELIM_MOD_ID
MOD_SEARCH_PATHS="${TEMPLATE_ROOT}/mods,./mods"

# shellcheck source=mod.config
. "${TEMPLATE_ROOT}/mod.config"

if [ -f "${TEMPLATE_ROOT}/user.config" ]; then
    # shellcheck source=user.config
    . "${TEMPLATE_ROOT}/user.config"
fi

require_variables "MOD_ID" "ENGINE_VERSION" "ENGINE_DIRECTORY"

cd "${TEMPLATE_ROOT}"
if [ ! -f "${ENGINE_DIRECTORY}/OpenRA.dll" ] || [ "$(cat "${ENGINE_DIRECTORY}/VERSION")" != "${ENGINE_VERSION}" ]; then
    echo "Required engine files not found."
    echo "Run \`make\` in the mod directory to fetch and build the required files, then try again.";
    exit 1
fi

if command -v mono >/dev/null 2>&1 && [ "$(grep -c .NETCoreApp,Version= ${ENGINE_DIRECTORY}/OpenRA.dll)" = "0" ]; then
    RUNTIME_LAUNCHER="mono --debug"
else
    RUNTIME_LAUNCHER="dotnet"
fi

cd "${ENGINE_DIRECTORY}"
${RUNTIME_LAUNCHER} OpenRA.dll Engine.EngineDir=".." Engine.LaunchPath="${TEMPLATE_LAUNCHER}" "Engine.ModSearchPaths=${MOD_SEARCH_PATHS}" Game.Mod="${MOD_ID}" "$@"

mod.config has been modified so that ENGINE_DIRECTORY is set to /usr/lib/openra-kknd. I have no idea how to fix this error as no file called combined.vert exists within the OpenKrush directory after running make in it.

Thanks for your help.

IceReaper commented 1 year ago

I need to rebase on latest release engine anyway, that will change some of the packaging files. Might be possible that this also fixes it. Will do that soon