Bug 1145 - Provide a JogAmp Big Fat Jar for Beginners [convenient, but inefficient]
Summary: Provide a JogAmp Big Fat Jar for Beginners [convenient, but inefficient]
Status: RESOLVED FIXED
Alias: None
Product: General
Classification: JogAmp
Component: builds (show other bugs)
Version: 2.3.2
Hardware: All all
: --- enhancement
Assignee: Xerxes Rånby
URL:
Depends on: 843 1032
Blocks:
  Show dependency treegraph
 
Reported: 2015-03-10 10:48 CET by Sven Gothel
Modified: 2015-09-27 03:25 CEST (History)
2 users (show)

See Also:
Type: FEATURE
SCM Refs:
gluegen 0240a71c56c1108da6863a2bb34e971ac6a4e061 gluegen cb2c86e887d1ae8a29eab5e3967b6ec99d853218 jogl 3f13a60ca428ed879ad2ac551f7bd808b9ba44a9 jogamp-scripting e58bf0a5418a777ae79387df1a24a6907df686ba jogamp-scripting 0283ed5a7bf9401161845b11179f8689eafdd7a2 jogamp-scripting 6fa617357f82d015e4bfc959b3f38095d66b0b5a gluegen bf4d8786cb732d86db333b43020ecf0af27f60bf gluegen 32f09a5894ce3b157d5439df83703fa6f5336ff4 gluegen 73bb0ada4c77ef86d37747532f4807e0ec0ab51d
Workaround: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sven Gothel 2015-03-10 10:48:40 CET
Beginners may like to experiment using JogAmp modules
by simply downloading one jar file, attached it to their IDE
and play with it.

The one big fat jar file then contains:
  - all modules java-jar
  - all modules and all platforms native jar

Technology wise, we do support 
 - Bug 843 - Allow multi-java-jar w/ multi-native-jar
 - Bug 1032 - Add fallback for native-jar-file location via classpath

Hence this task requires one to simply bundle 
the big fat jogamp jar when aggregating, 
i.e. producing the jogamp-all 7z file!
Comment 1 Sven Gothel 2015-03-10 10:53:16 CET
(In reply to comment #0)
> 
> The one big fat jar file then contains:
>   - all modules java-jar
>   - all modules and all platforms native jar

We should also see how to handle the API doc here, i.e.
  [1] add it to the big fat jar file, _or_
  [2] also provide a big far source zip file

Since [2] would somewhat spoil the intention (one file),
IMHO we should target for [1].
Comment 2 Julien Gouesse 2015-03-23 14:10:13 CET
Should the JogAmp big fat JAR contain both mobile (Android) and desktop native libraries? I remember that I had to remove the Android natives from the directory of the classpath because they were loaded under GNU Linux :s In my humble opinion, we should check that when a developer puts the JARs of the native libraries into the same directory (even those not required by the platform), the proper ones are always loaded and GlueGen never tries to load Android native libraries under GNU Linux.

We'll need to update the wiki, especially if the JogAmp big fat JAR contains the source code and the documentation. As some web browsers still modify the JARs for security purposes (they break them by putting them into ZIP archives), this JogAmp big fat JAR should still be put into a 7z archive.
Comment 3 Sven Gothel 2015-07-29 04:19:19 CEST
gluegen 0240a71c56c1108da6863a2bb34e971ac6a4e061
    New distributed files in 'dist' subfolder for 
    producing fat files via jogamp-scripting:
    
    dist/jogamp-fat.mf
    dist/jogamp-test-fat.mf
    dist/junit.jar

jogamp-scripting e58bf0a5418a777ae79387df1a24a6907df686ba
    Provide JogAmp Big Fat Jars and Fat 7z Archive
    
    New files:
    - fat/jogamp-fat.jar
    - fat/jogamp-fat-test.jar
    - fat/jogamp-fat-java-src.jar
    - archive/jogamp-fat-all.7z

jogamp-scripting 0283ed5a7bf9401161845b11179f8689eafdd7a2
  - Add fat/jogamp-fat-test-java-src.jar
Comment 4 Sven Gothel 2015-07-29 04:23:00 CEST
fat jars will be visible w/ next aggregated build, i.e. tomorrow.
Comment 5 Sven Gothel 2015-07-29 11:01:51 CEST
gluegen cb2c86e887d1ae8a29eab5e3967b6ec99d853218
  Use 'Main-Class' for default launch of useful info/demos

jogl 3f13a60ca428ed879ad2ac551f7bd808b9ba44a9
  Add default main entry test TestGearsES2SimpleNEWT

jogamp-scripting 6fa617357f82d015e4bfc959b3f38095d66b0b5a
  Add oculusvr jars

+++

i.e. fat jars can be launched directly via 'java -jar jogamp-fat.jar'
and 'java -jar jogamp-fat-test.jar'.
Comment 6 Sven Gothel 2015-07-29 15:56:12 CEST
(In reply to comment #2)
> Should the JogAmp big fat JAR contain both mobile (Android) and desktop
> native libraries? I remember that I had to remove the Android natives from
> the directory of the classpath because they were loaded under GNU Linux :s
> In my humble opinion, we should check that when a developer puts the JARs of
> the native libraries into the same directory (even those not required by the
> platform), the proper ones are always loaded and GlueGen never tries to load
> Android native libraries under GNU Linux.
> 
> We'll need to update the wiki, especially if the JogAmp big fat JAR contains
> the source code and the documentation. As some web browsers still modify the
> JARs for security purposes (they break them by putting them into ZIP
> archives), this JogAmp big fat JAR should still be put into a 7z archive.

All implemented .. and build available:

<http://jogamp.org/deployment/archive/master/gluegen_876-joal_603-jogl_1414-jocl_1066/archive/jogamp-fat-all.7z>

<http://jogamp.org/deployment/archive/master/gluegen_876-joal_603-jogl_1414-jocl_1066/fat/>

- not including Android natives
- launchable
Comment 7 Xerxes Rånby 2015-08-12 13:26:41 CEST
Corner Case 1: jogamp modules fail to load the natives if you unpack the fat-jar.
gluegen JNILibLoaderBase needs to be updated to look for natives in the natives/${os.and.arch}/ located on the classpath as a fallback to support using an unpacked fat-jar.

Testcase:
mkdir fat-test
cd fat-test
wget http://jogamp.org/deployment/archive/master/gluegen_882-joal_608-jogl_1422-jocl_1071-signed/fat/jogamp-fat.jar
wget wget http://jogamp.org/deployment/archive/master/gluegen_882-joal_608-jogl_1422-jocl_1071-signed/fat/jogamp-fat-test.jar
unzip -o jogamp-fat-test.jar
unzip -o jogamp-fat.jar
java -cp . com.jogamp.opengl.test.junit.graph.demos.GPUTextNewtDemo
xranby@Xerxes-ESPRIMO:~/fat-test$ java -cp . com.jogamp.opengl.test.junit.graph.demos.GPUTextNewtDemo
Desired win size 800x400
Desired win pos  10/10
Scene MSAA Samples 0
Graph MSAA Samples 0
Graph VBAA Samples 4
Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: /home/xranby/fat-test/libgluegen-rt.so
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1854)
	at java.lang.Runtime.load0(Runtime.java:795)
	at java.lang.System.load(System.java:1062)
	at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoaderBase.java:596)
	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.<clinit>(Platform.java:287)
	at com.jogamp.opengl.GLProfile.<clinit>(GLProfile.java:146)
	at com.jogamp.opengl.test.junit.graph.demos.GPUTextNewtDemo.main(GPUTextNewtDemo.java:103)
Comment 8 Xerxes Rånby 2015-08-12 14:59:12 CEST
(In reply to comment #7)
> Corner Case 1: jogamp modules fail to load the natives if you unpack the
> fat-jar.
> gluegen JNILibLoaderBase needs to be updated to look for natives in the
> natives/${os.and.arch}/ located on the classpath as a fallback to support
> using an unpacked fat-jar.

Branch to merge:
https://github.com/xranby/gluegen/tree/bug1145

Fixes Bug 1145 cc1 when using an unpacked fat-jar
By add current working directory + natives/os-arch/ + library names
to enumerateLibraryPaths
Comment 9 Xerxes Rånby 2015-08-13 02:43:49 CEST
Corner Case 2: null versions reported using the fat-jar

Testcase:
java -cp jogamp-fat.jar com.jogamp.newt.opengl.GLWindow

outputs null versions:
-----------------------------------------------------------------------------------------------------
Package: com.jogamp.gluegen
Extension Name: null
Specification Title: null
...
Implementation Commit: null
-----------------------------------------------------------------------------------------------------
Package: com.jogamp.opengl
Extension Name: null
...
Implementation Commit: null
Comment 10 Julien Gouesse 2015-08-13 11:01:33 CEST
(In reply to comment #9)
> Corner Case 2: null versions reported using the fat-jar
> 
> Testcase:
> java -cp jogamp-fat.jar com.jogamp.newt.opengl.GLWindow
> 
> outputs null versions:
> -----------------------------------------------------------------------------
> ------------------------
> Package: com.jogamp.gluegen
> Extension Name: null
> Specification Title: null
> ...
> Implementation Commit: null
> -----------------------------------------------------------------------------
> ------------------------
> Package: com.jogamp.opengl
> Extension Name: null
> ...
> Implementation Commit: null

This information is extracted from the manifest as far as I know.
Comment 12 Sven Gothel 2015-08-18 02:25:15 CEST
gluegen bf4d8786cb732d86db333b43020ecf0af27f60bf

Fix cc1 NativeLibrary: 
  Add current working directory + natives/os-arch/ + library names

Fixes Bug 1145 cc1 when using an unpacked fat-jar
Comment 13 Sven Gothel 2015-08-18 02:51:40 CEST
gluegen 32f09a5894ce3b157d5439df83703fa6f5336ff4

    Fix cc2: Null versions reported using the fat-jar (JogampVersion)
    
    In case we run fat-jar file, the package name is 'com.jogamp'
    and all entries are based upon GlueGen.
    
    JogampVersion will fall back trying to find a fat-jar Manifest
    in case a null Manifest is being passed.
Comment 14 Sven Gothel 2015-08-18 12:19:49 CEST
73bb0ada4c77ef86d37747532f4807e0ec0ab51d
  JNILibLoaderBase.addNativeJarLibsImpl: Proper order: 
  #1 single-slim-jar, #2 fat-jar, #3 Classpath + TAG.class
    
  We shall attempt the official recommendation 
  of deployment first (single-slim-jar)
  not wasting time trying a 'nativeLibraryPath' lookup within the classpath.