https://kotlinlang.org logo
Title
z

zt

08/02/2022, 8:10 PM
Are there any tips I can use to further reduce binary size? My release build is 4.3 mb and using the
strip
command on it shrinks it to 3.1 mb.
n

napperley

08/02/2022, 11:56 PM
Assuming you are using Gradle there would be a task for generating a release binary, which creates a binary with all the debug symbols stripped out.
How can the strip tool work with a Kotlin Native project when it doesn't have any object files it can use? The Kotlin Native compiler (konan) doesn't generate any object files.
As an example I have a debug binary of a Kotlin Native program (Conduit Server - https://gitlab.com/data-conduit/conduit-server ) that is 13.6 MB in size. With the release binary it is 4.6 MB in size. Average size delta between the two binaries is around 65%. In the binaries some of the libraries are statically linked like Ktor Server for example.
z

zt

08/03/2022, 12:13 AM
Well for me using the strip tool on the release binary reduced it by 1.2 MB
This is in my definition file
headers = X11/Xlib.h X11/Xutil.h X11/Xft/Xft.h X11/cursorfont.h
headerFilter = X11/**
compilerOpts = -I/usr/include -I/usr/include/x86_64-linux-gnu -I/usr/include/freetype2
linkerOpts = -L/usr/lib -L/usr/lib/x86_64-linux-gnu -lX11 -lXft
n

napperley

08/03/2022, 12:33 AM
Which arguments did you use with the strip tool?
z

zt

08/03/2022, 12:34 AM
None