🧐[Question] 我尝试为程序编写一个nixos的安装包,在过程中提示出错,请求帮助
🧐 问题描述
output.txt 当我根据strace处理依赖到 189009 openat(AT_FDCWD, "/nix/store/9z8ih4q26jnvdy3gvh9c2cc2yc7xdbpr-WattToolkit-3.0.0-rc.8/bin/assemblies/en/BD.WTTS.MicroServices.ClientSDK.resources.dll", O_RDONLY) = -1 ENOENT (No such file or directory) 发现是静态路径并且确实没有此文件,需要帮助.
🚑 其他信息
在 NixOS 中,由于其对包管理的独特处理方式,不能直接运行为通用 Linux 环境编译的动态链接可执行文件。 需要先添加依赖包,然后安装的时候把这个包的路径引入到软件中,这个过程是预先配置好的 这是正在调试的安装包配置文件 default.nix.txt
- 处理器体系结构:x64
- 系统版本号:NixOS 24.05
- 下载渠道:Github
- 程序版本:3.0.0.rc.8
- 是否包含独立运行时:?
正常应该是不存在下列文件的 就算处理依赖 目录中的 Steam++.deps.json 中也并不包含 该文件
BD.WTTS.MicroServices.ClientSDK.resources.dll
我看你是使用 发布的压缩包打包也不应该会有地方引用该文件
正常应该是不存在下列文件的 就算处理依赖 目录中的 Steam++.deps.json 中也并不包含 该文件
BD.WTTS.MicroServices.ClientSDK.resources.dll我看你是使用 发布的压缩包打包也不应该会有地方引用该文件
确实,但是实际实行的时候就尝试访问了。。。我并没有修改发布的文件……
正常应该是不存在下列文件的 就算处理依赖 目录中的 Steam++.deps.json 中也并不包含 该文件
BD.WTTS.MicroServices.ClientSDK.resources.dll我看你是使用 发布的压缩包打包也不应该会有地方引用该文件
正常应该是不存在下列文件的 就算处理依赖 目录中的 Steam++.deps.json 中也并不包含 该文件
BD.WTTS.MicroServices.ClientSDK.resources.dll我看你是使用 发布的压缩包打包也不应该会有地方引用该文件
我好想知道问题了 ,执行程序的命令是: "$link_exec" "$run_path/assemblies/Steam++.dll" "$@" 脚本替换掉是: /nix/store/4z363kk982cnaywc36cgcdsac7an5qif-dotnet-runtime-8.0.5/bin/dotnet "/nix/store/4a9dmz9afcccr0c75b9lc40z5bg2yx53-WattToolkit-3.0.0-rc.8/bin/assemblies/Steam++.dll" "$@"(nixos会转换特殊字符串,所以 "$@" 这个没有办法正常写入到sh脚本中) 问题出在第三个参数,如果加上了,会提示 192740 openat(AT_FDCWD, "/nix/store/4a9dmz9afcccr0c75b9lc40z5bg2yx53-WattToolkit-3.0.0-rc.8/bin/assemblies/en/BD.WTTS.MicroServices.ClientSDK.resources.dll", O_RDONLY) = -1 ENOENT (No such file or directory) 如果不加,能直接打开,但是无法访问网络加速模块,打开这个,程序就假死。
$@ 单纯是用来 传递 当前 Steam++.sh 获取的参数的
$@ 单纯是用来 传递 当前 Steam++.sh 获取的参数的
能运行,但是有点问题
- 点退出,窗口关了,小图标和后台关不掉,得强行kill.
- 无法打开网络加速选项卡。log:
2024-06-07 18:11:31.0335|Error|MainWindowViewModel|(Accelerator) Plugin.OnInitializeAsync fail. | System.ComponentModel.Win32Exception (2): An error occurred trying to start process '/bin/bash' with working directory '/home/wt'. No such file or directory
at System.Diagnostics.Process.ForkAndExecProcess(ProcessStartInfo startInfo, String resolvedFilename, String[] argv, String[] envp, String cwd, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at BD.WTTS.Services.Implementation.IPCMainProcessServiceImpl.StartSubProcessAsync(String fileName, Boolean isAdministrator, Action`1 configure)
at BD.WTTS.Plugins.Plugin.<OnInitializeAsync>b__21_0(IPCMainProcessService ipc)
at BD.WTTS.Services.Implementation.IPCMainProcessServiceImpl.AddDaemonWithStartSubProcessAsync(String moduleName, Func`2 delegate)
at BD.WTTS.Plugins.Plugin.OnInitializeAsync()
at BD.WTTS.UI.ViewModels.MainWindowViewModel.Initialize()
nixos没办法对dll进行修补,只能对可执行程序进行修补,我尝试 patchelf --replace-needed /bin/bash ${pkgs.bash}/bin/bash $out/bin/modules/Accelerator/Steam++.Accelerator 但是无效果.
看起来是 https://github.com/BeyondDimension/SteamTools/blob/0614e172b837e8c4611ec4adc1299c7c5f059184/src/BD.WTTS.Client/Services.Implementation/IPC/IPCMainProcessServiceImpl.cs#L130 这里设置工作目录 出现了问题 尝试使用/bin/bash 启动 检测是否具有执行权限
看起来是
https://github.com/BeyondDimension/SteamTools/blob/0614e172b837e8c4611ec4adc1299c7c5f059184/src/BD.WTTS.Client/Services.Implementation/IPC/IPCMainProcessServiceImpl.cs#L130
这里设置工作目录 出现了问题 尝试使用/bin/bash 启动 检测是否具有执行权限
whereis bash bash: /nix/store/6s5xr1g2vvyv1l4xs07kv05c7lhazsif-user-environment/bin/bash /nix/store/gq3g7dibjg2piwczsq109za9b0cr71b4-system-path/bin/bash
ls -l /bin/ lrwxrwxrwx - root 9 6月 15:06 sh -> /nix/store/rdd4pnr4x9rqc9wgbibhngv217w2xvxl-bash-interactive-5.2p26/bin/sh 只有一个sh
在 NixOS 中,/bin/bash 并不是一个有效的路径,因为 NixOS 不使用传统的文件系统布局。在 NixOS 中,所有的包都被安装到 /nix/store 目录下,每个包都有自己的目录。
你可以使用 bash 命令的绝对路径来替换 /bin/bash。你可以在终端中运行 which bash 命令来找到 bash 命令的绝对路径。
然后,你可以将 Process2.BinBash 替换为 bash 命令的绝对路径。例如:
#if LINUX
// 构建要执行的 shell 命令
var shellStr =
$"if [ -x \"{fileName}\" ]; then echo \"文件具有执行权限。\"; else chmod +x \"{fileName}\"; echo \"文件没有执行权限。\"; fi";
// Linux 启动子模块前需要判断是否有 Exec 执行权限
Process.Start("/nix/store/.../bin/bash", new string[]
{
"-c",
shellStr,
}).WaitForExit();
#endif
可能需要把这里改成传参?把bash的路径当作参数给指定一下,这种随机生成的目录没有办法写成静态的
修改传参也是下个版本的发布了 你可以尝试克隆源码自己修改一下 从脚本 sh 注入环境变量执行
修改传参也是下个版本的发布了 你可以尝试克隆源码自己修改一下 从脚本 sh 注入环境变量执行
我是.net C#的新手……编译指令是什么?问了github copilot问不到……,尝试了几个不是报错就是走完之后看不到文件在哪里.
我该选择什么版本的net进行编译?尝试了6.0,7.0,8.0,但是都有警告和错误,好像8.0能成功执行,但是系统上的是8.0.300,提示我需要runtime,你发布的版本可以使用系统的dotnet 8.0.300来执行
Linux 发布前需要准备
\SteamTools\src\BD.WTTS.Client.Avalonia.App\bin\Release\Publish 路径下需要
dotnet-Runtime 文件夹 下 Linux-X64 里面直接放 ASP.NET Core Linux 运行时 与 SDK 版本一致
ShellScript 文件夹 下 Linux 放 build\linux 里面的脚本 内容 注意 需要处理 为 LF 换行 Git 的换行符不对
8.0 SDK就可以 编译 BD.WTTS.Client.Tools.Publish 发布工具 然后找到程序启动文件
pub run --rids linux-x64 or pub.exe run --rids linux-x64
然后该目录会生成 最新的编译 tgz 打包以及程序目录
Linux 发布前需要准备
\SteamTools\src\BD.WTTS.Client.Avalonia.App\bin\Release\Publish路径下需要dotnet-Runtime文件夹 下Linux-X64里面直接放 ASP.NET Core Linux 运行时 与 SDK 版本一致ShellScript文件夹 下Linux放build\linux里面的脚本 内容 注意 需要处理 为 LF 换行 Git 的换行符不对 8.0 SDK就可以 编译 BD.WTTS.Client.Tools.Publish 发布工具 然后找到程序启动文件pub run --rids linux-x64orpub.exe run --rids linux-x64然后该目录会生成 最新的编译 tgz 打包以及程序目录
我更换成了windows下进行编译,一些初始环境报错没有了,但是有了下面的这些报错……
D:\create\SteamTools\src\BD.WTTS.Client.Plugins.Accelerator\UI\Views\Pages\AcceleratorPage2.axaml.cs(38,58): error CS0117: “ProxySettings”未包含“AcceleratorTabsSelectedIndex”的定义 [D:\create\Ste
amTools\src\BD.WTTS.Client.Plugins.Accelerator\BD.WTTS.Client.Plugins.Accelerator.csproj::TargetFramework=net8.0]
D:\create\SteamTools\src\BD.WTTS.Client.Plugins.Accelerator\UI\Views\Pages\AcceleratorPage2.axaml.cs(88,27): error CS0117: “ProxySettings”未包含“AcceleratorTabsSelectedIndex”的定义 [D:\create\Ste
amTools\src\BD.WTTS.Client.Plugins.Accelerator\BD.WTTS.Client.Plugins.Accelerator.csproj::TargetFramework=net8.0]
D:\create\SteamTools\src\BD.WTTS.Client.Plugins.Accelerator\UI\Views\Pages\AcceleratorPage2.axaml.cs(38,58): error CS0117: “ProxySettings”未包含“AcceleratorTabsSelectedIndex”的定义 [D:\create\Ste
amTools\src\BD.WTTS.Client.Plugins.Accelerator\BD.WTTS.Client.Plugins.Accelerator.csproj::TargetFramework=net8.0-macos]
D:\create\SteamTools\src\BD.WTTS.Client.Plugins.Accelerator\UI\Views\Pages\AcceleratorPage2.axaml.cs(88,27): error CS0117: “ProxySettings”未包含“AcceleratorTabsSelectedIndex”的定义 [D:\create\Ste
amTools\src\BD.WTTS.Client.Plugins.Accelerator\BD.WTTS.Client.Plugins.Accelerator.csproj::TargetFramework=net8.0-macos]
D:\create\SteamTools\src\BD.WTTS.Client.Plugins.Accelerator\UI\Views\Pages\AcceleratorPage2.axaml.cs(38,58): error CS0117: “ProxySettings”未包含“AcceleratorTabsSelectedIndex”的定义 [D:\create\Ste
amTools\src\BD.WTTS.Client.Plugins.Accelerator\BD.WTTS.Client.Plugins.Accelerator.csproj::TargetFramework=net8.0-windows10.0.19041.0]
D:\create\SteamTools\src\BD.WTTS.Client.Plugins.Accelerator\UI\Views\Pages\AcceleratorPage2.axaml.cs(88,27): error CS0117: “ProxySettings”未包含“AcceleratorTabsSelectedIndex”的定义 [D:\create\Ste
amTools\src\BD.WTTS.Client.Plugins.Accelerator\BD.WTTS.Client.Plugins.Accelerator.csproj::TargetFramework=net8.0-windows10.0.19041.0]
已用时间 00:00:13.66
Unhandled exception: System.ArgumentOutOfRangeException: Exception of type 'System.ArgumentOutOfRangeException' was thrown. (Parameter 'exitCode')
Actual value was 1.
at BD.WTTS.Client.Tools.Publish.Helpers.ProcessHelper.StartAndWaitForExit(ProcessStartInfo psi, Boolean ignoreExitCode)
at BD.WTTS.Client.Tools.Publish.Helpers.DotNetCLIHelper.StartProcessAndWaitForExit(String workingDirectory, String arguments)
at BD.WTTS.Client.Tools.Publish.Commands.IDotNetPublishCommand.PublishPlugins(Boolean isDebug, Platform platform, Architecture architecture, String publishDir, String configuration, String framework)
at BD.WTTS.Client.Tools.Publish.Commands.IDotNetPublishCommand.Handler(Boolean debug, String[] rids, Boolean force_sign, Boolean sha256, Boolean sha384, Boolean stm_upload, Boolean hsm_sign)
at System.CommandLine.Handler.<>c__DisplayClass8_0`7.<SetHandler>b__0(InvocationContext context)
at System.CommandLine.Invocation.AnonymousCommandHandler.Invoke(InvocationContext context)
at System.CommandLine.Invocation.AnonymousCommandHandler.InvokeAsync(InvocationContext context)
at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass19_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__18_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__5_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass8_0.<<UseExceptionHandler>b__0>d.MoveNext()
这个报错是代码有问题 选中 rc8 tag 处开始编译把
这个报错是代码有问题 选中 rc8 tag 处开始编译把
git describe --tags 3.0.0-rc.8 然后换了个错误:
D:\create\SteamTools\src\BD.WTTS.Client.Avalonia\UI\Views\Controls\OptionsDisplayItem.cs(175,13): error CS0246: 未能找到类型或
命名空间名“FABorder”(是否缺少 using 指令或程序集引用?) [D:\create\SteamTools\src\BD.WTTS.Client.Avalonia\BD.WTTS.Client.Avalonia.csproj:
:TargetFramework=net8.0]
Unhandled exception: System.ArgumentOutOfRangeException: Exception of type 'System.ArgumentOutOfRangeException' was thrown. (Parameter 'exitCode')
Actual value was 1.
at BD.WTTS.Client.Tools.Publish.Helpers.ProcessHelper.StartAndWaitForExit(ProcessStartInfo psi, Boolean ignoreExitCode)
at BD.WTTS.Client.Tools.Publish.Commands.IDotNetPublishCommand.Handler(Boolean debug, String[] rids, Boolean force_sign, Boolean sha256, Boolean sha384, Boolean stm_upload, Boolean hsm_sign)
at System.CommandLine.Handler.<>c__DisplayClass8_0`7.<SetHandler>b__0(InvocationContext context)
at System.CommandLine.Invocation.AnonymousCommandHandler.Invoke(InvocationContext context)
at System.CommandLine.Invocation.AnonymousCommandHandler.InvokeAsync(InvocationContext context)
at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass19_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__18_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__5_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass8_0.<<UseExceptionHandler>b__0>d.MoveNext()
切换分支需要 重新克隆子模块 子模块版本不对
git submodule update --recursive
切换分支需要 重新克隆子模块 子模块版本不对
git submodule update --recursive
好像难度和我想的有点出入,可以编译了,经过一些设置,启动时不会报模块错误了,但是接下来还有问题: 证书能添加,但是不能启动监听端口,软件界面上提示成功实际没有成功。没法打开证书文件夹和hosts文件夹(感觉还是路径不一样的问题,但是提示证书安装成功。)
应该是没法在沙盒环境加速的问题
应该是没法在沙盒环境加速的问题
Unhandled exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.DllNotFoundException: Unable to load shared library 'xunyoucall64.dll' 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: /nix/store/ck0j9vs04dpiw3n19d6p0n279giahg0g-WattToolkit-3.0.0-rc.8/bin/assemblies/xunyoucall64.dll.so: cannot open shared object file: No such file or directory 点卸载加速加速器插件程序报错退出,点安装加速器插件没反应. 我尝试使用sudo启动,certutil: function failed: SEC_ERROR_BAD_DATABASE: security library: bad database.这里报错,应该不完全是沙盒的问题,linux普通用户没办法监听1024一下的端口
程序又使用 setcup +bind 允许绑定 1024 以下端口的 应该是这个的执行也炸了
程序又使用 setcup +bind 允许绑定 1024 以下端口的 应该是这个的执行也炸了
有点难搞,nixos的安装阶段不允许使用sudo权限,安装完成以后输出文件就变只读的了,不允许更改,所以没有简单地方法…… security.wrappers.dotnet = { source = "${pkgs.dotnet-runtime_8}/bin/dotnet"; owner = "root"; group = "root"; permissions = "4755"; capabilities = "cap_net_bind_service=ep"; }; nixos可以单独设置,但是因为遵循规则的原因,这个是在系统配置中设置的,并且操作的逻辑也是把文件复制出来到/run/wrappers/bin/ 这个文件夹后再去设置执行权限
这样看起来要兼容这种沙盒环境 要处理的东西太多了 除了这个设置 后续如果模块安装需要设置权限也会爆炸。 而且安装到浏览器信任是 $HOME/中的 一个文件夹 谷歌浏览器默认从这个文件夹下读取证书数据库的这个也会有问题
这样看起来要兼容这种沙盒环境 要处理的东西太多了 除了这个设置 后续如果模块安装需要设置权限也会爆炸。 而且安装到浏览器信任是 $HOME/中的 一个文件夹 谷歌浏览器默认从这个文件夹下读取证书数据库的这个也会有问题
如果需要在前台安装模块,只能是安装到~/.local下……这种系统用起来确实舒服,但是程序开发起来有点头大……
我搞这个是因为本地令牌的确认交易模块提示证书不正确,我导入了SteamDeck_302,开启了代理,steam登录进去不去,但是先登录帐号,然后再启动加速器去访问商店和社区之类的是正常的。