Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 677876 - dev-java/openjdk-11.0.2_p7 configure fails with FEATURES=ccache
Summary: dev-java/openjdk-11.0.2_p7 configure fails with FEATURES=ccache
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 7 votes (vote)
Assignee: Georgy Yakovlev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-02-13 16:14 UTC by Mike Gilbert
Modified: 2023-08-30 09:08 UTC (History)
7 users (show)

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


Attachments
openjdk-ccache.patch (openjdk-ccache.patch,1.09 KB, patch)
2019-04-25 05:48 UTC, Georgy Yakovlev
Details | Diff
emerge.txt (t.txt,3.27 KB, text/plain)
2020-05-11 02:24 UTC, Yury Martynov
Details
openjdk-ccache.patch (openjdk-ccache.patch,759 bytes, patch)
2021-12-02 21:52 UTC, Azamat H. Hackimov
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Gilbert gentoo-dev 2019-02-13 16:14:19 UTC
Building openjdk-11 fails with FEATURES=ccache enabled.

configure: Please use --enable-ccache instead of providing a wrapped compiler.
configure: error: /usr/lib/ccache/bin/x86_64-pc-linux-gnu-gcc is a symbolic link to ccache. This is
not supported.

Perhaps a check for this could be added to pkg_pretend?

if has ccache ${FEATURES:-none}; then
    die "FEATURES=ccache is unsupported for this package"
fi

Also, it would be nice if the --enable-ccache configure option was exposed via a USE flag.
Comment 1 Georgy Yakovlev archtester gentoo-dev 2019-02-13 19:36:13 UTC
Thanks.

as a workaround you can try passing --enable-ccache via EXTRA_ECONF and disable FEATURES=ccache for openjdk.

Last time I tried openjdk's build system did it's own handing of ccache, ignoring portage/system settings. I'd rather disable it completely than try to wrap it into portage, so not sure about use flag, 

I'll poke around and see how things are now.
Comment 2 Georgy Yakovlev archtester gentoo-dev 2019-02-13 20:07:43 UTC
it's still a mess.
it will die if detects ccache symlink and with no ccache in FEATURES but with --enable-ccache it'll blow up on sandbox violations.

will just die in pkg_pretend.
Comment 3 Larry the Git Cow gentoo-dev 2019-02-13 20:43:25 UTC
The bug has been referenced in the following commit(s):

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

commit 6136f3c691e05e542e644be851bea9f035337fdd
Author:     Georgy Yakovlev <gyakovlev@gentoo.org>
AuthorDate: 2019-02-13 20:42:17 +0000
Commit:     Georgy Yakovlev <gyakovlev@gentoo.org>
CommitDate: 2019-02-13 20:42:55 +0000

    dev-java/openjdk: die if FEATURES=ccache
    
    ./configure will die anyway, so we die a bit earlier before unpacking.
    
    openjdk wants to handle ccache itself and ignores portage or
    system settings.
    
    Bug: https://bugs.gentoo.org/677876
    Package-Manager: Portage-2.3.60, Repoman-2.3.12
    Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>

 dev-java/openjdk/openjdk-11.0.1_p13.ebuild | 1 +
 dev-java/openjdk/openjdk-11.0.2_p7.ebuild  | 1 +
 dev-java/openjdk/openjdk-8.202_p08.ebuild  | 1 +
 3 files changed, 3 insertions(+)
Comment 4 Pacho Ramos gentoo-dev 2019-04-24 14:16:56 UTC
why don't you export CCACHE_DISABLE=1 ?

per man ccache:
       disable (CCACHE_DISABLE or CCACHE_NODISABLE, see Boolean values above)
           When true, ccache will just call the real compiler, bypassing the cache completely. The default is false.

And export CCACHE_DISABLE=1 is being used by nvidia-drivers ebuilds without issues

Thanks!
Comment 5 Mike Gilbert gentoo-dev 2019-04-24 15:05:23 UTC
(In reply to Pacho Ramos from comment #4)

The configure check would probably still fail, regardless of that environment variable.
Comment 6 Georgy Yakovlev archtester gentoo-dev 2019-04-24 16:43:17 UTC
yep, it's jdk build system that checks for ccache and complains.
I'll test it though, I don't like blowing up in user's face with that feature enabled, but we can't RESTRICT ccache unfortunately to disable it.
Comment 7 Georgy Yakovlev archtester gentoo-dev 2019-04-25 05:45:27 UTC
autoconf/toolchain.m4
571:    # We can't handle ccache by gcc wrappers, since we need to know if we're
572:    # using ccache. Instead ccache usage must be controlled by a configure option.
574:    if test "x$COMPILER_BASENAME" = "xccache"; then
575:      AC_MSG_NOTICE([Please use --enable-ccache instead of providing a wrapped compiler.])
576:      AC_MSG_ERROR([$TEST_COMPILER is a symbolic link to ccache. This is not supported.])


well, without this ugly hack (stripping ccache from PATH)

PATH="${PATH/\/usr\/lib\/ccache\/bin\:/}" 

configure still fails with 

CCACHE_DISABLE=1

I guess with 

CCACHE_DISABLE=1

and


PATH="${PATH/\/usr\/lib\/ccache\/bin\:/}" set just before running econf can potentially disable ccache pretty transparently.
even if ccache got run it promises to keep call gcc directly.


but I don't like modifying path like that.
Comment 8 Georgy Yakovlev archtester gentoo-dev 2019-04-25 05:48:04 UTC
Created attachment 574094 [details, diff]
openjdk-ccache.patch

I kinda made ccache work with it

CCACHE_DIR=/var/cache/ccache ccache -s
cache directory                     /var/cache/ccache
primary config                      /var/cache/ccache/ccache.conf
secondary config      (readonly)    /etc/ccache.conf
stats updated                       Wed Apr 24 22:39:07 2019
cache hit (direct)                     0
cache hit (preprocessed)               0
cache miss                          3576
cache hit rate                      0.00 %
cleanups performed                     0
files in cache                     10501
cache size                          10.8 MB
max cache size                       5.0 GB


CCACHE_DIR=/var/cache/ccache ccache -s
cache directory                     /var/cache/ccache
primary config                      /var/cache/ccache/ccache.conf
secondary config      (readonly)    /etc/ccache.conf
stats updated                       Wed Apr 24 22:44:37 2019
cache hit (direct)                  3269
cache hit (preprocessed)             305
cache miss                          3578
cache hit rate                     49.97 %
cleanups performed                     0
files in cache                     10521
cache size                          10.8 MB
max cache size  



but idk if it's a good idea to do that.

opinions? diff attached.
Comment 9 Pacho Ramos gentoo-dev 2019-04-25 16:24:33 UTC
Personally I would opt for disabling ccache with CCACHE_DISABLE=1 (as it seems upstream doesn't want it) and dropping the ugly check from configure
Comment 10 Yury Martynov 2020-05-11 02:24:36 UTC
Created attachment 637826 [details]
emerge.txt

Hi everyone!
I get an error while installing as a binary package:

 * openjdk-8.242.tbz2 MD5 SHA1 size ;-) ...                              [ ok ]
 * ERROR: dev-java/openjdk-8.242::gentoo failed (pretend phase):
 *   FEATURES=ccache doesn't work with openjdk
 * 
 * Call stack:
 *     ebuild.sh, line 125:  Called pkg_pretend
 *   environment, line 4492:  Called die
 * The specific snippet of code:
 *       has ccache ${FEATURES} && die "FEATURES=ccache doesn't work with ${PN}"
 * 
 * If you need support, post the output of `emerge --info '=dev-java/openjdk-8.242::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=dev-java/openjdk-8.242::gentoo'`.

Can you exclude the ccache feature checking for binary packages?
Comment 11 Yury Martynov 2020-05-11 02:30:45 UTC
I completely forgot about dev-java/openjdk-bin
Does it make sense to fix this?
Comment 12 Georgy Yakovlev archtester gentoo-dev 2020-05-11 04:38:56 UTC
yeah, it's possible to fix, thanks for catching it should not die if the binpkg is being installed.
Comment 13 Larry the Git Cow gentoo-dev 2020-05-11 04:43:25 UTC
The bug has been referenced in the following commit(s):

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

commit 91385d013bd1fbc0c8a8e5bc5ec43d8e0f3906f5
Author:     Georgy Yakovlev <gyakovlev@gentoo.org>
AuthorDate: 2020-05-11 04:42:25 +0000
Commit:     Georgy Yakovlev <gyakovlev@gentoo.org>
CommitDate: 2020-05-11 04:42:54 +0000

    dev-java/openjdk: don't die on ccache if binpkg is being used
    
    Bug: https://bugs.gentoo.org/677876
    Package-Manager: Portage-2.3.99, Repoman-2.3.22
    Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>

 dev-java/openjdk/openjdk-11.0.7_p10.ebuild | 4 +++-
 dev-java/openjdk/openjdk-8.252_p09.ebuild  | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)
Comment 14 Azamat H. Hackimov 2021-12-02 21:52:13 UTC
Created attachment 757227 [details, diff]
openjdk-ccache.patch

I don't see any issues with --enable-ccache=no and removed symlink checking in make/autoconf/toolchain.m4. With this configuration openjdk compiles fine and still uses ccache via wrapper without any issues.
Patch attached.
Comment 15 Stephan Litterst 2021-12-04 05:53:04 UTC
Same with openjdk-11.0.13_p8:

* Messages for package dev-java/openjdk-11.0.13_p8:

* ERROR: dev-java/openjdk-11.0.13_p8::gentoo failed (pretend phase):
*   FEATURES=ccache doesn't work with openjdk, bug #677876
Comment 16 Sébastien P. 2022-06-13 22:35:06 UTC
Another workaround:
echo 'dev-java/openjdk without_ccache.conf' >> /etc/portage/package.env
echo 'FEATURES="-ccache"' >> /etc/portage/env/without_ccache.conf

It will disabled the FEATURES just for openjdk.
Comment 17 Michele Testa 2023-04-10 13:32:37 UTC
(In reply to Azamat H. Hackimov from comment #14)
> Created attachment 757227 [details, diff] [details, diff]
> openjdk-ccache.patch
> 
> I don't see any issues with --enable-ccache=no and removed symlink checking
> in make/autoconf/toolchain.m4. With this configuration openjdk compiles fine
> and still uses ccache via wrapper without any issues.
> Patch attached.

It works like a charm even for dev-java/openjdk-17.0.6_p10.
Thank you, Azamat!
Comment 18 Hubert SCHMITT 2023-08-30 09:08:00 UTC
I got same issue compiling dev-java/openjdk-17.0.6_p10 with FEATURES="-ccache" 

Tried-out some workaround given here but couldn't get it compiling.