Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 847439 - sci-astronomy/stellarium-0.21.3 as well as -0.22.1 doesn't build with ccache available on the system
Summary: sci-astronomy/stellarium-0.21.3 as well as -0.22.1 doesn't build with ccache ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Alexey
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2022-05-25 13:32 UTC by Joe Breuer
Modified: 2022-07-19 07:41 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
CMakeLists.txt patch for CCACHE_ALLOWED option (stellarium-0.22.1-ccache_allowed-option.patch,512 bytes, patch)
2022-05-25 13:32 UTC, Joe Breuer
Details | Diff
ebuild patch to pull in the CMakeLists.txt patch (stellarium-0.22.1_ebuild.patch,618 bytes, patch)
2022-05-25 13:34 UTC, Joe Breuer
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joe Breuer 2022-05-25 13:32:54 UTC
Created attachment 780746 [details, diff]
CMakeLists.txt patch for CCACHE_ALLOWED option

Quick-fix to allow for turning off ccache in stellarium's CMakeLists.txt

Building stellarium versions 0.21.3 as well as 0.22.1 yields numerous sandbox violations when it detects ccache to be available on the system.

This is exactly the same thing going wrong as in e.g. bug 841518

Again, it needs a two-part fix: -DCCACHE_ALLOWED="OFF" in mycmakeargs, and a patch to the top-level CMakeLists.txt to short-circuit the opportunistic check for a ccache binary.

I am starting to wonder if there's something else going on, and/or there could/should be a more generic solution to this type of issue.
Comment 1 Joe Breuer 2022-05-25 13:34:47 UTC
Created attachment 780749 [details, diff]
ebuild patch to pull in the CMakeLists.txt patch
Comment 2 Joe Breuer 2022-05-25 13:38:34 UTC
To clarify: I would actually want to use ccache and have it enabled in FEATURES, but because of how these CMakeLists.txt try to detect ccache, it doesn't work with portage. My reading/guess is that the (non-portage) "variant" of ccache that gets picked up is not correctly configured for use with/in the sandbox.

Conversely, with this patch, ccache is simply not used at all.

Does anyone have appropriate portage and CMake knowledge what would need to be fulfilled for CMake to correctly use the portage-provided ccache?
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-05-26 00:02:03 UTC
(In reply to Joe Breuer from comment #2)
> To clarify: I would actually want to use ccache and have it enabled in
> FEATURES, but because of how these CMakeLists.txt try to detect ccache, it
> doesn't work with portage. My reading/guess is that the (non-portage)
> "variant" of ccache that gets picked up is not correctly configured for use
> with/in the sandbox.
> 
> Conversely, with this patch, ccache is simply not used at all.
> 
> Does anyone have appropriate portage and CMake knowledge what would need to
> be fulfilled for CMake to correctly use the portage-provided ccache?

It should simply respect the compiler options set by the environment and not try to bypass by looking for "the real" compiler if the ccache option to CMake is disabled.

So, remove all the magic. Not checked what's happening here but this kind of approach seems somewhat common sadly :(
Comment 4 Alexey 2022-05-26 07:19:15 UTC
Reading what https://cmake.org/cmake/help/latest/prop_gbl/RULE_LAUNCH_COMPILE.html does, I believe this should be fixed more centrally, in cmake.eclass, similarly to how it already comments out hardcoded changes to CMAKE_INSTALL_PREFIX
Comment 5 Andreas Sturmlechner gentoo-dev 2022-05-26 13:43:13 UTC
I'm not sure it is worth it, packages have all kinds of ways to check for ccache then use it, there is no standard switch I know of?
Comment 6 Joe Breuer 2022-06-01 05:33:30 UTC
(In reply to Andreas Sturmlechner from comment #5)
> I'm not sure it is worth it, packages have all kinds of ways to check for
> ccache then use it, there is no standard switch I know of?

I understand there to be two different issues: CMake looking for ccache seems to be a per-package thing, and probably needs to be patched out per-package (or the sandbox can learn to "hide" ccache... hmm.).

On the other hand, looking for a "real" compiler (bypassing ccache, distcc, ... whatever may be set up for/by portage) apparently is "standard" CMake functionality, which could be bypassed centrally.

I'll have a stab at this later / over the next couple of days.
Comment 7 Alexey 2022-07-11 01:04:04 UTC
> looking for ccache seems to be a per-package thing, and probably needs to be patched out per-package

This is true. I hoped special generic handling of RULE_LAUNCH_COMPILE would help, but apparently no.

> looking for a "real" compiler (bypassing ccache, distcc, ... whatever may be set up for/by portage) apparently is "standard" CMake functionality, which could be bypassed centrally.

CMake doesn't bypass anything. It uses CC/CXX env variables and CMAKE_C_COMPILER etc cmake variables and therefore searches for x86_64-pc-linux-gnu-g++ in PATH, so ends up using /usr/lib/ccache/bin/x86_64-pc-linux-gnu-g++, because FEATURES=ccache adds that dir to PATH. The whole /usr/lib/ccache/bin/ directory is full of symlinks to /usr/bin/ccache.

If in your case ccache doesn't get picked up, paste build log, and show what's in that directory.
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-07-11 01:07:06 UTC
(In reply to Alexey from comment #7)
> > looking for ccache seems to be a per-package thing, and probably needs to be patched out per-package
> 
> This is true. I hoped special generic handling of RULE_LAUNCH_COMPILE would
> help, but apparently no.
> 
> > looking for a "real" compiler (bypassing ccache, distcc, ... whatever may be set up for/by portage) apparently is "standard" CMake functionality, which could be bypassed centrally.
> 
> CMake doesn't bypass anything. It uses CC/CXX env variables and
> CMAKE_C_COMPILER etc cmake variables and therefore searches for
> x86_64-pc-linux-gnu-g++ in PATH, so ends up using
> /usr/lib/ccache/bin/x86_64-pc-linux-gnu-g++, because FEATURES=ccache adds
> that dir to PATH. The whole /usr/lib/ccache/bin/ directory is full of
> symlinks to /usr/bin/ccache.
> 
> If in your case ccache doesn't get picked up, paste build log, and show
> what's in that directory.

It shouldn't do a PATH lookup, it's unnecessary.
Comment 9 Larry the Git Cow gentoo-dev 2022-07-19 07:41:25 UTC
The bug has been closed via the following commit(s):

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

commit d32c1aac166b5914ac2feb6d5abf008442220026
Author:     Alexey Sokolov <alexey+gentoo@asokolov.org>
AuthorDate: 2022-07-10 09:24:00 +0000
Commit:     Florian Schmaus <flow@gentoo.org>
CommitDate: 2022-07-19 07:36:24 +0000

    sci-astronomy/stellarium: version 0.22.2
    
    Closes: https://bugs.gentoo.org/847439
    Package-Manager: Portage-3.0.30, Repoman-3.0.3
    Signed-off-by: Alexey Sokolov <alexey+gentoo@asokolov.org>
    Closes: https://github.com/gentoo/gentoo/pull/26323
    Signed-off-by: Florian Schmaus <flow@gentoo.org>

 sci-astronomy/stellarium/Manifest                  |   3 +
 .../files/stellarium-0.22.2-ccache.patch           |  13 ++
 .../stellarium-0.22.2-unbundle-qtcompress.patch    | 208 +++++++++++++++++++++
 sci-astronomy/stellarium/stellarium-0.22.2.ebuild  | 144 ++++++++++++++
 4 files changed, 368 insertions(+)