add pybind.h to inference lib for static link #10690
Merged
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.
task list: #10574
目前我们让用户使用paddle的lib的时候,如果是静态连接的方式,则使用
-Wl,--whole-archive
的方式进行链接,这样libpaddle_fluid.a中的所有内容都会被连接到目标文件中。如果提供了pybind.h中的USE_OP的列表,则用户可以不使用
-Wl,--whole-archive
的方式进行link,而是按照他的需求link一部分op进去,方便做裁剪,好处是用户的二进制会变小,因为只link了lib中的一部分。相当于给了用户多一种选择。