-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Fix core so name mismatch error #43977
Fix core so name mismatch error #43977
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
@@ -578,7 +578,8 @@ if '${CMAKE_BUILD_TYPE}' == 'Release': | |||
commands = ["install_name_tool -id '@loader_path/../libs/' ${PADDLE_BINARY_DIR}/python/paddle/fluid/${FLUID_CORE_NAME}" + '.so'] | |||
commands.append("install_name_tool -add_rpath '@loader_path/../libs/' ${PADDLE_BINARY_DIR}/python/paddle/fluid/${FLUID_CORE_NAME}" + '.so') | |||
else: | |||
commands = ["patchelf --set-rpath '$ORIGIN/../libs/' ${PADDLE_BINARY_DIR}/python/paddle/fluid/${FLUID_CORE_NAME}" + '.so'] | |||
commands = ["patchelf --set-soname '${FLUID_CORE_NAME}.so' ${PADDLE_BINARY_DIR}/python/paddle/fluid/${FLUID_CORE_NAME}" + '.so'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个会再创建一个软链接吗 还是直接改名字
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不会,直接改名字
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* fix core avx soname error * remove print info
PR types
Bug fixes
PR changes
Others
Describe
Fix core so name mismatch error
paddle编译完成后,将libpaddle_pybind.so copy为core_(no)avx.so,但是并没有更新其soname,其soname仍然是libpaddle_pybind.so,这导致外部链接的时候会找不到的libpaddle_pybind.so,示例如下
因此本PR修复该问题,修复之后,core_avx.so信息如下:
该问题修复后,可以基于安装后的paddle phi c++ API在外部编译可执行文件,示例如下:
patchelf 命令
patchelf 是一个用来修改elf格式的动态库和可执行程序的小工具,可以修改动态链接库的库名字,以及链接库的RPATH。
打印出动态库的soname patchelf --print-soname xxx.so 修改动态库的soname patchelf --set-soname oldxxx.so newxxx.so 查看并修改第三方依赖库 patchelf --print-needed xxx.so patchelf --replace-needed oldxxx.so newxxx.so this.so 修改rpath patchelf --set-rpath '$ORIGIN/' main