<?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>1172</bug_id>
          
          <creation_ts>2015-07-08 00:42:01 +0200</creation_ts>
          <short_desc>Always file native libs in &apos;natives/os.and.arch&apos;; Allow using maven-assembly-plugin single jar deployment</short_desc>
          <delta_ts>2015-09-27 03:25:21 +0200</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.3.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>major</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>1118</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter>dylan.millikin</reporter>
          <assigned_to name="Xerxes Rånby">xerxes</assigned_to>
          <cc>gouessej</cc>
    
    <cc>kjolhede</cc>
    
    <cc>org.jogamp</cc>
    
    <cc>sgothel</cc>
    
    <cc>xerxes</cc>
    
    <cc>xerxes</cc>
          
          <cf_type>FEATURE</cf_type>
          <cf_scm_refs>3f73bbbd44721cc666e4d3505fcf163490636ba8
41d89263109d20dbcfcc7a642c88a290b4877b5f
b4ad01b53421a58ccfe7028a520cf3e06d6b6742</cf_scm_refs>
          <cf_workaround>---</cf_workaround>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>4761</commentid>
    <comment_count>0</comment_count>
    <who name="">dylan.millikin</who>
    <bug_when>2015-07-08 00:42:01 +0200</bug_when>
    <thetext>I&apos;m running ubuntu 14.04LTS and when I run the following piece of code I get an error:

GLProfile glp = GLProfile.getDefault();

The error is:

Exception in thread &quot;main&quot; java.lang.UnsatisfiedLinkError: /tmp/jogamp_0000/file_cache/jln7005008932607663889/jln8160798677507740369/libgluegen-rt.so: /tmp/jogamp_0000/file_cache/jln7005008932607663889/jln8160798677507740369/libgluegen-rt.so: cannot open shared object file: No such file or directory (Possible cause: can&apos;t load this .so (machine code=0xb7) on a AMD 64-bit platform))
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1937)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1822)
        at java.lang.Runtime.load0(Runtime.java:809)
        at java.lang.System.load(System.java:1086)
        at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoaderBase.java:575)
        at com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase.java:63)
        at com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(JNILibLoaderBase.java:95)
        at com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase.java:459)
        at com.jogamp.common.os.DynamicLibraryBundle$GlueJNILibLoader.loadLibrary(DynamicLibraryBundle.java:421)
        at com.jogamp.common.os.Platform$1.run(Platform.java:317)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.jogamp.common.os.Platform.&lt;clinit&gt;(Platform.java:287)
        at com.jogamp.opengl.GLProfile.&lt;clinit&gt;(GLProfile.java:146)
        at com.dmill.enki.App.main(App.java:30)


From checking, the files are on the disk but they don&apos;t have execution rights (don&apos;t know if this is relevant)

bellow is more information about the system:

 &gt; java -version
java version &quot;1.8.0_45&quot;
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

 &gt; jogl installed via maven :
&lt;dependency&gt;
   &lt;groupId&gt;org.jogamp.gluegen&lt;/groupId&gt;
   &lt;artifactId&gt;gluegen-rt-main&lt;/artifactId&gt;
   &lt;version&gt;2.3.1&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
   &lt;groupId&gt;org.jogamp.jogl&lt;/groupId&gt;
   &lt;artifactId&gt;jogl-all-main&lt;/artifactId&gt;
   &lt;version&gt;2.3.1&lt;/version&gt;
&lt;/dependency&gt;

&gt; uname -a
Linux ubuntu 3.13.0-53-generic #89-Ubuntu SMP Wed May 20 10:34:39 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4762</commentid>
    <comment_count>1</comment_count>
    <who name="Xerxes Rånby">xerxes</who>
    <bug_when>2015-07-08 09:37:26 +0200</bug_when>
    <thetext>machine code=0xb7 is EM_AARCH64

it appears that the AMD 64 libgluegen-rt.so has been overwritten on your system with the AARCH 64 libgluegen-rt.so.
This can happen if you unpack all jogamp jar&apos;s into the same folder or into the same jar.

Please describe how you have deployed your application.

Do this error occur after you have exported your application using Eclipse runnable jar (unpack all files into the jar) or some other kind of &quot;onejar&quot; deployment option?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4816</commentid>
    <comment_count>2</comment_count>
    <who name="">dylan.millikin</who>
    <bug_when>2015-07-25 16:23:23 +0200</bug_when>
    <thetext>Sorry for the delay in response.
I&apos;ve simply imported the library with maven as stated in my original post.
I then:
mvn package // which produces a jar with dependencies
java -cp target/my-app-1.0-SNAPSHOT-with-dependencies.jar com.mycompany.app.App

The application then creates a temp folder with the libgluegen-rt.so and then I get the error.

I haven&apos;t one any extra installation. It may be possible that netbeans is doing something in the background but I would find that surprising.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4817</commentid>
    <comment_count>3</comment_count>
    <who name="">dylan.millikin</who>
    <bug_when>2015-07-25 16:40:04 +0200</bug_when>
    <thetext>Thinking about it I guess this counts as a one-jar deployement. Do you know how this could be fixed? The builde section of the pom.xml is as follows:

  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
            &lt;!-- NOTE: We don&apos;t need a groupId specification because the group is
                 org.apache.maven.plugins ...which is assumed by default.
             --&gt;
            &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
            &lt;version&gt;2.5.5&lt;/version&gt;
            &lt;configuration&gt;
              &lt;descriptorRefs&gt;
                &lt;descriptorRef&gt;jar-with-dependencies&lt;/descriptorRef&gt;
              &lt;/descriptorRefs&gt;
            &lt;/configuration&gt;
            &lt;executions&gt;
            &lt;execution&gt;
              &lt;id&gt;make-assembly&lt;/id&gt; &lt;!-- this is used for inheritance merges --&gt;
              &lt;phase&gt;package&lt;/phase&gt; &lt;!-- bind to the packaging phase --&gt;
              &lt;goals&gt;
                &lt;goal&gt;single&lt;/goal&gt;
              &lt;/goals&gt;
            &lt;/execution&gt;
          &lt;/executions&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4881</commentid>
    <comment_count>4</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2015-08-05 17:00:57 +0200</bug_when>
    <thetext>Well, as Xerxes pointed out, this is a maven deployment issue.
In jogl-demos, Mark has provided a test for using our maven repos
and they are working.

In case you like to use a one-jar, a.k.a. fat-jar approach,
you can right now, look at Bug 1145.
However, we have no fat-jar in our maven repo (yet).
IMHO .. this is not intended .. but dunno.

Adding Mark to the CC list, in case he likes to join the conversation.

Pls reopen bug in case it turns out this issue is our fault.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4884</commentid>
    <comment_count>5</comment_count>
    <who name="Xerxes Rånby">xerxes</who>
    <bug_when>2015-08-06 01:12:54 +0200</bug_when>
    <thetext>(In reply to comment #4)
&gt; Well, as Xerxes pointed out, this is a maven deployment issue.
&gt; In jogl-demos, Mark has provided a test for using our maven repos
&gt; and they are working.
&gt; 
&gt; In case you like to use a one-jar, a.k.a. fat-jar approach,
&gt; you can right now, look at Bug 1145.
&gt; However, we have no fat-jar in our maven repo (yet).
&gt; IMHO .. this is not intended .. but dunno.
&gt; 
&gt; Adding Mark to the CC list, in case he likes to join the conversation.
&gt; 
&gt; Pls reopen bug in case it turns out this issue is our fault.

I can propose a solution to fix overwrites of natives that occur when using:
* the maven maven-assembly-plugin single goal jar deployment as described in this bug
* the eclipse &quot;one-jar&quot; -&gt; export -&gt; java runnable jar file -&gt; * &quot;Extract required libraries into generated JAR&quot;
deployment options.

We can avoid the overwrites of natives if JogAmp do:
* change the location of the native library inside the &quot;single&quot; native jars 
  -&gt; to use the same in-jar folder structure for native jars as the fat-jar.

Example: the location of the native library inside the &quot;single&quot; native jar for gluegen-rt linux-armv6hf 
gluegen-rt-natives-linux-armv6hf.jar
is currently 
/libgluegen-rt.so

If this was changed to use same in-jar folder structure for native jars as the fat-jar then the new in-jar location would be:
/natives/linux-armv6hf/libgluegen-rt.so

Such a change would allow users to use the two new deployment options that extract all jars into one as mentioned above.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4920</commentid>
    <comment_count>6</comment_count>
    <who name="Julien Gouesse">gouessej</who>
    <bug_when>2015-08-11 19:37:34 +0200</bug_when>
    <thetext>(In reply to comment #5)
&gt; (In reply to comment #4)
&gt; &gt; Well, as Xerxes pointed out, this is a maven deployment issue.
&gt; &gt; In jogl-demos, Mark has provided a test for using our maven repos
&gt; &gt; and they are working.
&gt; &gt; 
&gt; &gt; In case you like to use a one-jar, a.k.a. fat-jar approach,
&gt; &gt; you can right now, look at Bug 1145.
&gt; &gt; However, we have no fat-jar in our maven repo (yet).
&gt; &gt; IMHO .. this is not intended .. but dunno.
&gt; &gt; 
&gt; &gt; Adding Mark to the CC list, in case he likes to join the conversation.
&gt; &gt; 
&gt; &gt; Pls reopen bug in case it turns out this issue is our fault.
&gt; 
&gt; I can propose a solution to fix overwrites of natives that occur when using:
&gt; * the maven maven-assembly-plugin single goal jar deployment as described in
&gt; this bug
&gt; * the eclipse &quot;one-jar&quot; -&gt; export -&gt; java runnable jar file -&gt; * &quot;Extract
&gt; required libraries into generated JAR&quot;
&gt; deployment options.
&gt; 
&gt; We can avoid the overwrites of natives if JogAmp do:
&gt; * change the location of the native library inside the &quot;single&quot; native jars 
&gt;   -&gt; to use the same in-jar folder structure for native jars as the fat-jar.
&gt; 
&gt; Example: the location of the native library inside the &quot;single&quot; native jar
&gt; for gluegen-rt linux-armv6hf 
&gt; gluegen-rt-natives-linux-armv6hf.jar
&gt; is currently 
&gt; /libgluegen-rt.so
&gt; 
&gt; If this was changed to use same in-jar folder structure for native jars as
&gt; the fat-jar then the new in-jar location would be:
&gt; /natives/linux-armv6hf/libgluegen-rt.so
&gt; 
&gt; Such a change would allow users to use the two new deployment options that
&gt; extract all jars into one as mentioned above.

I agree with this change, I&apos;m all for it, it would ease the use of build tools that can&apos;t rely on jogamp-fat.jar, they would just have to preserve the location of the native libraries, for example with Maven and Gradle.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4922</commentid>
    <comment_count>7</comment_count>
    <who name="Xerxes Rånby">xerxes</who>
    <bug_when>2015-08-12 12:50:15 +0200</bug_when>
    <thetext>Branch to merge:
https://github.com/xranby/gluegen/tree/bug1172

Implements: Use the same in-jar folder structure for native jars as the fat-jar.

gluegen and jogl
    cd make
    ant
    ant junit.run
passes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4948</commentid>
    <comment_count>8</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2015-08-18 02:56:55 +0200</bug_when>
    <thetext>3f73bbbd44721cc666e4d3505fcf163490636ba8
  Use the same in-jar folder structure for native jars as the fat-jar

  Patches macro &apos;native.tag.jar&apos; to use the native/os.and.arch
  structure as used in fat-jar, as used by all modules
  for native jar production.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4949</commentid>
    <comment_count>9</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2015-08-18 03:31:50 +0200</bug_when>
    <thetext>commit 41d89263109d20dbcfcc7a642c88a290b4877b5f

    TempJarCache: Only copy native library files from 
    &apos;natives/os.and.arch&apos;, reducing JAR search.
    
    Since all native libraries are now contained within &apos;natives/os.and.arch&apos;,
    we don&apos;t need to search the whole JAR file anymore
    but simply can copy the content of the defined folder - if existing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4950</commentid>
    <comment_count>10</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2015-08-18 03:35:35 +0200</bug_when>
    <thetext>Changed title to match patch, was:
&quot;Fix Failure to load libgluegen-rt.so after maven maven-assembly-plugin single goal jar deployment&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4967</commentid>
    <comment_count>11</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2015-08-18 12:21:45 +0200</bug_when>
    <thetext>b4ad01b53421a58ccfe7028a520cf3e06d6b6742
  Add performance counter for native-jar lookup: 
  Property &apos;jogamp.debug.JNILibLoader.Perf&apos;

Xerxes could confirm, regarding 
commit 41d89263109d20dbcfcc7a642c88a290b4877b5f, comment 9:
&quot;we reduced startup time with ~half a second on the raspberry pi by reducing places to look for natives etc&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4969</commentid>
    <comment_count>12</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2015-08-18 12:30:33 +0200</bug_when>
    <thetext>On a fast desktop machine (sgothel):
  libgluegen-rt.jar + jogl-all.jar -&gt; 14 ms

On a raspi2 (xerxes):
  libgluegen-rt.jar + jogl-all.jar -&gt; 80 ms</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>5030</commentid>
    <comment_count>13</comment_count>
    <who name="Xerxes Rånby">xerxes</who>
    <bug_when>2015-08-28 01:40:41 +0200</bug_when>
    <thetext>*** Bug 1118 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>