Open UlyssesZh opened 6 months ago
@UlyssesZh have you tried with .net 6 ? Please try to use tag
instead of specific commit in fetchFromGitHub
have you tried with .net 6 ?
I tried .NET 6, and it has this error:
error NETSDK1045: The current .NET SDK does not support targeting .NET 8.0. Either target .NET 6.0 or lower, or use a version of the .NET SDK that supports .NET 8.0.
According to the error, I can only use .NET 8.
Please try to use
tag
instead of specific commit infetchFromGitHub
At the time of me initially packaging it, I encountered bugs and I submitted a pr to upstream. The pr was not merged at that time, so I used my own commit as rev temporarily. Now it has already been merged and included in a new release.
Just now I tried this:
{ fetchFromGitHub
, buildDotnetModule
, lib
, dotnetCorePackages
, gcc
, ncurses
, zlib
} :
let
vmr = dotnetCorePackages.dotnet_8.vmr;
sdk = dotnetCorePackages.dotnet_8.sdk;
in buildDotnetModule rec {
pname = "asset-ripper";
version = "1.0.11";
src = fetchFromGitHub {
owner = "AssetRipper";
repo = "AssetRipper";
rev = version;
hash = "sha256-dfc1t2xw4RBEG882Xdhh8XP4y5aLMC7jUbkeIYDenxE=";
};
nativeBuildInputs = [ gcc vmr zlib ncurses ];
dotnet-sdk = sdk;
projectFile = "Source/AssetRipper.GUI.Free/AssetRipper.GUI.Free.csproj"; # #220985
selfContainedBuild = true;
nugetDeps = ./deps.nix;
meta = with lib; {
description = "A tool for extracting assets from Unity serialized files and asset bundles and converting them into the native Unity engine format.";
homepage = "https://assetripper.github.io/AssetRipper/";
license = licenses.gpl3;
maintainers = with maintainers; [ ulysseszhan ];
mainProgram = "AssetRipper";
platforms = platforms.all;
};
}
The error is now
asset-ripper> EXEC : error : Unable to load shared library 'jitinterface_x64' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable: [/build/source/Source/AssetRipper.GUI.Free/AssetRipper.GUI.Free.csproj]
asset-ripper> jitinterface_x64.so: cannot open shared object file: No such file or directory
asset-ripper> libjitinterface_x64.so: cannot open shared object file: No such file or directory
asset-ripper> jitinterface_x64: cannot open shared object file: No such file or directory
asset-ripper> libjitinterface_x64: cannot open shared object file: No such file or directory
asset-ripper> System.DllNotFoundException: Unable to load shared library 'jitinterface_x64' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable:
asset-ripper> jitinterface_x64.so: cannot open shared object file: No such file or directory
asset-ripper> libjitinterface_x64.so: cannot open shared object file: No such file or directory
asset-ripper> jitinterface_x64: cannot open shared object file: No such file or directory
asset-ripper> libjitinterface_x64: cannot open shared object file: No such file or directory
asset-ripper> at System.Runtime.InteropServices.NativeLibrary.LoadLibErrorTracker.Throw(String) + 0x46
asset-ripper> at System.Runtime.InteropServices.NativeLibrary.Load(String, Assembly, Nullable`1) + 0xd7
asset-ripper> at Internal.JitInterface.JitConfigProvider.<>c__DisplayClass5_0.<Initialize>b__0(String libName, Assembly assembly, Nullable`1 searchPath) + 0x157
asset-ripper> at System.Runtime.InteropServices.NativeLibrary.LoadLibraryCallbackStub(String, Assembly, Boolean, UInt32) + 0xa0
asset-ripper> at Internal.Runtime.CompilerHelpers.InteropHelpers.FixupModuleCell(InteropHelpers.ModuleFixupCell*) + 0x71
asset-ripper> at Internal.Runtime.CompilerHelpers.InteropHelpers.ResolvePInvokeSlow(InteropHelpers.MethodFixupCell*) + 0x35
asset-ripper> at Internal.JitInterface.CorInfoImpl.GetJitHost(IntPtr) + 0x30
asset-ripper> at Internal.JitInterface.CorInfoImpl.Startup(CORINFO_OS) + 0x1f
asset-ripper> at ILCompiler.RyuJitCompilationBuilder.ToCompilation() + 0x413
asset-ripper> at ILCompiler.Program.Run() + 0x2825
asset-ripper> at ILCompiler.ILCompilerRootCommand.<>c__DisplayClass227_0.<.ctor>b__0(ParseResult result) + 0x310
asset-ripper> /build/tmp.gP47nywV9f/.nuget/packages/microsoft.dotnet.ilcompiler/8.0.2/build/Microsoft.NETCore.Native.targets(308,5): error MSB3073: The command ""/build/tmp.gP47nywV9f/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/8.0.2/tools/ilc" @"../0Bins/obj/AssetRipper.GUI.Free/Release/linux-x64/native/AssetRipper.GUI.Free.ilc.rsp"" exited with code 1. [/build/source/Source/AssetRipper.GUI.Free/AssetRipper.GUI.Free.csproj]
Seems related to #280923.
aot can be disabled (as temporary fix, untill https://github.com/NixOS/nixpkgs/pull/306161 or https://github.com/NixOS/nixpkgs/pull/267743 are merged) with
dotnetFlags = [ "-p:PublishAot=false" ];
I have written a derivation that allowed me to use the program to successfully extract assets.
Some notes:
@UlyssesZh Can you verify if this works for you?
{ pkgs ? import <nixpkgs> { system = builtins.currentSystem; }
, lib ? pkgs.lib
, buildDotnetModule ? pkgs.buildDotnetModule
, fetchFromGitHub ? pkgs.fetchFromGitHub
}:
buildDotnetModule rec {
pname = "AssetRipper";
version = "1.0.18";
src = fetchFromGitHub {
owner = "AssetRipper";
repo = pname;
rev = "${version}";
hash = "sha256-kTYszFsGchRXED7pCn8D2RlN+7IwAhtKZycXXDoMkOA=";
};
patches = [
(pkgs.writeText "assertripper.patch"
''
diff --git a/Source/AssetRipper.IO.Files/Utils/TemporaryFileStorage.cs b/Source/AssetRipper.IO.Files/Utils/TemporaryFileStorage.cs
index e5b8a41..1348dc5 100644
--- a/Source/AssetRipper.IO.Files/Utils/TemporaryFileStorage.cs
+++ b/Source/AssetRipper.IO.Files/Utils/TemporaryFileStorage.cs
@@ -2,7 +2,7 @@
public static class TemporaryFileStorage
{
- private static string ExecutingDirectory => AppContext.BaseDirectory;
+ private static string ExecutingDirectory => System.Environment.CurrentDirectory;
public static string LocalTemporaryDirectory { get; } = Path.Combine(ExecutingDirectory, "temp", GetRandomString()[0..4]);
diff --git a/Source/AssetRipper.Import/Utils/ExecutingDirectory.cs b/Source/AssetRipper.Import/Utils/ExecutingDirectory.cs
index 9a510a0..d15b81e 100644
--- a/Source/AssetRipper.Import/Utils/ExecutingDirectory.cs
+++ b/Source/AssetRipper.Import/Utils/ExecutingDirectory.cs
@@ -4,7 +4,7 @@
{
static ExecutingDirectory()
{
- Info = new DirectoryInfo(AppContext.BaseDirectory);
+ Info = new DirectoryInfo(System.Environment.CurrentDirectory);
}
public static DirectoryInfo Info { get; }
'')
];
nativeBuildInputs = [
pkgs.autoPatchelfHook
];
autoPatchelfIgnoreMissingDeps = [ "*" ];
buildInputs = [
pkgs.dbus.lib
];
projectFile = "./Source/AssetRipper.GUI.Free/AssetRipper.GUI.Free.csproj";
dotnetInstallFlags = [ "-p:PublishAot=false" ];
nugetDeps = ./deps.nix;
executables = [ "AssetRipper.GUI.Free" ];
dotnet-sdk = pkgs.dotnetCorePackages.sdk_8_0;
dotnet-runtime = pkgs.dotnetCorePackages.dotnet_8.aspnetcore;
}
@diadatp If this works for you, I think it would be better to open a PR and to continue discussing your packaging in your PR. I could try to package it based on your packaging, but I don't want to steal your work and currently don't have time for that.
Project description
A tool for extracting Unity serialized files.
Metadata
My attempt
Failed with compilation errors:
Add a :+1: reaction to issues you find important.