How can I resolve a "Can't load library" error when attempting to run OSM2World?

Hey there,
I am trying out OpenStreetMap for the purposes of generating models for 3D printing. To do this, I am following this workflow:

  1. Export .osm for the area of interest
  2. Load .osm into OSM2World
  3. ???
  4. Profit

Right now, I am having difficulty getting OSM2World to open at all. Fair warning, I am new to Mac, but I am generally fairly computer savvy.

OS is Sequoia 15.1.1 (24B91) on Apple M3. I have installed the matching Java release (ARM64 version) and the JDK 23. java -version returns the following:

java version "23.0.1" 2024-10-15
Java(TM) SE Runtime Environment (build 23.0.1+11-39)
Java HotSpot(TM) 64-Bit Server VM (build 23.0.1+11-39, mixed mode, sharing)

When I try to launch the .jar from Finder, the standard animation indicating that the app is launching appears, but then nothing happens. When I use the terminal to launch it, I follow the instructions at the OSM Wiki. Here is the troubleshooting process I have gone through so far…

  1. java --gui OSM2World.jar
Unrecognized option: -gui
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
  1. java OSM2World.jar
Error: Could not find or load main class OSM2World.jar
Caused by: java.lang.ClassNotFoundException: OSM2World.jar
  1. java -jar OSM2World.jar

This returns a very long trace of the error. From what I can understand, it is looking for libgluegen_r?

No parameters, running graphical interface.
If you want to use the command line, use the --help parameter for a list of available parameters.
No --config parameter, using default style (standard.properties).

Exception in thread "main" java.lang.UnsatisfiedLinkError: /private/var/folders/wb/knk985f92_q7sddwtdk0x2700000gn/T/jogamp_0000/file_cache/jln4014885834698502072/jln4422462275416140795/natives/macosx-universal/libgluegen_rt.dylib: dlopen(/private/var/folders/wb/knk985f92_q7sddwtdk0x2700000gn/T/jogamp_0000/file_cache/jln4014885834698502072/jln4422462275416140795/natives/macosx-universal/libgluegen_rt.dylib, 0x0001): tried: '/private/var/folders/wb/knk985f92_q7sddwtdk0x2700000gn/T/jogamp_0000/file_cache/jln4014885834698502072/jln4422462275416140795/natives/macosx-universal/libgluegen_rt.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/wb/knk985f92_q7sddwtdk0x2700000gn/T/jogamp_0000/file_cache/jln4014885834698502072/jln4422462275416140795/natives/macosx-universal/libgluegen_rt.dylib' (no such file), '/private/var/folders/wb/knk985f92_q7sddwtdk0x2700000gn/T/jogamp_0000/file_cache/jln4014885834698502072/jln4422462275416140795/natives/macosx-universal/libgluegen_r
	at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
	at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:331)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:197)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:139)
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2402)
	at java.base/java.lang.Runtime.load0(Runtime.java:852)
	at java.base/java.lang.System.load(System.java:2028)
	at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoaderBase.java:604)
	at com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase.java:64)
	at com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(JNILibLoaderBase.java:107)
	at com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase.java:488)
	at com.jogamp.common.os.DynamicLibraryBundle$GlueJNILibLoader.loadLibrary(DynamicLibraryBundle.java:427)
	at com.jogamp.common.os.Platform$1.run(Platform.java:321)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:319)
	at com.jogamp.common.os.Platform.<clinit>(Platform.java:290)
	at com.jogamp.opengl.GLProfile.<clinit>(GLProfile.java:154)
	at org.osm2world.viewer.view.ViewerFrame.createCanvas(ViewerFrame.java:340)
	at org.osm2world.viewer.view.ViewerFrame.<init>(ViewerFrame.java:119)
	at org.osm2world.console.OSM2World.executeArgumentsGroup(OSM2World.java:205)
	at org.osm2world.console.OSM2World.main(OSM2World.java:144)
2024-12-20 11:38:27.052 java[21003:200100] +[IMKClient subclass]: chose IMKClient_Modern
2024-12-20 11:38:27.052 java[21003:200100] +[IMKInputSession subclass]: chose IMKInputSession_Modern

Unfortunately, I’m stuck here. I’ve tried searching for this problem file both here and on the web, and I’m drawing a blank. Can anyone help me through this?

Cool, I’d like to see more 3D printing done with OSM2World. Happy to help you iron out some kinks. :slight_smile:

First off, this is a correct command for running OSM2World. Any additional parameters such as --gui go after OSM2World.jar. (Roughly speaking, parameters before it are for Java, parameters after it are for OSM2World.)

However, to save some potential trouble down the road, it’s usually best to execute OSM2World from the bundled scripts. I believe Mac can execute bash shell scripts the same as other unix-like systems? In that case

./osm2world.sh

should start OSM2World as well (and likely produce the same error log as before).

Once you’ve confirmed that, could you give me the output of ./osm2world.sh --version as well?

Thanks! So if I was to run directly from java requesting the gui, the command would be more like java -jar OSM2World.jar --gui?

It looks like the error generated from ./osm2world.sh is pretty similar to what was returned from java -jar OSM2World.jar. It still seems to be looking for libgluegen_r. Error follows:

No parameters, running graphical interface.
If you want to use the command line, use the --help parameter for a list of available parameters.
No --config parameter, using default style (standard.properties).

Exception in thread "main" java.lang.UnsatisfiedLinkError: /private/var/folders/wb/knk985f92_q7sddwtdk0x2700000gn/T/jogamp_0000/file_cache/jln1047933098552790685/jln8571778086143741536/natives/macosx-universal/libgluegen_rt.dylib: dlopen(/private/var/folders/wb/knk985f92_q7sddwtdk0x2700000gn/T/jogamp_0000/file_cache/jln1047933098552790685/jln8571778086143741536/natives/macosx-universal/libgluegen_rt.dylib, 0x0001): tried: '/private/var/folders/wb/knk985f92_q7sddwtdk0x2700000gn/T/jogamp_0000/file_cache/jln1047933098552790685/jln8571778086143741536/natives/macosx-universal/libgluegen_rt.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/wb/knk985f92_q7sddwtdk0x2700000gn/T/jogamp_0000/file_cache/jln1047933098552790685/jln8571778086143741536/natives/macosx-universal/libgluegen_rt.dylib' (no such file), '/private/var/folders/wb/knk985f92_q7sddwtdk0x2700000gn/T/jogamp_0000/file_cache/jln1047933098552790685/jln8571778086143741536/natives/macosx-universal/libgluegen_r
	at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
	at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:331)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:197)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:139)
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2402)
	at java.base/java.lang.Runtime.load0(Runtime.java:852)
	at java.base/java.lang.System.load(System.java:2028)
	at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoaderBase.java:604)
	at com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase.java:64)
	at com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(JNILibLoaderBase.java:107)
	at com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase.java:488)
	at com.jogamp.common.os.DynamicLibraryBundle$GlueJNILibLoader.loadLibrary(DynamicLibraryBundle.java:427)
	at com.jogamp.common.os.Platform$1.run(Platform.java:321)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:319)
	at com.jogamp.common.os.Platform.<clinit>(Platform.java:290)
	at com.jogamp.opengl.GLProfile.<clinit>(GLProfile.java:154)
	at org.osm2world.viewer.view.ViewerFrame.createCanvas(ViewerFrame.java:340)
	at org.osm2world.viewer.view.ViewerFrame.<init>(ViewerFrame.java:119)
	at org.osm2world.console.OSM2World.executeArgumentsGroup(OSM2World.java:205)
	at org.osm2world.console.OSM2World.main(OSM2World.java:144)
2024-12-20 12:26:44.417 java[29177:280297] +[IMKClient subclass]: chose IMKClient_Modern
2024-12-20 12:26:44.417 java[29177:280297] +[IMKInputSession subclass]: chose IMKInputSession_Modern

As for the version number… looks like 0.3.1. I believe that I rolled back to the “most recent numbered version” instead of the “latest build” once I started encountering problems.

No --config parameter, using default style (standard.properties).

OSM2World 0.3.1

Could you try the “latest build” as well, please, just to rule out the possibility that the issue has since been resolved?

libgluegen is related to JOGL, which is what I’m using to call OpenGL from Java. This is the most common culprit of platform-specific issues with OSM2World. After all, Java itself is available across platforms – but graphics acceleration and the related APIs are very closely tied to hardware and OS and therefore requires native code. This functionality is bundled as a library that supposedly bundles and self-extracts the required native code for various system, but that aspect seems to break down somehow.

For your use case, you technically don’t need OpenGL. After all, you’re just trying to convert OSM data into 3D models. As long as you’re comfortable to do this from the command line, an alternative would be to work around the issue by not running the GUI, but using commands such as ./osm2world.sh -i yourinputdata.osm -o output.glb (or … -o output.obj) instead.

Okay, here are the outputs from the latest build:

I1:
./osm2world.sh

O1:

No parameters, running graphical interface.
If you want to use the command line, use the --help parameter for a list of available parameters.
No --config parameter, using default style (standard.properties).

Exception in thread "main" java.lang.UnsatisfiedLinkError: /private/var/folders/wb/knk985f92_q7sddwtdk0x2700000gn/T/jogamp_0000/file_cache/jln2869007402684499583/jln8979252260560065935/natives/macosx-universal/libgluegen_rt.dylib: dlopen(/private/var/folders/wb/knk985f92_q7sddwtdk0x2700000gn/T/jogamp_0000/file_cache/jln2869007402684499583/jln8979252260560065935/natives/macosx-universal/libgluegen_rt.dylib, 0x0001): tried: '/private/var/folders/wb/knk985f92_q7sddwtdk0x2700000gn/T/jogamp_0000/file_cache/jln2869007402684499583/jln8979252260560065935/natives/macosx-universal/libgluegen_rt.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/wb/knk985f92_q7sddwtdk0x2700000gn/T/jogamp_0000/file_cache/jln2869007402684499583/jln8979252260560065935/natives/macosx-universal/libgluegen_rt.dylib' (no such file), '/private/var/folders/wb/knk985f92_q7sddwtdk0x2700000gn/T/jogamp_0000/file_cache/jln2869007402684499583/jln8979252260560065935/natives/macosx-universal/libgluegen_r
	at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
	at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:331)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:197)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:139)
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2402)
	at java.base/java.lang.Runtime.load0(Runtime.java:852)
	at java.base/java.lang.System.load(System.java:2028)
	at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoaderBase.java:604)
	at com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase.java:64)
	at com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(JNILibLoaderBase.java:107)
	at com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase.java:488)
	at com.jogamp.common.os.DynamicLibraryBundle$GlueJNILibLoader.loadLibrary(DynamicLibraryBundle.java:427)
	at com.jogamp.common.os.Platform$1.run(Platform.java:321)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:319)
	at com.jogamp.common.os.Platform.<clinit>(Platform.java:290)
	at com.jogamp.opengl.GLProfile.<clinit>(GLProfile.java:154)
	at org.osm2world.viewer.view.ViewerFrame.createCanvas(ViewerFrame.java:286)
	at org.osm2world.viewer.view.ViewerFrame.<init>(ViewerFrame.java:65)
	at org.osm2world.console.OSM2World.executeArgumentsGroup(OSM2World.java:213)
	at org.osm2world.console.OSM2World.main(OSM2World.java:151)
2024-12-20 14:22:12.787 java[30127:382480] +[IMKClient subclass]: chose IMKClient_Modern
2024-12-20 14:22:12.787 java[30127:382480] +[IMKInputSession subclass]: chose IMKInputSession_Modern

I2:
``

O2:

No parameters, running graphical interface.
If you want to use the command line, use the --help parameter for a list of available parameters.
No --config parameter, using default style (standard.properties).

Exception in thread "main" java.lang.UnsatisfiedLinkError: /private/var/folders/wb/knk985f92_q7sddwtdk0x2700000gn/T/jogamp_0000/file_cache/jln16992065319095270973/jln1239137605431347692/natives/macosx-universal/libgluegen_rt.dylib: dlopen(/private/var/folders/wb/knk985f92_q7sddwtdk0x2700000gn/T/jogamp_0000/file_cache/jln16992065319095270973/jln1239137605431347692/natives/macosx-universal/libgluegen_rt.dylib, 0x0001): tried: '/private/var/folders/wb/knk985f92_q7sddwtdk0x2700000gn/T/jogamp_0000/file_cache/jln16992065319095270973/jln1239137605431347692/natives/macosx-universal/libgluegen_rt.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/wb/knk985f92_q7sddwtdk0x2700000gn/T/jogamp_0000/file_cache/jln16992065319095270973/jln1239137605431347692/natives/macosx-universal/libgluegen_rt.dylib' (no such file), '/private/var/folders/wb/knk985f92_q7sddwtdk0x2700000gn/T/jogamp_0000/file_cache/jln16992065319095270973/jln1239137605431347692/natives/macosx-universal/libglue
	at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
	at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:331)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:197)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:139)
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2402)
	at java.base/java.lang.Runtime.load0(Runtime.java:852)
	at java.base/java.lang.System.load(System.java:2028)
	at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoaderBase.java:604)
	at com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase.java:64)
	at com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(JNILibLoaderBase.java:107)
	at com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase.java:488)
	at com.jogamp.common.os.DynamicLibraryBundle$GlueJNILibLoader.loadLibrary(DynamicLibraryBundle.java:427)
	at com.jogamp.common.os.Platform$1.run(Platform.java:321)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:319)
	at com.jogamp.common.os.Platform.<clinit>(Platform.java:290)
	at com.jogamp.opengl.GLProfile.<clinit>(GLProfile.java:154)
	at org.osm2world.viewer.view.ViewerFrame.createCanvas(ViewerFrame.java:286)
	at org.osm2world.viewer.view.ViewerFrame.<init>(ViewerFrame.java:65)
	at org.osm2world.console.OSM2World.executeArgumentsGroup(OSM2World.java:213)
	at org.osm2world.console.OSM2World.main(OSM2World.java:151)
2024-12-20 14:24:19.453 java[30134:384764] +[IMKClient subclass]: chose IMKClient_Modern
2024-12-20 14:24:19.453 java[30134:384764] +[IMKInputSession subclass]: chose IMKInputSession_Modern

In terms of utilizing the terminal to bypass OpenGL… looks like that works! There are a couple or errors that get thrown during the processing, but it looks like this is due to the content of OpenStreetMap rather than a problem with OSM2World.

Produced model:
Screenshot 2024-12-20 at 2.35.24 PM

Thanks so much for your help! This should get me going for now.

1 Like