gpt4 book ai didi

ubuntu - `DllNotFoundException: libc` 尝试在 snap 包中运行单声道应用程序时

转载 作者:行者123 更新时间:2023-12-04 18:26:20 25 4
gpt4 key购买 nike

当尝试将单声道应用程序捆绑在 snap 包中时,当应用程序尝试发出简单的 HTTP 请求时,我会收到此异常:

System.AggregateException: One or more errors occurred. ---> System.DllNotFoundException: libc
at (wrapper managed-to-native) System.Platform:uname (intptr)
at System.Platform.CheckOS () [0x00022] in <bd46d4d4f7964dfa9beea098499ab597>:0
at System.Platform.get_IsMacOS () [0x0000a] in <bd46d4d4f7964dfa9beea098499ab597>:0
at System.Net.WebRequest.GetSystemWebProxy () [0x00149] in <bd46d4d4f7964dfa9beea098499ab597>:0
at System.Net.WebRequest.GetDefaultWebProxy () [0x00016] in <bd46d4d4f7964dfa9beea098499ab597>:0
at System.Net.WebRequest.get_DefaultWebProxy () [0x00024] in <bd46d4d4f7964dfa9beea098499ab597>:0
at System.Net.GlobalProxySelection.get_Select () [0x00000] in <bd46d4d4f7964dfa9beea098499ab597>:0
at System.Net.HttpWebRequest..ctor (System.Uri uri) [0x0008d] in <bd46d4d4f7964dfa9beea098499ab597>:0
at (wrapper remoting-invoke-with-check) System.Net.HttpWebRequest:.ctor (System.Uri)
at System.Net.Http.HttpClientHandler.CreateWebRequest (System.Net.Http.HttpRequestMessage request) [0x00006] in <41c316444c8a4380b9344ba09eeb18de>:0
at System.Net.Http.HttpClientHandler+<SendAsync>c__async0.MoveNext () [0x0006a] in <41c316444c8a4380b9344ba09eeb18de>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Net.Http.HttpClient+<SendAsyncWorker>c__async0.MoveNext () [0x000f3] in <41c316444c8a4380b9344ba09eeb18de>:0
--- End of inner exception stack trace ---
---> (Inner Exception #0) System.DllNotFoundException: libc
at (wrapper managed-to-native) System.Platform:uname (intptr)
at System.Platform.CheckOS () [0x00022] in <bd46d4d4f7964dfa9beea098499ab597>:0
at System.Platform.get_IsMacOS () [0x0000a] in <bd46d4d4f7964dfa9beea098499ab597>:0
at System.Net.WebRequest.GetSystemWebProxy () [0x00149] in <bd46d4d4f7964dfa9beea098499ab597>:0
at System.Net.WebRequest.GetDefaultWebProxy () [0x00016] in <bd46d4d4f7964dfa9beea098499ab597>:0
at System.Net.WebRequest.get_DefaultWebProxy () [0x00024] in <bd46d4d4f7964dfa9beea098499ab597>:0
at System.Net.GlobalProxySelection.get_Select () [0x00000] in <bd46d4d4f7964dfa9beea098499ab597>:0
at System.Net.HttpWebRequest..ctor (System.Uri uri) [0x0008d] in <bd46d4d4f7964dfa9beea098499ab597>:0
at (wrapper remoting-invoke-with-check) System.Net.HttpWebRequest:.ctor (System.Uri)
at System.Net.Http.HttpClientHandler.CreateWebRequest (System.Net.Http.HttpRequestMessage request) [0x00006] in <41c316444c8a4380b9344ba09eeb18de>:0
at System.Net.Http.HttpClientHandler+<SendAsync>c__async0.MoveNext () [0x0006a] in <41c316444c8a4380b9344ba09eeb18de>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Net.Http.HttpClient+<SendAsyncWorker>c__async0.MoveNext () [0x000f3] in <41c316444c8a4380b9344ba09eeb18de>:0 <---

System.AggregateException: One or more errors occurred. ---> System.DllNotFoundException: libc
at (wrapper managed-to-native) System.Platform:uname (intptr)
at System.Platform.CheckOS () [0x00022] in <bd46d4d4f7964dfa9beea098499ab597>:0
at System.Platform.get_IsMacOS () [0x0000a] in <bd46d4d4f7964dfa9beea098499ab597>:0
at System.Net.WebRequest.GetSystemWebProxy () [0x00149] in <bd46d4d4f7964dfa9beea098499ab597>:0
at System.Net.WebRequest.GetDefaultWebProxy () [0x00016] in <bd46d4d4f7964dfa9beea098499ab597>:0
at System.Net.WebRequest.get_DefaultWebProxy () [0x00024] in <bd46d4d4f7964dfa9beea098499ab597>:0
at System.Net.GlobalProxySelection.get_Select () [0x00000] in <bd46d4d4f7964dfa9beea098499ab597>:0
at System.Net.HttpWebRequest..ctor (System.Uri uri) [0x0008d] in <bd46d4d4f7964dfa9beea098499ab597>:0
at (wrapper remoting-invoke-with-check) System.Net.HttpWebRequest:.ctor (System.Uri)
at System.Net.Http.HttpClientHandler.CreateWebRequest (System.Net.Http.HttpRequestMessage request) [0x00006] in <41c316444c8a4380b9344ba09eeb18de>:0
at System.Net.Http.HttpClientHandler+<SendAsync>c__async0.MoveNext () [0x0006a] in <41c316444c8a4380b9344ba09eeb18de>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Net.Http.HttpClient+<SendAsyncWorker>c__async0.MoveNext () [0x000f3] in <41c316444c8a4380b9344ba09eeb18de>:0
--- End of inner exception stack trace ---
---> (Inner Exception #0) System.DllNotFoundException: libc
at (wrapper managed-to-native) System.Platform:uname (intptr)
at System.Platform.CheckOS () [0x00022] in <bd46d4d4f7964dfa9beea098499ab597>:0
at System.Platform.get_IsMacOS () [0x0000a] in <bd46d4d4f7964dfa9beea098499ab597>:0
at System.Net.WebRequest.GetSystemWebProxy () [0x00149] in <bd46d4d4f7964dfa9beea098499ab597>:0
at System.Net.WebRequest.GetDefaultWebProxy () [0x00016] in <bd46d4d4f7964dfa9beea098499ab597>:0
at System.Net.WebRequest.get_DefaultWebProxy () [0x00024] in <bd46d4d4f7964dfa9beea098499ab597>:0
at System.Net.GlobalProxySelection.get_Select () [0x00000] in <bd46d4d4f7964dfa9beea098499ab597>:0
at System.Net.HttpWebRequest..ctor (System.Uri uri) [0x0008d] in <bd46d4d4f7964dfa9beea098499ab597>:0
at (wrapper remoting-invoke-with-check) System.Net.HttpWebRequest:.ctor (System.Uri)
at System.Net.Http.HttpClientHandler.CreateWebRequest (System.Net.Http.HttpRequestMessage request) [0x00006] in <41c316444c8a4380b9344ba09eeb18de>:0
at System.Net.Http.HttpClientHandler+<SendAsync>c__async0.MoveNext () [0x0006a] in <41c316444c8a4380b9344ba09eeb18de>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Net.Http.HttpClient+<SendAsyncWorker>c__async0.MoveNext () [0x000f3] in <41c316444c8a4380b9344ba09eeb18de>:0 <---

snapcraft.yaml 看起来像这样:
name: foo
base: core18 # the base snap is the execution environment for this snap
version: '0.3.1.0' # just for humans, typically '1.2+git' or '1.3.2'
summary: bar
description: |
baz

grade: devel # must be 'stable' to release into candidate/stable channels
confinement: strict

apps:
foo:
command: bin/foo

parts:
foo:
plugin: dump
source: ./staging
stage-packages:
- mono-complete

我以这种方式创建快照:
./configure.sh --prefix=./staging
make
make install

snapcraft

我试图通过将 libc 相关的包捆绑到 snap 中来解决这个问题,并将它们添加到 stage-packages :
stage-packages:
- mono-complete
- libc6
- libc6-dev
- libc-dev-bin
- libc-bin

但问题仍然存在。如果我尝试用布局映射这些:
layout:
/lib/x86_64-linux-gnu:
bind: $SNAP/lib/x86_64-linux-gnu
/usr/lib:
bind: $SNAP/usr/lib

然后我崩溃了:
$ snap run foo
execv failed: No such file or directory

也许/usr/lib 映射太多了,但是如果我将其限制为:
layout:
/lib/x86_64-linux-gnu:
bind: $SNAP/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu:
bind: $SNAP/usr/lib/x86_64-linux-gnu

然后我仍然得到 DllNotFoundException。

最佳答案

我终于用这个提交解决了这个问题:
https://github.com/nblockchain/geewallet/commit/cba6abf52eaf2709b8b6a974079ac5713fd3aeec
最重要的一点是将其放在应用程序的启动器脚本中:

if [[ $SNAP ]]; then
PKG_DIR=$SNAP/usr

关于ubuntu - `DllNotFoundException: libc` 尝试在 snap 包中运行单声道应用程序时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59380449/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com