gpt4 book ai didi

flutter - 链接问题,即使 nm 在库中显示符号也找不到符号

转载 作者:行者123 更新时间:2023-12-02 10:53:24 25 4
gpt4 key购买 nike

我正在链接一个应用程序到 lflutter_linux_glfw . nm工具显示它有 glad_glTexImage2D :

nm libflutter_linux_glfw.so | grep glTexImage2D
00000000034e87a0 b glad_glTexImage2D
00000000034e87a8 b glad_glTexImage2DMultisample

所以我包括了 lflutter_linux_glfw.so之前 flutter_video_renderer.o ,我得到了这个:
clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)                   
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
"/usr/bin/ld" -z relro --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o /home/dev/orwell/orwell_flutter/linux/../build/linux/debug/flutter_desktop_example
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/../../../x86_64-linux-gnu/crt1.o /usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/../../../x86_64-linux-gnu/crti.o /usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/crtbegin.o
-L/home/dev/orwell/orwell_flutter/linux/../build/linux/debug/lib -L/usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0 -L/usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/../../../x86_64-linux-gnu -L/lib/x86_64-linux-gnu
-L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/../../.. -L/usr/lib/llvm-6.0/bin/../lib -L/lib -L/usr/lib -lflutter_linux_glfw
/home/dev/orwell/orwell_flutter/linux/../build/linux/obj/main.o /home/dev/orwell/orwell_flutter/linux/../build/linux/obj/flutter/generated_plugin_registrant.o
/home/dev/orwell/orwell_flutter/linux/../build/linux/obj//home/dev/orwell/orwell_flutter/linux/flutter/ephemeral/cpp_client_wrapper_glfw/flutter_window_controller.o
/home/dev/orwell/orwell_flutter/linux/../build/linux/obj//home/dev/orwell/orwell_flutter/linux/flutter/ephemeral/cpp_client_wrapper_glfw/plugin_registrar.o
/home/dev/orwell/orwell_flutter/linux/../build/linux/obj//home/dev/orwell/orwell_flutter/linux/flutter/ephemeral/cpp_client_wrapper_glfw/engine_method_result.o
/home/dev/orwell/orwell_flutter/linux/../build/linux/obj//home/dev/orwell/orwell_flutter/linux/flutter/ephemeral/cpp_client_wrapper_glfw/standard_codec.o
/home/dev/orwell/orwell_flutter/linux/../build/linux/obj//home/dev/orwell/orwell_flutter/common/src/flutter_video_renderer.o
/home/dev/orwell/orwell_flutter/linux/../build/linux/obj//home/dev/orwell/orwell_flutter/common/src/flutter_texture_video_renderer.o
/home/dev/orwell/orwell_flutter/linux/../build/linux/obj//home/dev/orwell/orwell_flutter/common/src/flutter_orwell_plugin.o "-rpath=\$ORIGIN/lib" -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/crtend.o /usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/../../../x86_64-linux-gnu/crtn.o
/home/dev/orwell/orwell_flutter/linux/../build/linux/obj//home/dev/orwell/orwell_flutter/common/src/flutter_texture_video_renderer.o: In function
`flutter_orwell_plugin::FlutterTextureVideoRenderer::renderToTexture(unsigned long, unsigned long, unsigned int)':
flutter_texture_video_renderer.cc:(.text+0x1b6): undefined reference to `glad_glTexImage2D'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/home/dev/orwell/orwell_flutter/linux/../build/linux/debug/flutter_desktop_example] Error 1

换句话说,它提示没有对 glad_glTexImage2D 的引用。即使它确实在 flutter_linux_glfw.so .我还尝试添加 flutter_linux_glfw.soflutter_texture_video_renderer.o 之后但我得到同样的错误

最佳答案

nm libflutter_linux_glfw.so | grep glTexImage2D
00000000034e87a0 b glad_glTexImage2D
00000000034e87a8 b glad_glTexImage2DMultisample



这些符号是库本地的(不是从库中导出的)。

您可以通过以下方式查看导出符号列表:
nm -D libflutter_linux_glfw.so

你会发现 glad_glTexImage2D没有在那里列出。

附言

I included lflutter_linux_glfw.so before flutter_video_renderer.o



这是你应该做的相反的顺序:库应该遵循引用它们的对象(尽管这对于共享库并不重要)。

关于flutter - 链接问题,即使 nm 在库中显示符号也找不到符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58331201/

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