Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Unity] Linux Build DLL NotFound #941

Closed
orangeagain opened this issue Jul 31, 2022 · 17 comments
Closed

[Unity] Linux Build DLL NotFound #941

orangeagain opened this issue Jul 31, 2022 · 17 comments

Comments

@orangeagain
Copy link

orangeagain commented Jul 31, 2022

error log | 日志或报错信息

Fallback handler could not load library /home/user/桌面/33/1_Data/MonoBleedingEdge/x86_64/puerts
Fallback handler could not load library /home/user/桌面/33/1_Data/MonoBleedingEdge/x86_64/libpuerts.so
Fallback handler could not load library /home/user/桌面/33/1_Data/MonoBleedingEdge/x86_64/libpuerts.so
Fallback handler could not load library /home/user/桌面/33/1_Data/MonoBleedingEdge/x86_64/puerts
Fallback handler could not load library /home/user/桌面/33/1_Data/MonoBleedingEdge/x86_64/libpuerts
Fallback handler could not load library /home/user/桌面/33/1_Data/MonoBleedingEdge/x86_64/libpuerts.so
Fallback handler could not load library /home/user/桌面/33/1_Data/MonoBleedingEdge/x86_64/libpuerts.so
Fallback handler could not load library /home/user/桌面/33/1_Data/MonoBleedingEdge/x86_64/libpuerts
Fallback handler could not load library /home/user/桌面/33/1_Data/MonoBleedingEdge/x86_64/puerts
Fallback handler could not load library /home/user/桌面/33/1_Data/MonoBleedingEdge/x86_64/libpuerts.so
Fallback handler could not load library /home/user/桌面/33/1_Data/MonoBleedingEdge/x86_64/libpuerts.so
Fallback handler could not load library /home/user/桌面/33/1_Data/MonoBleedingEdge/x86_64/puerts
Fallback handler could not load library /home/user/桌面/33/1_Data/MonoBleedingEdge/x86_64/libpuerts
Fallback handler could not load library /home/user/桌面/33/1_Data/MonoBleedingEdge/x86_64/libpuerts.so
Fallback handler could not load library /home/user/桌面/33/1_Data/MonoBleedingEdge/x86_64/libpuerts.so
Fallback handler could not load library /home/user/桌面/33/1_Data/MonoBleedingEdge/x86_64/libpuerts
Fallback handler could not load library /home/user/桌面/33/1_Data/MonoBleedingEdge/x86_64/puerts
Fallback handler could not load library /home/user/桌面/33/1_Data/MonoBleedingEdge/x86_64/libpuerts.so
Fallback handler could not load library /home/user/桌面/33/1_Data/MonoBleedingEdge/x86_64/libpuerts.so
Fallback handler could not load library /home/user/桌面/33/1_Data/MonoBleedingEdge/x86_64/puerts
Fallback handler could not load library /home/user/桌面/33/1_Data/MonoBleedingEdge/x86_64/libpuerts
Fallback handler could not load library /home/user/桌面/33/1_Data/MonoBleedingEdge/x86_64/libpuerts.so
Fallback handler could not load library /home/user/桌面/33/1_Data/MonoBleedingEdge/x86_64/libpuerts.so
Fallback handler could not load library /home/user/桌面/33/1_Data/MonoBleedingEdge/x86_64/libpuerts
Fallback handler could not load library /home/user/桌面/33/1_Data/MonoBleedingEdge/x86_64/puerts
Fallback handler could not load library /home/user/桌面/33/1_Data/MonoBleedingEdge/x86_64/libpuerts.so
Fallback handler could not load library /home/user/桌面/33/1_Data/MonoBleedingEdge/x86_64/libpuerts.so
Fallback handler could not load library /home/user/桌面/33/1_Data/MonoBleedingEdge/x86_64/puerts
Fallback handler could not load library /home/user/桌面/33/1_Data/MonoBleedingEdge/x86_64/libpuerts
Fallback handler could not load library /home/user/桌面/33/1_Data/MonoBleedingEdge/x86_64/libpuerts.so
Fallback handler could not load library /home/user/桌面/33/1_Data/MonoBleedingEdge/x86_64/libpuerts.so
Fallback handler could not load library /home/user/桌面/33/1_Data/MonoBleedingEdge/x86_64/libpuerts
DllNotFoundException: puerts assembly:<unknown assembly> type:<unknown type> member:(null)
  at (wrapper managed-to-native) Puerts.PuertsDLL.GetLibVersion()
  at Puerts.PuertsDLL.GetApiLevel () [0x0000c] in H:\TianCai\Test\TestPuerTs\Assets\Plugins\Puerts\Runtime\Src\PuertsDLL.cs:95 
  at Puerts.JsEnv..ctor (Puerts.ILoader loader, System.Int32 debugPort, System.IntPtr externalRuntime, System.IntPtr externalContext) [0x00063] in H:\TianCai\Test\TestPuerTs\Assets\Plugins\Puerts\Runtime\Src\JsEnv.cs:82 
  at Puerts.JsEnv..ctor () [0x00000] in H:\TianCai\Test\TestPuerTs\Assets\Plugins\Puerts\Runtime\Src\JsEnv.cs:65 
  at test.Start () [0x00009] in H:\TianCai\Test\TestPuerTs\Assets\test.cs:14

context | 编译/运行环境

编译环境:Win10,Unity 2021.3.1f1c1
运行环境:Ubuntu

how to reproduce | 复现步骤

1.Unity build平台选择 standalone 或 Dedicated Server
2.编译时出现dll重复错误,临时删除Android文件夹解决
3.把build结果放在 ubuntu 里,无论是运行 Standalone Build 还是 Dedicated Server Build 都会出现如上的DLL缺失日志

more | 其他

仅仅出现在 Linux Build 里,不知道什么原因

@zombieyang
Copy link
Contributor

  1. 看看so文件是否存在于Plugins目录
  2. 看看import setting是否正确
  3. 使用objdump -x libxxxxx.so | grep NEEDED命令看看有没有缺失的系统库

@orangeagain
Copy link
Author

root@ecs-metaverse:~/game/39/build_Data/Plugins# objdump -x libpuerts.so | grep NEEDED
NEEDED libpthread.so.0
NEEDED libc++.so.1
NEEDED libc++abi.so.1
NEEDED libm.so.6
NEEDED libgcc_s.so.1
NEEDED libc.so.6
NEEDED ld-linux-x86-64.so.2

  1. 看看so文件是否存在于Plugins目录
  2. 看看import setting是否正确
  3. 使用objdump -x libxxxxx.so | grep NEEDED命令看看有没有缺失的系统库

您好,这是我命令运行的结果

@orangeagain
Copy link
Author

给了libpuerts.so执行权限就可以了

@Geequlim
Copy link
Contributor

Geequlim commented Mar 3, 2023

相同的问题,给libpuerts.so添加可执行权限也没能解决

@chexiongsheng
Copy link
Collaborator

相同的问题,给libpuerts.so添加可执行权限也没能解决

按这里安装下依赖库试试?#1220

@Geequlim
Copy link
Contributor

Geequlim commented Mar 6, 2023

@chexiongsheng 我使用的是 Arch Linux 发行版, 已经安装提及的库还是相同的报错

sudo pacman -S libc++ libc++abi libunwind 

如果是依赖缺失的话 unity 如何查看详细日志,看缺的是哪个符号吗?

@chexiongsheng
Copy link
Collaborator

@chexiongsheng 我使用的是 Arch Linux 发行版, 已经安装提及的库还是相同的报错

sudo pacman -S libc++ libc++abi libunwind 

如果是依赖缺失的话 unity 如何查看详细日志,看缺的是哪个符号吗?

ldd -r libpuerts.so

@Geequlim
Copy link
Contributor

Geequlim commented Mar 6, 2023

$ ldd -r libpuerts.so
	linux-vdso.so.1 (0x00007ffd2dda0000)
	libc++.so.1 => /usr/lib/libc++.so.1 (0x00007f10096fa000)
	libc++abi.so.1 => /usr/lib/libc++abi.so.1 (0x00007f10096b6000)
	libm.so.6 => /usr/lib/libm.so.6 (0x00007f10095ce000)
	libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f10095ae000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007f10093c7000)
	/usr/lib64/ld-linux-x86-64.so.2 (0x00007f100a751000)

@chexiongsheng
Copy link
Collaborator

那应该和文件依赖没关把,那你看看平台设置有没设置好,对应的meta文件有没提交

@Geequlim
Copy link
Contributor

Geequlim commented Mar 6, 2023

@chexiongsheng 确实是 meta 文件没配置好

@Geequlim
Copy link
Contributor

Geequlim commented Mar 6, 2023

记录一下,从 github 中下载到的文件中缺失了 libpuerts.so.meta 文件

这是我调整后能正常运行的文件
fileFormatVersion: 2
guid: 63a90f754f15d9c05b5d40e970d77afb
PluginImporter:
  externalObjects: {}
  serializedVersion: 2
  iconMap: {}
  executionOrder: {}
  defineConstraints: []
  isPreloaded: 0
  isOverridable: 0
  isExplicitlyReferenced: 0
  validateReferences: 1
  platformData:
  - first:
      : Any
    second:
      enabled: 0
      settings:
        Exclude Editor: 0
        Exclude Linux64: 0
        Exclude OSXUniversal: 0
        Exclude WebGL: 1
        Exclude Win: 0
        Exclude Win64: 0
  - first:
      Any: 
    second:
      enabled: 0
      settings: {}
  - first:
      Editor: Editor
    second:
      enabled: 1
      settings:
        CPU: x86_64
        DefaultValueInitialized: true
        OS: Linux
  - first:
      Standalone: Linux64
    second:
      enabled: 1
      settings:
        CPU: AnyCPU
  - first:
      Standalone: OSXUniversal
    second:
      enabled: 1
      settings:
        CPU: x86_64
  - first:
      Standalone: Win
    second:
      enabled: 1
      settings:
        CPU: None
  - first:
      Standalone: Win64
    second:
      enabled: 1
      settings:
        CPU: x86_64
  userData: 
  assetBundleName: 
  assetBundleVariant: 

@Geequlim
Copy link
Contributor

Geequlim commented Mar 6, 2023

导入的时候 Android 的库也会报错,查看了一下,不仅仅缺失了 Linux 库的 meta

@zombieyang
Copy link
Contributor

  1. 看看so文件是否存在于Plugins目录
  2. 看看import setting是否正确
  3. 使用objdump -x libxxxxx.so | grep NEEDED命令看看有没有缺失的系统库

这里的第二步其实就是检查meta的意思。。

这个问题问得比较频繁,准备在GetLibVersion处加trycatch统一提供这个提示

@zombieyang zombieyang reopened this Mar 6, 2023
@Geequlim
Copy link
Contributor

Geequlim commented Mar 6, 2023

为什么不提供配置好的 meta 文件呢?

@Geequlim
Copy link
Contributor

Geequlim commented Mar 6, 2023

这里记录一下 libunwind 库在 Arch Linux 下会存在链接失败的情况,从 GitHub release 下载到的 libpuerts.so 的依赖如下

$ ldd ./libpuerts.so     
	linux-vdso.so.1 (0x00007fff90900000)
	libc++.so.1 => /usr/lib/libc++.so.1 (0x00007f60ce584000)
	libunwind.so.1 => not found
	libc++abi.so.1 => /usr/lib/libc++abi.so.1 (0x00007f60ce540000)
	libm.so.6 => /usr/lib/libm.so.6 (0x00007f60cd518000)
	libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f60ce520000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007f60cd331000)
	/usr/lib64/ld-linux-x86-64.so.2 (0x00007f60ce6bb000

Arch Linux 安装 libunwind 后并没有 libunwind.so.1 这个文件

$ ls /usr/lib/libunwind* 
/usr/lib/libunwind-coredump.so        /usr/lib/libunwind-setjmp.so.0
/usr/lib/libunwind-coredump.so.0      /usr/lib/libunwind-setjmp.so.0.0.0
/usr/lib/libunwind-coredump.so.0.0.0  /usr/lib/libunwind.so
/usr/lib/libunwind-generic.so         /usr/lib/libunwind.so.8
/usr/lib/libunwind-ptrace.so          /usr/lib/libunwind.so.8.0.1
/usr/lib/libunwind-ptrace.so.0        /usr/lib/libunwind-x86_64.so
/usr/lib/libunwind-ptrace.so.0.0.0    /usr/lib/libunwind-x86_64.so.8
/usr/lib/libunwind-setjmp.so          /usr/lib/libunwind-x86_64.so.8.0.1

我在Arch Linux 下手动从源码编译的 libpuerts.so 的依赖项中并没有 libunwind

$ ldd ./build_linux_x64_v8_9.4/libpuerts.so
        linux-vdso.so.1 (0x00007ffe5c1dc000)
        libc++.so.1 => /usr/lib/libc++.so.1 (0x00007fc367afa000)
        libc++abi.so.1 => /usr/lib/libc++abi.so.1 (0x00007fc368b5a000)
        libm.so.6 => /usr/lib/libm.so.6 (0x00007fc367a12000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007fc368b3a000)
        libc.so.6 => /usr/lib/libc.so.6 (0x00007fc36782b000)
        /usr/lib64/ld-linux-x86-64.so.2 (0x00007fc368bcf000)

相关资料可参考:
gnss-sdr/gnss-sdr#639
gnss-sdr/gnss-sdr@fe4b83d

@zombieyang
Copy link
Contributor

为什么不提供配置好的 meta 文件呢?

upm安装是会带的。2.0开始release上下的也带了

@chexiongsheng
Copy link
Collaborator

这里记录一下 libunwind 库在 Arch Linux 下会存在链接失败的情况,从 GitHub release 下载到的 libpuerts.so 的依赖如下

$ ldd ./libpuerts.so     
	linux-vdso.so.1 (0x00007fff90900000)
	libc++.so.1 => /usr/lib/libc++.so.1 (0x00007f60ce584000)
	libunwind.so.1 => not found
	libc++abi.so.1 => /usr/lib/libc++abi.so.1 (0x00007f60ce540000)
	libm.so.6 => /usr/lib/libm.so.6 (0x00007f60cd518000)
	libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f60ce520000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007f60cd331000)
	/usr/lib64/ld-linux-x86-64.so.2 (0x00007f60ce6bb000

Arch Linux 安装 libunwind 后并没有 libunwind.so.1 这个文件

$ ls /usr/lib/libunwind* 
/usr/lib/libunwind-coredump.so        /usr/lib/libunwind-setjmp.so.0
/usr/lib/libunwind-coredump.so.0      /usr/lib/libunwind-setjmp.so.0.0.0
/usr/lib/libunwind-coredump.so.0.0.0  /usr/lib/libunwind.so
/usr/lib/libunwind-generic.so         /usr/lib/libunwind.so.8
/usr/lib/libunwind-ptrace.so          /usr/lib/libunwind.so.8.0.1
/usr/lib/libunwind-ptrace.so.0        /usr/lib/libunwind-x86_64.so
/usr/lib/libunwind-ptrace.so.0.0.0    /usr/lib/libunwind-x86_64.so.8
/usr/lib/libunwind-setjmp.so          /usr/lib/libunwind-x86_64.so.8.0.1

我在Arch Linux 下手动从源码编译的 libpuerts.so 的依赖项中并没有 libunwind

$ ldd ./build_linux_x64_v8_9.4/libpuerts.so
        linux-vdso.so.1 (0x00007ffe5c1dc000)
        libc++.so.1 => /usr/lib/libc++.so.1 (0x00007fc367afa000)
        libc++abi.so.1 => /usr/lib/libc++abi.so.1 (0x00007fc368b5a000)
        libm.so.6 => /usr/lib/libm.so.6 (0x00007fc367a12000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007fc368b3a000)
        libc.so.6 => /usr/lib/libc.so.6 (0x00007fc36782b000)
        /usr/lib64/ld-linux-x86-64.so.2 (0x00007fc368bcf000)

相关资料可参考: gnss-sdr/gnss-sdr#639 gnss-sdr/gnss-sdr@fe4b83d

github上release是在Ubuntu下编译的,如果是其它版本的linux,最好是自己编译一下(包括v8也是)。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants