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

Bug 315229

Summary: dev-util/cmake-2.8.1-r1 fails to compile ( java -version failed )
Product: Gentoo Linux Reporter: Markos Chandras (RETIRED) <hwoarang>
Component: New packagesAssignee: Java team <java>
Status: RESOLVED FIXED    
Severity: normal CC: cc, dilfridge, kde, rdmurray, weaver
Priority: High Keywords: InVCS
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on: 344515    
Bug Blocks:    

Description Markos Chandras (RETIRED) gentoo-dev 2010-04-14 09:13:02 UTC
CMake Error at /usr/share/cmake/Modules/FindJava.cmake:85 (MESSAGE):
  Error executing java -version
Call Stack (most recent call first):
  Tests/CMakeLists.txt:1523 (INCLUDE)

Cmake fails with the following error

I only have IcedTea6-bin 1.7.2 [icedtea6-bin] on my system

Running java -version on my own I get the following

java is not available for sun-jdk-1.5 on x86_64

If I emerge sun-jdk and use it as my VM everything works fine :)

So I guess you have either to add sun-jdk on cmake dependency list or check the active Java VM inside the ebuild
Comment 1 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2010-04-14 13:13:16 UTC
Looks like you had sun-jdk-1.5 emerged and set as system VM. When you unmerged it, you should have seen an ewarn about unmerging a system VM. You don't have to emerge it back, just use 'java-config -S icedtea6-bin' to fix this.
Comment 2 Andrew Udvare 2010-06-02 07:39:02 UTC
Is there a way to build CMake without this check for Java (I do not have any Java packages installed), and therefore have a -java USE flag? That's what I'm looking to do, otherwise I can't upgrade without having a VM installed.
Comment 3 Andreas K. Hüttel archtester gentoo-dev 2010-06-27 19:01:59 UTC
Markos, could you please try the -r2 ebuild _from the KDE overlay_ ?!

This should fix your case (but not the case where no java is installed at all).
Comment 4 Maciej Mrozowski gentoo-dev 2010-07-07 00:48:28 UTC
People don't like checking overlays, I've moved your fix to tree.

@OP
Please try cmake-2.8.1-r2
Comment 5 R. David Murray 2010-08-18 17:56:40 UTC
During an emerge cmake-2.8.1-r2 was pulled in as a dependency.  This is on a newly installed system, so there was no pre-existing java.  icedtea6-bin is being pulled in later in the dependency tree, but at the point at which cmake is built, it has not yet been installed.

I get the same 'java -version failed' error.
Comment 6 lou 2010-09-01 14:38:20 UTC
I'm getting the same 'java -version failed' error. dev-util/cmake-2.8.1-r2

When I run java-config -l it comes up empty. I think I did have java set up on this system at one time, but I no longer have it.... and don't need it. Any suggestions to skip the java check?
Comment 7 lou 2010-09-01 18:05:20 UTC
I got past the boostrap by unmerging java-config and java-config-wrapper.
Comment 8 Uros 2010-09-09 15:24:31 UTC
(In reply to comment #7)
> I got past the boostrap by unmerging java-config and java-config-wrapper.
> 

+1
Comment 9 Ben 2010-09-12 23:50:05 UTC
ran into this issue too.  I forgot I had no VM installed, just the wrapper.  This tricked cmake build script enough to think java is available and thus fail.

I worked around it by renaming java and java-config away to something else, thus making cmake think it's not available.

Seems like a bug of sorts but Gentoo specific where the wrappers can exist without a virtual machine.  I couldn't emerge as I was in the middle of an emerge -e, feared that it would mess that history up.

Not sure if it's best to make a USE flag to completely disable java for it or what... (or require dependency for a jvm)?
Comment 10 Andreas K. Hüttel archtester gentoo-dev 2010-09-19 08:14:00 UTC
*** Bug 337999 has been marked as a duplicate of this bug. ***
Comment 11 Jorge Manuel B. S. Vicetto (RETIRED) Gentoo Infrastructure gentoo-dev 2010-09-21 14:40:22 UTC
*** Bug 338216 has been marked as a duplicate of this bug. ***
Comment 12 Jorge Manuel B. S. Vicetto (RETIRED) Gentoo Infrastructure gentoo-dev 2010-09-21 14:47:19 UTC
If I understand this issue correctly, cmake fails to boostrap because it gets confused with the presence of the java-config and java-config-wrapper packages and tries to determine the java version by running "java -version".

@java:
Are users supposed to have the java-config* packages without an installed java vm?

@kde:
Should we "kill" the cmake auto-detection for java?
Comment 13 Petteri Räty (RETIRED) gentoo-dev 2010-09-22 15:36:25 UTC
(In reply to comment #12)
> 
> @java:
> Are users supposed to have the java-config* packages without an installed java
> vm?
> 

It's not useful without a VM but dependencies don't prevent installing just java-config. If adding a PDEPEND for || ( virtual/jdk virtual/jre ) solves this problem then we can add one.
Comment 14 Sergio Basurto 2010-09-27 23:08:55 UTC
I was having the same problem with a new installation of gentoo. When I try to install icedtea6-bin it has a dependency with cmake and cmake look for java -version but how can it be if the package that you are installing is java.

MY WORKAROUND IS AS FOLLOW:

I install first sun-jdk
ACCEPT_LICENCE="dlj-1.1" emerge -av sun-jdk

After install sun-jdk I installed icedtea6-bin
emerge -av icedtea6-bin (and also it install cmake)
finally remove sun-jdk.
Comment 15 Sergio Basurto 2010-10-20 21:33:03 UTC
(In reply to comment #14)
> I was having the same problem with a new installation of gentoo. When I try to
> install icedtea6-bin it has a dependency with cmake and cmake look for java
> -version but how can it be if the package that you are installing is java.
> 
> MY WORKAROUND IS AS FOLLOW:
> 
> I install first sun-jdk
> ACCEPT_LICENCE="dlj-1.1" emerge -av sun-jdk
> 
> After install sun-jdk I installed icedtea6-bin
> emerge -av icedtea6-bin (and also it install cmake)
> finally remove sun-jdk.
> 
There is an error in the line above the right one is
ACCEPT_LICENSE="dlj-1.1" emerge -av sun-jdk
Comment 16 Petteri Räty (RETIRED) gentoo-dev 2010-10-24 18:22:42 UTC
dev-java/java-config-2.1.11-r1 now PDEPENDs on virtual/jre. I checked depgraphs on stable and it seems to avoid this issue. As cmake-2.8.1-r2 is stable let's wait to get it stable before marking this as fixed.
Comment 17 Theo Chatzimichos (RETIRED) archtester gentoo-dev Security 2011-01-13 01:06:17 UTC
i'll resolve it as it is stable for major archs (amd64/x86)
thank you all
Comment 18 James Le Cuirot gentoo-dev 2015-05-03 08:32:33 UTC
Hello all. Sorry for digging up this bug from its grave but the PDEPEND addition ended up having some unintended side affects, not limited to being unable to install a JRE without also installing a JDK. I would have created a new bug but I wanted to be sure that all the interested parties saw this.

The problem was actually fixed in CMake within two weeks of this bug being created but the next release didn't hit Portage until after this bug was closed.

http://www.cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0da537d16792ffcc38ec1fb19d518900b1fe7432

Older versions of CMake have long gone from the tree so I would simply like to remove the PDEPEND with no further action. Any objections? If I don't hear anything within the next week then I'll take that as silent agreement. :)

I think the JAVA_HOME workaround added to the CMake ebuild was probably ineffective at the time and is no longer required. You could remove it but I suspect you'll be removing CMake 2 before too long anyway.
Comment 19 James Le Cuirot gentoo-dev 2015-05-10 20:57:34 UTC
Time up! I've made the change now.