Community Packages

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#67142 - [grpc] binaries are built in non-release mode

Attached to Project: Community Packages
Opened by Dave Reisner (falconindy) - Sunday, 28 June 2020, 21:18 GMT
Last edited by Massimiliano Torromeo (mtorromeo) - Friday, 10 July 2020, 10:59 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Massimiliano Torromeo (mtorromeo)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Please build grpc in release mode by passing -DCMAKE_BUILD_TYPE="Release" to the configuration step. This results in better optimizations and a space savings of almost 14MB on the grpc package.

Semi-related: the 'cmake' call doesn't belong in prepare(), but should instead be in build().
This task depends upon

Closed by  Massimiliano Torromeo (mtorromeo)
Friday, 10 July 2020, 10:59 GMT
Reason for closing:  Fixed
Additional comments about closing:  grpc-1.30.1-2
Comment by Massimiliano Torromeo (mtorromeo) - Wednesday, 08 July 2020, 16:57 GMT
Not using Release mode is actually intended as per the CMake package guidelines [1]. If you have specific flags that you suggest I add to optimize it better, let me know specifically which one, thanks!

[1] https://wiki.archlinux.org/index.php/CMake_package_guidelines
Comment by Dave Reisner (falconindy) - Wednesday, 08 July 2020, 18:10 GMT
Eh, ok. You'll want to build with -DNDEBUG. This is probably where the bulk of the code size increase comes from. grpc has a fair bit of extra runtime debugging/accounting that isn't present when built with debug disabled.
Comment by Massimiliano Torromeo (mtorromeo) - Wednesday, 08 July 2020, 18:39 GMT
Good to know, thanks! I'm working on the new release and I'll be sure to add that flag.
Comment by Massimiliano Torromeo (mtorromeo) - Wednesday, 08 July 2020, 19:53 GMT
I added the flag to cmake for grpc-1.30.0-2 but I don't think it did much. By the way, from what I understand, the flag is `-DCMAKE_CXX_FLAGS=-DNDEBUG`
Comment by Dave Reisner (falconindy) - Thursday, 09 July 2020, 15:34 GMT
Yes, I think that works (as far as appending NDEBUG). I'm not sure what the difference is at this point between the two builds, and I'm a little short on time to debug such a massive build. The wiki is pretty clear that this needs to be evaluated on a case by case basis for using CMAKE_BUILD_TYPE=None vs. Release. Here, the effect isn't great -- package bloat of nearly 100%. Can we make an exception and use CMAKE_BUILD_TYPE=Release?
Comment by Massimiliano Torromeo (mtorromeo) - Friday, 10 July 2020, 08:29 GMT
Yes, I think it's reasonable. I switched to Release in grpc-1.30.1-1
Comment by Antonio Rojas (arojas) - Friday, 10 July 2020, 08:41 GMT
If you pass -DCMAKE_CXX_FLAGS=-DNDEBUG to cmake, you are actually overwriting the system CXXFLAGS. In particular, you are not applying *any* optimization at all, which is probably the cause of the size increase. You should use -DCMAKE_CXX_FLAGS="${CXXFLAGS} -DNDEBUG"
Comment by Massimiliano Torromeo (mtorromeo) - Friday, 10 July 2020, 08:57 GMT
@arojas: I suspected it, later on, and wanted to try and fix that but since -DNDEBUG had no actual effect I had to change to Release build type and am not specifying -DCMAKE_CXX_FLAGS anymore anyway...
Comment by Antonio Rojas (arojas) - Friday, 10 July 2020, 09:20 GMT
Then the difference is just -O2 vs -O3. Strange that it would cause such a difference, but oh well.
Comment by Massimiliano Torromeo (mtorromeo) - Friday, 10 July 2020, 09:24 GMT
I also thought that something doesn't add up but I am not going to go crazy to hunt this down. The grpc build system is already complex enough as it is...
Comment by Massimiliano Torromeo (mtorromeo) - Friday, 10 July 2020, 09:48 GMT
I tried to rebuild it with `-DCMAKE_BUILD_TYPE=None -DCMAKE_CXX_FLAGS="${CXXFLAGS} -DNDEBUG"` and it seems ok. I guess I was wrong to think that `-DNDEBUG` alone should have shown a size reduction even with the default CXXFLAGS.

Loading...