Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (775)
Games in Android Showcase (230)
games submitted by our members
Games in WIP (856)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Multirelease with modules, java9  (Read 391 times)
0 Members and 1 Guest are viewing this topic.
Offline mudlee

Junior Devvie


Medals: 6
Exp: 5 years



« Posted 2018-10-20 19:04:39 »

Hi.

I require a lwjgl module (org.lwjgl.vulkan.natives) in one of my modules. The compilation (as Spasi explained) fails on windows/linux as natives are not needed there (so its not available during the compilation).
If I remove the requires than it does compile on windows/linux/osx, but it does not run on OSX as the needed lib is not on the classpath during runtime.

The thing is that without requiring natives, after compilation and BEFORE jlinking, there is a
1  
lwjgl-vulkan-3.2.1-SNAPSHOT-natives-macos.jar
in my mods directory, so I thought, I would just need to add that too when jlinking (on OSX) and it will be fine.

So I use jlink then:
1  
jlink --module-path $JAVA_HOME/jmods:build/mods --add-modules org.lwjgl.vulkan.natives --add-modules spck.game --launcher APP=mymodule/Main --compress 2 --no-header-files --no-man-pages --strip-debug --output build/release


But
1  
--add-modules org.lwjgl.vulkan.natives
did not help, it still fails to run on OSX as it does not find the moltenvk libs.

What did I miss?
Offline Spasi
« Reply #1 - Posted 2018-10-20 22:39:14 »

The simple solution is to enable the artifact and "requires org.lwjgl.vulkan.natives" only when preparing a macOS build. Since jlink has to run on each target platform, it's best to have it include only artifacts that will be used on that platform. The Maven/Gradle scripts generated by the build customizer on the LWJGL website, take care of that.

If you don't want to edit your module-info.java (or have different versions of it), your jlink approach is on the correct path: Adding
--add-modules org.lwjgl.vulkan.natives
to the jlink parameters ensures that the Vulkan natives artifact makes it into the linked image. However, it won't be loaded at runtime because it's missing from your application's module-info. If
--add-modules org.lwjgl.vulkan.natives
is also added to the application's launch script, everything will be fine.
Offline mudlee

Junior Devvie


Medals: 6
Exp: 5 years



« Reply #2 - Posted 2018-10-21 05:53:52 »

And it's really as simple as you mentioned. My java9 knowledge lacked this info. Thx!
Pages: [1]
  ignore  |  Print  
 
 

 
hadezbladez (40 views)
2018-11-16 13:46:03

hadezbladez (42 views)
2018-11-16 13:41:33

hadezbladez (23 views)
2018-11-16 13:35:35

hadezbladez (18 views)
2018-11-16 13:32:03

EgonOlsen (1894 views)
2018-06-10 19:43:48

EgonOlsen (1930 views)
2018-06-10 19:43:44

EgonOlsen (1285 views)
2018-06-10 19:43:20

DesertCoockie (1715 views)
2018-05-13 18:23:11

nelsongames (1403 views)
2018-04-24 18:15:36

nelsongames (2035 views)
2018-04-24 18:14:32
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!