面向云技术架构 - 痴者工良

  • 首页
  • 工良写的电子书
    • kubernetes 教程
    • 从 C# 入门 Kafka
    • 多线程和异步
    • 动态编程-反射、特性、AOP
    • 表达式树
  • 本站文章导航
  • 隐私政策
愿有人陪你颠沛流离
遇到能让你付出的事物或者人,都是一种运气。
能遇到,就该珍惜。或许你们最终没能在一起,但你会切实地感受到力量。
正因为这样,那段相遇才变得有价值,才没有辜负这世间的每一段相遇。
  1. 首页
  2. 笔记和吹水
  3. 正文

alpine arm64 与 e_sqlite3' or one of its dependencies 异常解决方法

2020年12月10日 3118点热度 3人点赞 0条评论
内容纲要

Microsoft 官方的 Docker 镜像不能直接运行 EFCore,会出现异常:

      System.TypeInitializationException: The type initializer for 'Microsoft.Data.Sqlite.SqliteConnection' threw an exception.
       ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
       ---> System.DllNotFoundException: Unable to load shared library 'e_sqlite3' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: Error loading shared library libe_sqlite3: No such file or directory
         at System.Runtime.InteropServices.NativeLibrary.LoadByName(String libraryName, QCallAssembly callingAssembly, Boolean hasDllImportSearchPathFlag, UInt32 dllImportSearchPathFlag, Boolean throwOnError)
         at System.Runtime.InteropServices.NativeLibrary.LoadLibraryByName(String libraryName, Assembly assembly, Nullable`1 searchPath, Boolean throwOnError)
         at System.Runtime.InteropServices.NativeLibrary.Load(String libraryName, Assembly assembly, Nullable`1 searchPath)
         at SQLitePCL.NativeLibrary.Load(String libraryName, Assembly assy, Int32 flags)
         at SQLitePCL.Batteries_V2.MakeDynamic(String name, Int32 flags)
         at SQLitePCL.Batteries_V2.DoDynamic_cdecl(String name, Int32 flags)
         at SQLitePCL.Batteries_V2.Init()
         --- End of inner exception stack trace ---
         at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
         at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
         at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
         at Microsoft.Data.Sqlite.Utilities.BundleInitializer.Initialize()
         at Microsoft.Data.Sqlite.SqliteConnection..cctor()

file

我们在 Linux 中,打开程序目录的 runtimes 中,找到 linux-arm64 目录,执行 ldd 命令,检测 .so 文件的依赖:

 ldd libe_sqlite3.so
        /lib/ld-musl-aarch64.so.1 (0xffffa9187000)
        libc.so.6 => /lib/ld-musl-aarch64.so.1 (0xffffa9187000)
Error loading shared library ld-linux-aarch64.so.1: No such file or directory (needed by libe_sqlite3.so)
Error relocating libe_sqlite3.so: __memcpy_chk: symbol not found
Error relocating libe_sqlite3.so: __memset_chk: symbol not found

发现 缺少 libc 库,可执行以下命令安装:

 apk add libc6-compat

重启程序或容器,即可正常使用。
file

本作品采用 知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议 进行许可
标签: alpine arm dependencies its sqlite
最后更新:2020年12月10日

痴者工良

高级程序员劝退师

点赞
< 上一篇
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

COPYRIGHT © 2022 whuanle.cn. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

粤ICP备18051778号

粤公网安备 44030902003257号