Terasology icon indicating copy to clipboard operation
Terasology copied to clipboard

Unable to build Terasology on M1 Mac.

Open jrddunbr opened this issue 2 years ago • 4 comments

General Info

Terasology Launcher Version: N/A Terasology Version: Git fbc40c3fe2cf0c605f950c19e6c021f43aa43c05 Operating System: macOS Monterey 12.4 Onboard / Dedicated Graphics: It's a M1 Java Version: openjdk 11.0.15 2022-04-19 LTS

What you were trying to do

Run the game per the instructions provided on the main readme page.

What actually happened

During the run of ./gradlew game:

> Task :engine:generateProto FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':engine:generateProto'.
> Could not resolve all files for configuration ':engine:protobufToolsLocator_protoc'.
   > Could not find protoc-3.17.0-osx-aarch_64.exe (com.google.protobuf:protoc:3.17.0).
     Searched in the following locations:
         https://repo.maven.apache.org/maven2/com/google/protobuf/protoc/3.17.0/protoc-3.17.0-osx-aarch_64.exe

How to reproduce

  1. Clone Github repository. Check out git commit fbc40c3fe2cf0c605f950c19e6c021f43aa43c05
  2. ./groovyw module init iota
  3. ./gradlew game

Watch as it fails to build for M1 Mac with error above.

Log details

https://pastebin.com/12tVEmbd

Screenshots

N/A

Workaround

Have not had the time to test any workarounds. Checked the Google protobuffs website and did not find a version of the package that failed to download for an ARM based Mac.

Additional Infos / Context

I'm using the Amazon Corretto Java 11 JDK for the macOS system that uses the native aarch64 binaries. I have not tried compatibility mode.

jrddunbr avatar Jun 25 '22 16:06 jrddunbr

For what it's worth, I tried to use the Terasology Launcher for Mac (4.5.0 from the website) as well, but it showed me a rectangular window with a progress bar, and then disappeared entirely. Unsure why that occurs, but the launcher doesn't really work either as a result.

jrddunbr avatar Jun 25 '22 16:06 jrddunbr

Yeah, we could use some help on that front. I don't think any of the recent devs have an M1 (though Cerv can sometimes test things out).

I didn't even realize there were JDKs that had backported M1 support to Java 11! I was afraid we'd need to get the migration to Java 17 done before we could even start on M1. See #3976

keturn avatar Jun 26 '22 01:06 keturn

Hmm. For what it's worth, if you can upgrade the Google Protobufs dependency, it's provided in later versions, see the maven release here: https://repo1.maven.org/maven2/com/google/protobuf/protoc/3.19.2/

That might fix it; I'll probe it later when I have some time and report back.

jrddunbr avatar Jun 26 '22 03:06 jrddunbr

Gets a bit further, but encounters another shared library that can't be loaded.

[LWJGL] Failed to load a library. Possible solutions:
	a) Add the directory that contains the shared library to -Djava.library.path or -Dorg.lwjgl.librarypath.
	b) Add the JAR that contains the shared library to the classpath.
[LWJGL] Enable debug mode with -Dorg.lwjgl.util.Debug=true for better diagnostics.
[LWJGL] Enable the SharedLibraryLoader debug mode with -Dorg.lwjgl.util.DebugLoader=true for better diagnostics.
Exception in thread "splashscreen-loop" java.lang.UnsatisfiedLinkError: Failed to locate library: liblwjgl.dylib
	at org.lwjgl.system.Library.loadSystem(Library.java:164)
	at org.lwjgl.system.Library.loadSystem(Library.java:63)
	at org.lwjgl.system.Library.<clinit>(Library.java:51)
	at org.lwjgl.glfw.GLFW.<clinit>(GLFW.java:30)
	at org.terasology.engine.GLFWSplashScreen.run(GLFWSplashScreen.java:58)
	at java.base/java.lang.Thread.run(Thread.java:829)
java.lang.UnsatisfiedLinkError: Can't load library: /Users/jared/Documents/Terasology/natives/macosx/libbullet-darwin-amd64.dylib

jrddunbr avatar Jun 26 '22 04:06 jrddunbr

I made some progress with building on M1 (see draft https://github.com/MovingBlocks/Terasology/pull/5085 ) It depends on updated JNBullet (see https://github.com/MovingBlocks/JNBullet/pull/16 ) and updated JNLua (see https://github.com/MovingBlocks/JNLua/issues/9 )

However to completely finish the build there are still remaining issues.

I got stuck on:

> Task :facades:PC:game
-XX:G1ConcRefinementThreads=8 -XX:GCDrainStackTargetSize=64 -XX:InitialHeapSize=268435456 -XX:MaxDirectMemorySize=536870912 -XX:MaxHeapSize=805306368 -XX:+PrintCommandLineFlags -XX:ReservedCodeCacheSize=251658240 -XX:+SegmentedCodeCache -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseG1GC 
13:39:10.011 [main] INFO  org.terasology.engine.Terasology - homeDir is .
PathManager: Initial code location is /Users/###/dev/github/MovingBlocks/Terasology/engine/build/libs/engine-5.4.0-SNAPSHOT.jar
PathManager: Working directory is /Users/###/dev/github/MovingBlocks/Terasology
Exception in thread "splashscreen-loop" java.lang.ExceptionInInitializerError
	at org.lwjgl.glfw.GLFW.glfwInit(GLFW.java:1046)
	at org.terasology.engine.GLFWSplashScreen.run(GLFWSplashScreen.java:58)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.IllegalStateException: GLFW may only be used on the main thread. This check may be disabled with Configuration.GLFW_CHECK_THREAD0.
	at org.lwjgl.glfw.EventLoop.<clinit>(EventLoop.java:30)
	... 3 more

And later in the build also:

[main] INFO  o.t.e.c.s.c.ConfigurationSubsystem - Video Settings: {"pixelFormat":24,"windowPosX":379,"windowPosY":235,"windowWidth":1280,"windowHeight":800,"displayModeSetting":"${engine:menu#video-windowed}","animatedMenu":false,"chunkLods":0.0,"billboardLimit":0.0,"flickeringLight":true,"animateGrass":true,"animateWater":false,"fieldOfView":90.0,"cameraBobbing":true,"renderPlacingBox":true,"blurIntensity":2,"reflectiveWater":false,"vignette":true,"motionBlur":true,"ssao":false,"filmGrain":false,"outline":true,"lightShafts":true,"eyeAdaptation":true,"bloom":true,"dynamicShadows":true,"vrSupport":false,"maxTextureAtlasResolution":4096,"maxChunksUsedForShadowMapping":1024,"shadowMapResolution":4096,"normalMapping":false,"parallaxMapping":false,"dynamicShadowsPcfFiltering":false,"cloudShadows":true,"renderNearest":true,"particleEffectLimit":10,"frameLimit":60,"meshLimit":400,"inscattering":true,"localReflections":false,"vSync":false,"clampLighting":false,"fboScale":100,"uiScale":100,"dumpShaders":false,"volumetricFog":false,"screenshotSize":"${engine:menu#screenshot-size-normal}","screenshotFormat":"png","cameraSettings":{"cameraSetting":"${engine:menu#camera-setting-normal}"},"debug":{"enabled":false,"firstPersonElementsHidden":false,"hudHidden":false,"wireframe":false,"renderChunkBoundingBoxes":false,"renderSkeletons":false,"renderEntityColliders":false}}
java.lang.UnsatisfiedLinkError: Can't load library: /Users/###/Library/Caches/JNA/temp/jna9749991504484582810.tmp
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2622)
	at java.base/java.lang.Runtime.load0(Runtime.java:765)
	at java.base/java.lang.System.load(System.java:1835)
	at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:1018)
	at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:988)
	at com.sun.jna.Native.<clinit>(Native.java:195)
	at com.sun.jna.Structure.setAlignType(Structure.java:280)
	at com.sun.jna.Structure.<init>(Structure.java:197)
	at com.sun.jna.Structure.<init>(Structure.java:193)
	at com.sun.jna.Structure.<init>(Structure.java:180)
	at com.sun.jna.Structure.<init>(Structure.java:172)
	at jopenvr.VRControllerState_t.<init>(VRControllerState_t.java:21)
	at org.terasology.engine.rendering.openvrprovider.OpenVRState.<init>(OpenVRState.java:35)
	at org.terasology.engine.rendering.openvrprovider.OpenVRProvider.<clinit>(OpenVRProvider.java:54)
	at org.terasology.engine.core.subsystem.openvr.OpenVRInput.preInitialise(OpenVRInput.java:43)
	at org.terasology.engine.core.TerasologyEngine.preInitSubsystems(TerasologyEngine.java:291)
	at org.terasology.engine.core.TerasologyEngine.initialize(TerasologyEngine.java:224)
	at org.terasology.engine.Terasology.call(Terasology.java:183)
	at org.terasology.engine.Terasology.call(Terasology.java:70)
	at picocli.CommandLine.executeUserObject(CommandLine.java:1933)
	at picocli.CommandLine.access$1200(CommandLine.java:145)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2332)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2326)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2291)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2159)
	at picocli.CommandLine.execute(CommandLine.java:2058)
	at org.terasology.engine.Terasology.main(Terasology.java:139)

I'll continue trying, however any help or hint is welcome.

asotona avatar Dec 08 '22 12:12 asotona

@skaldarnar see above fyi

jdrueckert avatar Dec 12 '23 11:12 jdrueckert