Bug 819

Summary: compilation fails to locate JavaVM.framework/Libraries
Product: [JogAmp] Jogl Reporter: Ricardo Fabbri <rfabbri>
Component: macosxAssignee: Sven Gothel <sgothel>
Status: RESOLVED INVALID    
Severity: blocker CC: gouessej
Priority: ---    
Version: 2   
Hardware: pc_x86_64   
OS: macosx   
Type: --- SCM Refs:
Workaround: ---

Description Ricardo Fabbri 2013-08-22 05:55:18 CEST
Compilation fails as follows

rfabbri@MacBook-Pro:~/src/jogl/make$ ant

...
BUILD FAILED
/Users/rfabbri/src/jogl/make/build.xml:71: The following error occurred while executing this line:
/Users/rfabbri/src/jogl/make/build-nativewindow.xml:740: The following error occurred while executing this line:
/Users/rfabbri/src/jogl/make/build-nativewindow.xml:681: /System/Library/Frameworks/JavaVM.framework/Libraries does not exist.



This is Mac OSX 10.8.4 and git branch master 2cb2845
Comment 1 Julien Gouesse 2013-08-29 15:44:09 CEST
(In reply to comment #0)
> Compilation fails as follows
> 
> rfabbri@MacBook-Pro:~/src/jogl/make$ ant
> 
> ...
> BUILD FAILED
> /Users/rfabbri/src/jogl/make/build.xml:71: The following error occurred
> while executing this line:
> /Users/rfabbri/src/jogl/make/build-nativewindow.xml:740: The following error
> occurred while executing this line:
> /Users/rfabbri/src/jogl/make/build-nativewindow.xml:681:
> /System/Library/Frameworks/JavaVM.framework/Libraries does not exist.
> 
> 
> 
> This is Mac OSX 10.8.4 and git branch master 2cb2845

Thanks. We should not rely on this particular directory.
Comment 2 Sven Gothel 2013-10-05 02:16:33 CEST
We only define (gluegen-cpptasks-base.xml):

+++

  <target name="setup.java.home.dir.macosx" if="isOSX">
      <!-- Java7 std location -->
      <condition property="java.home.dir"
                 value="${java.home}/..">
                 <available file="${java.home}/../include/jni.h"/>
      </condition>
      <condition property="java.includes.dir"
                 value="${java.home}/../include">
                 <available file="${java.home}/../include/jni.h"/>
      </condition>
      <!-- Fallback value Java6 -->
      <property name="java.home.dir" value="/System/Library/Frameworks/JavaVM.framework/Home" />
      <property name="java.includes.dir" value="/System/Library/Frameworks/JavaVM.framework/Headers" />
  </target>
  ...
      <condition property="java.includes.dir.platform"
                 value="${gluegen.root.abs-path}/make/stub_includes/jni/macosx">
                 <available file="${java.includes.dir}/darwin/jawt_md.h"/>
      </condition>
      <condition property="java.lib.dir.platform"
                 value="${java.home.dir}/jre/lib">
                 <available file="${java.home.dir}/jre/lib/libjawt.dylib"/>
      </condition>
      <!-- Fallback value Java6 -->
      <property name="java.includes.dir.platform" value="/System/Library/Frameworks/JavaVM.framework/Headers" />
      <property name="java.lib.dir.platform"      value="/System/Library/Frameworks/JavaVM.framework/Libraries" />

+++

.. hence if java7 is installed and PATH is set accordingly, i.e.:

JAVA_HOME=`/usr/libexec/java_home -version 1.7`
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME PATH

and will use the proper 'java.home' env. var and all shall work.
See e.g. gluegen/make/scripts/make.gluegen.all.macosx-clang.sh (similar script in jogl).

build-nativewindow.xml in jogl only uses:
  <syslibset dir="${java.lib.dir.platform}" libs="jawt" if="@{output.lib.name}.useLibJAWT"/>