Use shared libraries for linking the main executable #278

Closed
opened 2026-01-29 20:41:18 +00:00 by claunia · 2 comments
Owner

Originally created by @moubctez on GitHub (Apr 19, 2019).

Currenly, the main executable is quite large, because it is being linked against static libraries. Please, consider linking it against the shared libraries. The following patch does the shared linking:

--- CMakeLists.txt.orig
+++ CMakeLists.txt
@@ -183,7 +183,7 @@ endif()
 
 # Build the brotli executable
 add_executable(brotli ${BROTLI_CLI_C})
-target_link_libraries(brotli ${BROTLI_LIBRARIES_STATIC})
+target_link_libraries(brotli ${BROTLI_LIBRARIES})
 
 # Installation
 if(NOT BROTLI_BUNDLED_MODE)
Originally created by @moubctez on GitHub (Apr 19, 2019). Currenly, the main executable is quite large, because it is being linked against static libraries. Please, consider linking it against the shared libraries. The following patch does the shared linking: ``` --- CMakeLists.txt.orig +++ CMakeLists.txt @@ -183,7 +183,7 @@ endif() # Build the brotli executable add_executable(brotli ${BROTLI_CLI_C}) -target_link_libraries(brotli ${BROTLI_LIBRARIES_STATIC}) +target_link_libraries(brotli ${BROTLI_LIBRARIES}) # Installation if(NOT BROTLI_BUNDLED_MODE) ```
Author
Owner

@eustas commented on GitHub (Jul 17, 2019):

That is done intentionally, so that brotli executable compiled in one container would be executed in other container without any deps.

Do you have some specific scenario, where shared-linked brotli CLI would be useful?
In that case it would be better to add a configuration option...

@eustas commented on GitHub (Jul 17, 2019): That is done intentionally, so that brotli executable compiled in one container would be executed in other container without any deps. Do you have some specific scenario, where shared-linked brotli CLI would be useful? In that case it would be better to add a configuration option...
Author
Owner

@lazka commented on GitHub (Sep 5, 2023):

Looks like this was fixed in 641bec0e30, the main binary now links against the shared lib by default starting with v1.1.0

@lazka commented on GitHub (Sep 5, 2023): Looks like this was fixed in 641bec0e30bea648b3, the main binary now links against the shared lib by default starting with v1.1.0
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#278