OSM2World icon indicating copy to clipboard operation
OSM2World copied to clipboard

"Please port CPU detection to your platform" Error with M1 Chip

Open hb0nd opened this issue 4 years ago • 3 comments

Trying to run OSM2World on an M1 mac results in this error:

Exception in thread "main" java.lang.ExceptionInInitializerError
	at javax.media.opengl.GLProfile.<clinit>(GLProfile.java:82)
	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:210)
	at org.osm2world.console.OSM2World.main(OSM2World.java:144)
Caused by: java.lang.RuntimeException: Please port CPU detection to your platform (mac os x/aarch64)
	at jogamp.common.os.PlatformPropsImpl.getCPUTypeImpl(PlatformPropsImpl.java:166)
	at jogamp.common.os.PlatformPropsImpl.<clinit>(PlatformPropsImpl.java:95)
	... 5 more

I did some research, and it seems to be an issue with GlueGen being an old version (2.0.2). According to this report, it's fixed in GlueGen 2.3.1-1 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=791993

hb0nd avatar Nov 01 '21 19:11 hb0nd

tried just building with a newer version of gluegen, but unfortunately it needs some extra work

hb0nd avatar Nov 01 '21 20:11 hb0nd

Thanks for testing, this is good information as I don't have access to M1 hardware

Upgrading to JOGL 2.4.0 (and the associated gluegen) is something I want to do for other reasons, such as compatibility with modern Java versions. The main challenges are that there's no nicely packaged build of 2.4.0 in the usual maven repositories (so I'll likely end up having to bundle a build with my code), and that upgrading across multiple version jumps does involve significant changes to OSM2World's OpenGL-related code.

tordanik avatar Nov 10 '21 16:11 tordanik

https://mvnrepository.com/artifact/org.jogamp.jogl/jogl-all-main/2.4.0

I've found this if it's any good :)

hb0nd avatar Sep 15 '22 09:09 hb0nd

https://mvnrepository.com/artifact/org.jogamp.jogl/jogl-all-main/2.4.0

Thanks, this turned out to be an excellent hint. I was able to use that repository to upgrade to 2.4.0 by using it as a dependency as described here.

So as of fbe6b37, OSM2World is now using a JOGL 2.4.0 release candidate. Hopefully this takes care of M1 support?

tordanik avatar Dec 30 '22 14:12 tordanik

Screenshot 2022-12-30 at 16 58 49

After installing an M1-native Java8 (https://stackoverflow.com/a/73843488/13351126), it works! thank you so much 😄

The error you get when using java8 through Rosetta, for posterity (expand me) Exception in thread "main" java.lang.UnsatisfiedLinkError: /private/var/folders/28/mvn3_3892cb4fwykn0bk611m0000gn/T/jogamp_0000/file_cache/jln14801305812938588134/jln3604521211879084807/natives/macosx-universal/libgluegen_rt.dylib: dlopen(/private/var/folders/28/mvn3_3892cb4fwykn0bk611m0000gn/T/jogamp_0000/file_cache/jln14801305812938588134/jln3604521211879084807/natives/macosx-universal/libgluegen_rt.dylib, 0x0001): tried: '/private/var/folders/28/mvn3_3892cb4fwykn0bk611m0000gn/T/jogamp_0000/file_cache/jln14801305812938588134/jln3604521211879084807/natives/macosx-universal/libgluegen_rt.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/28/mvn3_3892cb4fwykn0bk611m0000gn/T/jogamp_0000/file_cache/jln14801305812938588134/jln3604521211879084807/natives/macosx-universal/libgluegen_rt.dylib' (no such file), '/private/var/folders/28/mvn3_3892cb4fwykn0bk611m0000gn/T/jogamp_0000/file_cache/jln14801305812938588134/jln3604521211879084807/natives/macosx-universal/libgluegen_rt.dylib at java.base/jdk.internal.loader.NativeLibraries.load(Native Method) at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:384) at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:228) at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:170) at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2389) at java.base/java.lang.Runtime.load0(Runtime.java:755) at java.base/java.lang.System.load(System.java:1953) 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:318) at com.jogamp.common.os.Platform.(Platform.java:290) at com.jogamp.opengl.GLProfile.(GLProfile.java:154) at org.osm2world.viewer.view.ViewerFrame.createCanvas(ViewerFrame.java:340) at org.osm2world.viewer.view.ViewerFrame.(ViewerFrame.java:119) at org.osm2world.console.OSM2World.executeArgumentsGroup(OSM2World.java:205) at org.osm2world.console.OSM2World.main(OSM2World.java:144)

hb0nd avatar Dec 30 '22 17:12 hb0nd