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: Java team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-02-13 16:14 UTC by Mike Gilbert
Modified: 2024-02-28 08:38 UTC (History)
8 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.
Comment 19 kavol 2023-12-24 09:05:47 UTC
what is the current proper way to disable ccache for openjdk?

I got the warning, so I've put
FEATURES="-ccache"
into /etc/portage/env/dev-java/openjdk

now I'm getting past the warning, but it still fails with the error below

note that this looks like total nonsense, no ccache symlinks should be involved

# which x86_64-pc-linux-gnu-gcc
/usr/bin/x86_64-pc-linux-gnu-gcc
# ls -l /usr/bin/x86_64-pc-linux-gnu-gcc
lrwxrwxrwx 1 root root 59  8. říj 09.38 /usr/bin/x86_64-pc-linux-gnu-gcc -> /usr/x86_64-pc-linux-gnu/gcc-bin/13/x86_64-pc-linux-gnu-gcc

where /usr/x86_64-pc-linux-gnu/gcc-bin/13/x86_64-pc-linux-gnu-gcc is the real gcc binary, no ccache in the chain


from emerge output:

>>> Configuring source in /var/tmp/portage/dev-java/openjdk-17.0.8.1_p1/work/jdk17u-jdk-17.0.8.1-ga ...
 * ACCESS DENIED:  symlink:            /var/cache/ccache/2/9/stats.lock

...

configure: Using default toolchain gcc (GNU Compiler Collection)
checking for x86_64-pc-linux-gnu-gcc... /usr/lib/ccache/bin/x86_64-pc-linux-gnu-gcc
checking resolved symbolic links for CC... /usr/bin/ccache
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.
configure exiting with result code 1

!!! Please attach the following file when seeking support:
!!! /var/tmp/portage/dev-java/openjdk-17.0.8.1_p1/work/jdk17u-jdk-17.0.8.1-ga/config.log
 * ERROR: dev-java/openjdk-17.0.8.1_p1::gentoo failed (configure phase):
 *   econf failed
 * 
 * Call stack:
 *               ebuild.sh, line  136:  Called src_configure
 *             environment, line 4041:  Called econf '--disable-ccache' '--disable-precompiled-headers' '--disable-warnings-as-errors' '--enable-full-docs=no' '--with-boot-jdk=/opt/openjdk-bin-17.0.8.1_p1' '--with-extra-cflags=-march=native -O2 -pipe -fcommon' '--with-extra-cxxflags=-march=native -O2 -pipe -fcommon' '--with-extra-ldflags=-Wl,-O1 -Wl,--as-needed' '--with-freetype=system' '--with-giflib=system' '--with-harfbuzz=system' '--with-lcms=system' '--with-libjpeg=system' '--with-libpng=system' '--with-native-debug-symbols=none' '--with-vendor-name=Gentoo' '--with-vendor-url=https://gentoo.org' '--with-vendor-bug-url=https://bugs.gentoo.org' '--with-vendor-vm-bug-url=https://bugs.openjdk.java.net' '--with-vendor-version-string=17.0.8.1_p1' '--with-version-pre=' '--with-version-string=17.0.8.1' '--with-version-build=1' '--with-zlib=system' '--enable-jvm-feature-dtrace=no' '--enable-headless-only=no'
 *        phase-helpers.sh, line  732:  Called __helpers_die 'econf failed'
 *   isolated-functions.sh, line  112:  Called die
 * The specific snippet of code:
 *              die "$@"
 * 
 * If you need support, post the output of `emerge --info '=dev-java/openjdk-17.0.8.1_p1::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=dev-java/openjdk-17.0.8.1_p1::gentoo'`.
!!! When you file a bug report, please include the following information:
GENTOO_VM=openjdk-bin-17  CLASSPATH="" JAVA_HOME="/opt/openjdk-bin-17.0.8.1_p1"
JAVACFLAGS="-source 17 -target 17" COMPILER=""
and of course, the output of emerge --info =openjdk-17.0.8.1_p1
 * The complete build log is located at '/var/tmp/portage/dev-java/openjdk-17.0.8.1_p1/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/dev-java/openjdk-17.0.8.1_p1/temp/environment'.
 * Working directory: '/var/tmp/portage/dev-java/openjdk-17.0.8.1_p1/work/jdk17u-jdk-17.0.8.1-ga'
 * S: '/var/tmp/portage/dev-java/openjdk-17.0.8.1_p1/work/jdk17u-jdk-17.0.8.1-ga'
 * ----------------------- SANDBOX ACCESS VIOLATION SUMMARY -----------------------
 * LOG FILE: "/var/tmp/portage/dev-java/openjdk-17.0.8.1_p1/temp/sandbox.log"
 * 
VERSION 1.0
FORMAT: F - Function called
FORMAT: S - Access Status
FORMAT: P - Path as passed to function
FORMAT: A - Absolute Path (not canonical)
FORMAT: R - Canonical Path
FORMAT: C - Command Line

F: symlink
S: deny
P: /var/cache/ccache/2/9/stats.lock
A: /var/cache/ccache/2/9/stats.lock
R: /var/cache/ccache/2/9/stats.lock
C: x86_64-pc-linux-gnu-gcc -E -E -P - 
 * --------------------------------------------------------------------------------

>>> Failed to emerge dev-java/openjdk-17.0.8.1_p1, Log file:
...
Comment 20 Sébastien P. 2023-12-25 20:29:19 UTC
This still works:

(In reply to Sébastien P. from comment #16)
> 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.

I do not understand why “/etc/portage/env/<category>/<package_name>” does not work in your case. It should but according to: https://wiki.gentoo.org/wiki//etc/portage/package.env
> If all that is needed is to set environment variables, use a free-form file name directly in /etc/portage/env, then add a line in /etc/portage/package.env with a package atom followed by the chosen file name, like in the following examples.

Same thing on man:
> Note that if package-specific environment variable settings are all that’s needed, then /etc/portage/package.env should be used instead of the bashrc  approach  that  is  describe  here. Also note that special variables such as FEATURES and INSTALL_MASK will not produce the intended results if they are set in bashrc, and therefore /etc/portage/package.env should be used instead.
Comment 21 David Carlos Manuelda 2024-02-28 08:38:24 UTC
Any news regarding this? I've been testing and by removing ccache checks from the ebuild and applying @Azamat H. Hackimov patch it compiles (and runs) perfectly with ccache.

I think it is an acceptable solution.