<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://jogamp.org/bugzilla/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.2"
          urlbase="https://jogamp.org/bugzilla/"
          
          maintainer="sgothel@jausoft.com"
>

    <bug>
          <bug_id>845</bug_id>
          
          <creation_ts>2013-10-01 13:08:46 +0200</creation_ts>
          <short_desc>Allow (discouraged) use of one big-fat jar file [java classes plus all native &apos;os.and.arch&apos; libraries]</short_desc>
          <delta_ts>2014-11-18 22:36:37 +0100</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>3</classification_id>
          <classification>JogAmp</classification>
          <product>Gluegen</product>
          <component>core</component>
          <version>2</version>
          <rep_platform>All</rep_platform>
          <op_sys>all</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>---</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Sven Gothel">sgothel</reporter>
          <assigned_to name="Sven Gothel">sgothel</assigned_to>
          <cc>gouessej</cc>
    
    <cc>ruckc</cc>
          
          <cf_type>---</cf_type>
          <cf_scm_refs>4aa1478b2e4f1401b08d093461b37a14c9501c29
b05f716cbcbc379588050c8f3d91579b3a14ec88</cf_scm_refs>
          <cf_workaround>---</cf_workaround>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>3017</commentid>
    <comment_count>0</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2013-10-01 13:08:46 +0200</bug_when>
    <thetext>I discourage this design, since such deployment removes our artifacts as stored in
the jar&apos;s manifest file, which helps identifying the jogamp modules for bug reports etc.

Further more, adding all native library files for all supported platforms
will add-up to +3M of _compressed_ jar data!

However, since we don&apos;t want to patronize our user base, 
we shall add this capability to our native JAR lib loading mechanism.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>3018</commentid>
    <comment_count>1</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2013-10-01 13:17:50 +0200</bug_when>
    <thetext>http://jogamp.org/git/?p=gluegen.git;a=commit;h=4aa1478b2e4f1401b08d093461b37a14c9501c29

    JNILibLoaderBase.addNativeJarLibsImpl(..):
    
    If the modules&apos;s jar file contains the folder &apos;natives/&lt;os.and.arch&gt;/&apos;
    we assume a big-fat jar and attempt to load all native libraries from the same.
    
    The test for above folder is performed via the class ClassLoader&apos;s getResource(..)
    and is considered inexpensive.
    
    If the folder exists and native libraries could be loaded, the method returns successfull.
    
    Otherwise, the &apos;slim&apos; jar file is attempted to be loaded, even if such folder exist.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>3019</commentid>
    <comment_count>2</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2013-10-01 13:38:06 +0200</bug_when>
    <thetext>.. doesn&apos;t work w/ a JOGL test case .. 


NativeLibrary.findLibrary(&lt;nativewindow_x11&gt;) (TempJarCache): /tmp/jogamp_0000/file_cache/jln7213615344288012373/jln7163851605135055114/natives/linux-amd64/libnativewindow_x11.so
JNILibLoaderBase: loadLibraryInternal(nativewindow_x11), TempJarCache: /tmp/jogamp_0000/file_cache/jln7213615344288012373/jln7163851605135055114/natives/linux-amd64/libnativewindow_x11.so
JNILibLoaderBase: System.load(/tmp/jogamp_0000/file_cache/jln7213615344288012373/jln7163851605135055114/natives/linux-amd64/libnativewindow_x11.so) - mode 2
JNILibLoaderBase: loadLibraryInternal(nativewindow_x11): OK - mode 2
JNILibLoaderBase: Loaded Native Library: nativewindow_x11
JNILibLoaderBase: loaded nativewindow_x11
main - DynamicLibraryBundle.init start with: jogamp.opengl.x11.glx.X11GLXDynamicLibraryBundleInfo
NativeLibrary.findLibrary(&lt;libGL.so.1&gt;) (TempJarCache): null
NativeLibrary.findLibrary(&lt;libGL.so.1&gt;, sun.misc.Launcher$AppClassLoader@13de6be9) (CL): null
NativeLibrary.open(global true): Trying to load libGL.so.1

...


Stack: [0x00007f14ab43d000,0x00007f14ab53e000],  sp=0x00007f14ab5396b0,  free space=1009k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [ld-linux-x86-64.so.2+0x907b]  _dl_rtld_di_serinfo+0xa7b
C  0x00007f14ab57a548

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  java.lang.ClassLoader$NativeLibrary.find(Ljava/lang/String;)J+0
j  java.lang.ClassLoader.findNative(Ljava/lang/ClassLoader;Ljava/lang/String;)J+49
v  ~StubRoutines::call_stub
j  jogamp.common.os.UnixDynamicLinkerImpl.dlopen(Ljava/lang/String;I)J+0
j  jogamp.common.os.UnixDynamicLinkerImpl.openLibraryImpl(Ljava/lang/String;IZ)J+6
j  jogamp.common.os.PosixDynamicLinkerImpl.openLibraryGlobal(Ljava/lang/String;Z)J+6
j  com.jogamp.common.os.NativeLibrary.open(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLjava/lang/ClassLoader;Z)Lcom/jogamp/common/os/NativeLibrary;+103
j  com.jogamp.common.os.NativeLibrary.open(Ljava/lang/String;Ljava/lang/ClassLoader;Z)Lcom/jogamp/common/os/NativeLibrary;+6
j  com.jogamp.common.os.DynamicLibraryBundle.loadFirstAvailable(Ljava/util/List;Ljava/lang/ClassLoader;Z)Lcom/jogamp/common/os/NativeLibrary;+27
j  com.jogamp.common.os.DynamicLibraryBundle.loadLibraries()V+77
j  com.jogamp.common.os.DynamicLibraryBundle.access$000(Lcom/jogamp/common/os/DynamicLibraryBundle;)V+1
j  com.jogamp.common.os.DynamicLibraryBundle$1.run()V+4
j  com.jogamp.common.util.RunnableExecutor$CurrentThreadExecutor.invoke(ZLjava/lang/Runnable;)V+1
j  com.jogamp.common.os.DynamicLibraryBundle.&lt;init&gt;(Lcom/jogamp/common/os/DynamicLibraryBundleInfo;)V+250
j  jogamp.opengl.GLDynamicLookupHelper.&lt;init&gt;(Ljogamp/opengl/GLDynamicLibraryBundleInfo;)V+2
j  jogamp.opengl.DesktopGLDynamicLookupHelper.&lt;init&gt;(Ljogamp/opengl/DesktopGLDynamicLibraryBundleInfo;)V+2
j  jogamp.opengl.x11.glx.X11GLXDrawableFactory$1.run()Ljogamp/opengl/DesktopGLDynamicLookupHelper;+11
j  jogamp.opengl.x11.glx.X11GLXDrawableFactory$1.run()Ljava/lang/Object;+1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>3020</commentid>
    <comment_count>3</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2013-10-01 15:37:57 +0200</bug_when>
    <thetext>    Bug 845: Fix JNILibLoaderBase.addNativeJarLibsImpl(..) fat-jar case.
    
    Always use the jar-basename when calling TempJarCache.addNativeLibs(..),
    otherwise it is mapped and loaded multiple times leading to different native libraries.
    
    Simplify addNativeJarLibsImpl(..) argument semantics by passing complete jarBasename
    and nativeJarBasename (w/ suffix).
    
    Added manual test scripts validating [gluegen + jogl] usage
    with multi (Bug 843) and fat (Bug 845) jar configurations.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>3026</commentid>
    <comment_count>4</comment_count>
    <who name="Julien Gouesse">gouessej</who>
    <bug_when>2013-10-02 16:33:59 +0200</bug_when>
    <thetext>(In reply to comment #0)
&gt; I discourage this design, since such deployment removes our artifacts as
&gt; stored in
&gt; the jar&apos;s manifest file, which helps identifying the jogamp modules for bug
&gt; reports etc.
&gt; 
&gt; Further more, adding all native library files for all supported platforms
&gt; will add-up to +3M of _compressed_ jar data!
&gt; 
&gt; However, since we don&apos;t want to patronize our user base, 
&gt; we shall add this capability to our native JAR lib loading mechanism.

Moreover, some web browsers may modify the content of JARs when downloading them which de facto prevents from &quot;running&quot; them. The default archivers under GNU Linux and Windows often open them as ZIP archives which prevents from running them once again.

A fat JAR should only be used in the following cases:
- with Java Web Start (and JARs signed with a &quot;trusted&quot; certificate), when the OCSP requests take a very long time because of an high number of JARs and/or slow OCSP servers. Oracle plans to replace OCSP by another mechanism
- with another installer in order to improve the native integration of an application based on JOGL, for example with IzPack. Using a native installer is very helpful to work around the limitations of the deployment of applications as JARs as double-clicking on them is not guaranteed to work as I&apos;ve just explained above.

Fat JARs can be created with some build tools including Ant. For example, you can use the &quot;zip&quot; task with the &quot;zipgroupfileset&quot; task to merge JARs but the raw result is a bit messy.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>3637</commentid>
    <comment_count>5</comment_count>
    <who name="Julien Gouesse">gouessej</who>
    <bug_when>2014-01-24 16:36:46 +0100</bug_when>
    <thetext>At first, there is a risk of crash Ant when updating a JAR/ZIP with duplicate entries, I advise to use at least Ant 1.9.2:
https://issues.apache.org/bugzilla/show_bug.cgi?id=54967

This is an example of macro that merges jogl-all.jar, gluegen-rt.jar, gluegen-rt-natives-windows-i586.jar and jogl-all-natives-windows-i586.jar into a single fat jar:

&lt;macrodef name=&quot;create_jogamp_fatjar&quot;&gt;
    &lt;attribute name=&quot;src&quot; /&gt;
    &lt;attribute name=&quot;dest&quot; /&gt;
    &lt;sequential&gt;
        &lt;delete file=&quot;@{dest}&quot; failonerror=&quot;false&quot; /&gt;
        &lt;unzip src=&quot;@{src}/gluegen-rt-natives-windows-i586.jar&quot; dest=&quot;@{src}/natives/windows-i586&quot;&gt;
            &lt;patternset&gt;
                &lt;include name=&quot;*.dll&quot; /&gt;
            &lt;/patternset&gt;
        &lt;/unzip&gt;
        &lt;unzip src=&quot;@{src}/jogl-all-natives-windows-i586.jar&quot; dest=&quot;@{src}/natives/windows-i586&quot;&gt;
            &lt;patternset&gt;
                &lt;include name=&quot;*.dll&quot; /&gt;
            &lt;/patternset&gt;
        &lt;/unzip&gt;
        &lt;zip destfile=&quot;@{dest}&quot;&gt;
            &lt;zipgroupfileset dir=&quot;@{src}&quot; includes=&quot;*.jar&quot; excludes=&quot;*-natives-*.jar&quot; /&gt;
            &lt;zipfileset dir=&quot;@{src}&quot; includes=&quot;**/*.dll&quot; /&gt;
            &lt;zipfileset dir=&quot;@{src}&quot; includes=&quot;**/*.so&quot; /&gt;
        &lt;/zip&gt;
        &lt;delete dir=&quot;@{src}/natives&quot; /&gt;
    &lt;/sequential&gt;
&lt;/macrodef&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>3886</commentid>
    <comment_count>6</comment_count>
    <who name="Curtis Ruck">ruckc</who>
    <bug_when>2014-05-01 06:56:22 +0200</bug_when>
    <thetext>Any chance of supporting loading all libraries from / as a fall-back if not found ind /natives/&lt;os.and.arch&gt;/?

When using maven-shade-plugin to generate a fat-jar, it squashes them all into where they are located in their original jars.

Another idea might be to nest them into their natives/&lt;os.and.arch&gt;/ in their native jars instead of at the root level.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4450</commentid>
    <comment_count>7</comment_count>
    <who name="Julien Gouesse">gouessej</who>
    <bug_when>2014-11-18 22:36:37 +0100</bug_when>
    <thetext>(In reply to comment #6)
&gt; Any chance of supporting loading all libraries from / as a fall-back if not
&gt; found ind /natives/&lt;os.and.arch&gt;/?
&gt; 
&gt; When using maven-shade-plugin to generate a fat-jar, it squashes them all
&gt; into where they are located in their original jars.
&gt; 
&gt; Another idea might be to nest them into their natives/&lt;os.and.arch&gt;/ in
&gt; their native jars instead of at the root level.

Maybe you could use a post-treatment rather than asking us to modify JOGL JAR file handling. We won&apos;t support tens of different conventions. You can use Maven Ant plugin and modify the resulting JARs by yourself.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>