fix: 用可移植的 dlopen 方案替换内部 _dl_sym 符号,修复 GLIBC_PRIVATE 错误#175
Open
weapons97 wants to merge 1 commit intoProject-HAMi:mainfrom
Open
fix: 用可移植的 dlopen 方案替换内部 _dl_sym 符号,修复 GLIBC_PRIVATE 错误#175weapons97 wants to merge 1 commit intoProject-HAMi:mainfrom
weapons97 wants to merge 1 commit intoProject-HAMi:mainfrom
Conversation
Contributor
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: weapons97 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
将 _dl_sym(GLIBC_PRIVATE 符号)替换为 dlopen("libc.so.6") + dlsym(),
修复在 glibc 版本不兼容的容器环境中出现的
"undefined symbol: _dl_sym, version GLIBC_PRIVATE" 运行时错误。
涉及文件:
- src/libvgpu.c
- src/nvml/hook.c
- src/include/libvgpu.h
Signed-off-by: weipeng <weip3@chinatelecom.cn>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
本 PR 修复了在容器环境中运行 HAMi-core 时出现的 undefined symbol: _dl_sym, version GLIBC_PRIVATE 运行时错误。
问题
代码之前使用了 _dl_sym ,这是 glibc 的内部符号(GLIBC_PRIVATE 版本标签)。该符号不属于公共 API,并非在所有 glibc 版本中都可用,导致库在容器环境中无法加载。
错误信息:
解决方案
将所有 _dl_sym 的使用替换为使用 dlopen("libc.so.6") + dlsym() 的可移植方案:
修改内容
文件 修改内容 src/libvgpu.c 替换 dlsym() 和 preInit() 函数中的 _dl_sym src/nvml/hook.c 替换 load_nvml_libraries() 函数中的 _dl_sym src/include/libvgpu.h 移除 extern void* _dl_sym(...) 声明
影响
相关问题
修复: undefined symbol: _dl_sym, version GLIBC_PRIVATE 运行时错误