Skip to content

Commit

Permalink
Fix pkg-config file to avoid overlinking
Browse files Browse the repository at this point in the history
When configured to use external protobuf, remove -lprotobuf-lite from
pkg-config file's Libs section. The sentencepiece libraries link with
libprotobuf-lite; it is not necessary for users of the sentencepiece
libraries to link with protobuf unless they are using static linking so
this should have been in Libs.private. Use Requires.private so that we
use protobuf's pkg-config file to get the flags.
  • Loading branch information
ryandesign committed May 21, 2023
1 parent e081c67 commit 4183597
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ endif()
if (SPM_USE_BUILTIN_PROTOBUF)
set(libprotobuf_lite "")
else()
set(libprotobuf_lite "-lprotobuf-lite")
set(libprotobuf_lite "protobuf-lite")
endif()

if (MSVC)
Expand Down
3 changes: 2 additions & 1 deletion sentencepiece.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ includedir=@includedir_for_pc_file@
Name: @PROJECT_NAME@
Description: Unsupervised text tokenizer and detokenizer for Neural Network-based text generation.
Version: @PROJECT_VERSION@
Libs: -L${libdir} -lsentencepiece -lsentencepiece_train @libprotobuf_lite@
Libs: -L${libdir} -lsentencepiece -lsentencepiece_train
Cflags: -I${includedir}
Requires.private: @libprotobuf_lite@

0 comments on commit 4183597

Please sign in to comment.