Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1141782

Summary: vtk build failed with Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY)
Product: [Fedora] Fedora Reporter: Menanteau Guy <menantea>
Component: cmakeAssignee: Orion Poplawski <orion>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 21CC: ahughes, dbhole, jreznik, jvanek, ltinkl, omajid, orion, pertusus, pmachata, rdieter
Target Milestone: ---   
Target Release: ---   
Hardware: ppc64le   
OS: Linux   
Whiteboard:
Fixed In Version: cmake-3.0.2-2.fc21 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-23 05:09:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1051573    

Description Menanteau Guy 2014-09-15 12:49:15 UTC
Building vtk-5.1.0-14 failed on arch ppc64le when 
java-1.8.0-openjdk-1.8.0.20-4.b26 is installed.

Error retrieved is: 
-- Could NOT find JNI (missing:  JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY)

CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:136 (message):
  Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY)
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:343 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake/Modules/FindJNI.cmake:286 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  Wrapping/Java/CMakeLists.txt:2 (find_package)


cmake-3.0.1-3 have following code in  cmake-3.0.1/Modules/FindJNI.cmake: 
# Expand {libarch} occurences to java_libarch subdirectory(-ies) and set ${_var}
macro(java_append_library_directories _var)
...  
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64le")
        set(_java_libarch "ppc64le")

but java-1.8.0-openjdk.spec have:
%ifarch %{power64}
%global archinstall ppc64
%endif
...
%{_jvmdir}/%{uniquesuffix}/jre/lib/%{archinstall}/libawt_xawt.so
%{_jvmdir}/%{uniquesuffix}/jre/lib/%{archinstall}/libjawt.so

This lead to have java installed in ${JAVA_HOME}/jre/lib/ppc64
when cmake try to find JNI libraries in ${JAVA_HOME}/jre/lib/ppc64le

I don't know if a correction have to be made on java-1.8.0-openjdk.spec or
in cmake-3.0.1/Modules/FindJNI.cmake.

Comment 1 Omair Majid 2014-09-15 13:56:45 UTC
(In reply to Menanteau Guy from comment #0)
> cmake-3.0.1-3 have following code in  cmake-3.0.1/Modules/FindJNI.cmake: 
> # Expand {libarch} occurences to java_libarch subdirectory(-ies) and set
> ${_var}
> macro(java_append_library_directories _var)
> ...  
> elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64le")
>         set(_java_libarch "ppc64le")

This is wrong. OpenJDK puts ppc64le in 'ppc64', not 'ppc64le'. It was the second in some builds, but changed to the first when ppc64le support was officially merged upstream:
http://mail.openjdk.java.net/pipermail/hotspot-dev/2014-March/012905.html

> but java-1.8.0-openjdk.spec have:
> %ifarch %{power64}
> %global archinstall ppc64
> %endif
> ...
> %{_jvmdir}/%{uniquesuffix}/jre/lib/%{archinstall}/libawt_xawt.so
> %{_jvmdir}/%{uniquesuffix}/jre/lib/%{archinstall}/libjawt.so
> 
> This lead to have java installed in ${JAVA_HOME}/jre/lib/ppc64
> when cmake try to find JNI libraries in ${JAVA_HOME}/jre/lib/ppc64le

Actually, that's not true. This little snippet is just trying to figure out the path used. It doesn't actually set it. The path is set up in the OpenJDK build. If we change it to something else here, the build will just break.

> I don't know if a correction have to be made on java-1.8.0-openjdk.spec or
> in cmake-3.0.1/Modules/FindJNI.cmake.

Probably the latter - if we modify the RPM, it would diverge from upstream.

Comment 2 Omair Majid 2014-09-15 14:04:03 UTC
Fix in CMake upstream:
https://github.com/Kitware/CMake/commit/18ac6713e8657cca8fc791bcd581a47a7be6ebce

Re-assigning to CMake.

Comment 3 Fedora Update System 2014-09-15 16:38:52 UTC
cmake-3.0.2-2.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/cmake-3.0.2-2.fc21

Comment 4 Fedora Update System 2014-09-16 18:43:17 UTC
Package cmake-3.0.2-2.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing cmake-3.0.2-2.fc21'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-10848/cmake-3.0.2-2.fc21
then log in and leave karma (feedback).

Comment 5 Menanteau Guy 2014-09-17 14:55:49 UTC
cmake-3.0.2-2.fc21 scratch builds passed on 
primary http://koji.fedoraproject.org/koji/taskinfo?taskID=7604452 
and secondary http://ppc.koji.fedoraproject.org/koji/taskinfo?taskID=2105533 
vtk builds ok with this cmake version.

Comment 6 Fedora Update System 2014-09-23 05:09:57 UTC
cmake-3.0.2-2.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.