grpc example helloworld binaries size too big in linux

26 views
Skip to first unread message

Dmitry Gorelov

unread,
Mar 14, 2023, 9:02:03 AM3/14/23
to grpc.io
I installed grpc on my ubuntu 22.04 Then I build examples. I call following:

/usr/bin/cmake ../ -DCMAKE_BUILD_TYPE:STRING=MinSizeRel -G "Unix Makefiles"
and build:

/usr/bin/cmake --build /home/user/grpc/examples/cpp/helloworld/build --target all -j 8
In the end I get compiled binaries of basic client-server examples in the build folder. The size of each of them is bigger than 37MB. What is the reason?

If I change CMADE_BUILD_TYPE to Release, no difference - size is still 37MB If I change to Debug, size is more than 40 (that is OK).

Why Release versions of basic grpc example programs are so enormouse in size?

I started this investigation because have same problem with my own project (its size without grps was 10MB, and it is 45MB wtih grpc).

UPD. My projectg is cross platform, the source is the same. Under Windows I link statically. The exe file size is 10 times smaller, 4.5MB. So question to linux binaries gets even harder. Any way to reduce it?

Dmitry Gorelov

unread,
Mar 15, 2023, 12:12:27 PM3/15/23
to grpc.io
It looks like I was able to minimize the size of binaries
1) use DCMAKE_BUILD_TYPE=MinSizeRel when build grpc
2) use same when build examples or own projects.

as a result - the size is 15MB.

вторник, 14 марта 2023 г. в 16:02:03 UTC+3, Dmitry Gorelov:
Reply all
Reply to author
Forward
0 new messages