-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[Help Wanted, Questions]How to build zstd with cmake to minimize the binary size? #4161
Comments
cc @felixhandte |
By "binary size" you mean obj, lib, exe, X86/X64, debug/release? |
binary size of libzstd.a with release version, as our Client side SDK has size limit |
I don't use gcc, so I get obj files. (*.a in gcc) Just create a minimal C exe, call compress and/or decompress functions with NULL params, and check the final exe size - link it with cmake obj, then with make obj and compare exe sizes. And if the exe sizes are not equal (enough) - ask again 🙂 |
My need is minimize the size of libzstd.a, currently we build zstd with cmake and the size of libzstd.a is 102728 bytes, and of size 79432 with make, so I want to know is there any other cmake options can be used to optimize binary size of libzstd, such as ZSTD_LIB_MINIFY in make |
I don't know. |
Is your feature request related to a problem? Please describe.
Hi, How to minimize the binary size of libzstd when build with cmake , I've tried both cmake and make, and it turn out when I use make command ,the binary size is smallest, so how can I use cmake command to achive the same size of make does?
Here is my cmake cmd:
cmake .. -DCMAKE_BUILD_WITH_INSTALL_RPATH=OFF -DCMAKE_SKIP_RPATH=ON -DZSTD_BUILD_STATIC=ON -DZSTD_BUILD_SHARED=OFF -DZSTD_BUILD_PROGRAMS=OFF -DZSTD_BUILD_DECOMPRESSION=ON -DZSTD_BUILD_COMPRESSION=OFF -DZSTD_BUILD_DICTBUILDER=OFF -DZSTD_LEGACY_SUPPORT=OFF -DZSTD_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=./lib_install -DCMAKE_C_FLAGS=" -DHUF_FORCE_DECOMPRESS_X1 -DZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT -DZSTD_NO_INLINE -DZSTD_STRIP_ERROR_STRINGS -DZSTD_NO_UNUSED_FUNCTIONS -DZSTD_NO_INLINE -DHUF_DISABLE_FAST_DECODE -DZDICTLIB_STATIC_API"
and the binary size is 102728 bytes
make cmd:
make -j8 ZSTD_LIB_MINIFY=1 ZSTD_LIB_COMPRESSION=0 ZSTD_LIB_DICTBUILDER=0 ZSTD_LIB_DECOMPRESSION=1
and the binary size is 79432 bytes
Describe the solution you'd like
Wonder how to build zstd with cmake to minimize the binary size,as close as possible to the size of the binary compiled with make?
Thanks a lot!
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: