Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 715114

Summary: net-im/telegram-desktop-1.9.21 does not use ccache
Product: Gentoo Linux Reporter: Dmitry Grigoriev <dimgel>
Component: Current packagesAssignee: Georgy Yakovlev <gyakovlev>
Status: RESOLVED CANTFIX    
Severity: enhancement CC: jstein, tanekliang
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: emerge --info
build.log.gz

Description Dmitry Grigoriev 2020-03-28 01:42:02 UTC
Haven't tried previous version(s).

Reproducible: Always
Comment 1 Dmitry Grigoriev 2020-03-28 01:42:34 UTC
Created attachment 626474 [details]
emerge --info
Comment 2 Georgy Yakovlev archtester gentoo-dev 2020-03-28 22:28:47 UTC
please upload build logs
Comment 3 Dmitry Grigoriev 2020-03-28 22:48:24 UTC
Created attachment 626618 [details]
build.log.gz

ccache is there in build.log, but:

"ccache -s" before build:
cache hit (direct)                245674
called for link                    70233
called for preprocessing           41451
can't use precompiled header        1118

"ccache -s" after build:
cache hit (direct)                245686  (+12)
called for link                    70252  (+19)
called for preprocessing           41454  (+3)
can't use precompiled header        1690  (+572)

Everything else is the same (I omitted "cache hit rate" and "files in cache"). So the most of ccache calls resulted in "can't use precompiled header".
Comment 4 Georgy Yakovlev archtester gentoo-dev 2020-03-29 00:10:46 UTC
thanks, I'll check what's going on.
probably it uses pch, but not sure yet.
Comment 5 Georgy Yakovlev archtester gentoo-dev 2020-04-21 08:17:09 UTC
nothing I really can do in the ebuild, upstream uses pch unconditionally.

but you can configure ccache to process precompiled headers anyway.

refer to https://ccache.dev/manual/3.2.4.html#_precompiled_headers


you have to set 

> sloppiness = pch_defines,time_macros

in ccache.conf


and add -fpch-preprocess

to CFLAGS/CXXFLAGS for telegram.


here are results:
1st run
---
cache directory                     /var/cache/ccache
primary config                      /var/cache/ccache/ccache.conf
secondary config      (readonly)    /etc/ccache.conf
stats updated                       Tue Apr 21 00:43:59 2020
cache hit (direct)                     1
cache hit (preprocessed)               0
cache miss                           101
cache hit rate                      0.98 %
called for link                       19
called for preprocessing               3
can't use precompiled header         572
cleanups performed                     0
files in cache                       291
cache size                           4.6 MB
max cache size                     120.0 GB

2nd run with default opts
---
cache directory                     /var/cache/ccache
primary config                      /var/cache/ccache/ccache.conf
secondary config      (readonly)    /etc/ccache.conf
stats updated                       Tue Apr 21 00:52:49 2020
cache hit (direct)                   100
cache hit (preprocessed)               3
cache miss                           101
cache hit rate                     50.49 %
called for link                       38
called for preprocessing               6
can't use precompiled header        1144
cleanups performed                     0
files in cache                       291
cache size                           4.6 MB
max cache size                     120.0 GB


3rd run with config described above
---
cache directory                     /var/cache/ccache
primary config                      /var/cache/ccache/ccache.conf
secondary config      (readonly)    /etc/ccache.conf
stats updated                       Tue Apr 21 01:14:58 2020
cache hit (direct)                   101
cache hit (preprocessed)               3
cache miss                           774
cache hit rate                     11.85 %
called for link                       57
called for preprocessing              10
can't use precompiled header        1258
cleanups performed                     0
files in cache                      2301
cache size                         320.9 MB
max cache size                     120.0 GB



4th run with full cache and options set (compilation is FAST)
---
cache directory                     /var/cache/ccache
primary config                      /var/cache/ccache/ccache.conf
secondary config      (readonly)    /etc/ccache.conf
stats updated                       Tue Apr 21 01:16:26 2020
cache hit (direct)                   770
cache hit (preprocessed)               8
cache miss                           774
cache hit rate                     50.13 %
called for link                       76
called for preprocessing              13
can't use precompiled header        1258
cleanups performed                     0
files in cache                      2301
cache size                         320.9 MB
max cache size                     120.0 GB
Comment 6 Dmitry Grigoriev 2020-04-21 09:52:58 UTC
(In reply to Georgy Yakovlev from comment #5)

Thank you for investigation.

> you have to set 
> 
> > sloppiness = pch_defines,time_macros
> 
> in ccache.conf

I'm afraid this can break some other builds... in theory at least. So I'd rather keep it as it is.
Comment 7 Georgy Yakovlev archtester gentoo-dev 2020-05-02 00:27:27 UTC
closing, as nothing can be done here.
I will add a warning to ebuild with a link to this bug, so people can easily discover setup required to make it work.
Comment 8 Larry the Git Cow gentoo-dev 2020-05-02 00:43:34 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f6962f3d6b96d6cb64bdb8ae0fd04658cefcdd73

commit f6962f3d6b96d6cb64bdb8ae0fd04658cefcdd73
Author:     Georgy Yakovlev <gyakovlev@gentoo.org>
AuthorDate: 2020-05-02 00:32:17 +0000
Commit:     Georgy Yakovlev <gyakovlev@gentoo.org>
CommitDate: 2020-05-02 00:43:01 +0000

    net-im/telegram-desktop: bump to 2.1.1
    
    add a warning about ccache not caching build by default
    use bundled ms-gsl for now, as we need version 3.0.1 in gentoo
    
    Bug: https://bugs.gentoo.org/715114
    Package-Manager: Portage-2.3.99, Repoman-2.3.22
    Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>

 net-im/telegram-desktop/Manifest                   |   1 +
 .../telegram-desktop/telegram-desktop-2.1.1.ebuild | 145 +++++++++++++++++++++
 2 files changed, 146 insertions(+)