Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Part fix for M1 support #5211

Merged
merged 4 commits into from
Feb 18, 2024
Merged

Part fix for M1 support #5211

merged 4 commits into from
Feb 18, 2024

Conversation

priya4991
Copy link
Contributor

@priya4991 priya4991 commented Feb 9, 2024

Partly fixes #5055 . Adds support for lwjgl for macOS-arm64, and updates protoc version from 3.17.0 to 3.18.0 (3.17.0 has no arm64 support).

Still doesnt resolve the build issue due to JNBullet as follows

Screenshot 2024-02-09 at 7 21 28 pm

EDIT: Updated protobuf and protoc to 3.22.0 instead of 3.18.0, as protobuf 3.18.0 has vulnerabilities.

@soloturn
Copy link
Contributor

soloturn commented Feb 12, 2024

would it be ok to update to same protobuf version everywhere?

❯ git grep protobuf | grep gradle
build.gradle.kts:    id("com.google.protobuf") version "0.9.4" apply false
build.gradle.kts:            file("protobuf"),
docs/Troubleshooting-Developer.md:If you're seeing compilation errors relating to protobuf then you might need to run `gradlew genProto` to generate these sources.
engine-tests/build.gradle.kts:    implementation("com.google.protobuf:protobuf-java:3.16.1")
engine/build.gradle:    id("com.google.protobuf")
engine/build.gradle:            srcDir "src/main/protobuf"
engine/build.gradle:    implementation("com.google.protobuf:protobuf-java:3.16.1")
engine/build.gradle:    // Javax for protobuf due to @Generated - needed on Java 9 or newer Javas
engine/build.gradle:    // TODO: Can likely replace with protobuf Gradle task and omit the generated source files instead
engine/build.gradle:protobuf {
engine/build.gradle:        artifact = "com.google.protobuf:protoc:3.17.0"

@priya4991
Copy link
Contributor Author

@soloturn I have updated protobuf and protoc versions to 3.22.0 instead of 3.18.0 because I found some vulnerabilities on the 3.18.0 version of protobuf.

Copy link
Member

@skaldarnar skaldarnar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could run gradlew compileJava just fine on my M1 Mac - not sure whether that's new with this PR or not, though.

Upon running gradlew game I run into the same error as mentioned above:

Exception in thread "splashscreen-loop" 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.check(EventLoop.java:33)
        at org.lwjgl.glfw.GLFW.glfwInit(GLFW.java:1078)
        at org.terasology.engine.GLFWSplashScreen.run(GLFWSplashScreen.java:58)
        at java.base/java.lang.Thread.run(Thread.java:833)
20:26:36.783 [main] INFO  c.b.gdx.physics.bullet.NativeSupport - Loading JNBullet Library:bullet
java.lang.UnsatisfiedLinkError: /Users/skaldarnar/movingblocks/ts-iota/natives/macosx/libbullet-darwin-amd64.dylib: dlopen(/Users/skaldarnar/movingblocks/ts-iota/natives/macosx/libbullet-darwin-amd64.dylib, 0x0001): tried: '/Users/skaldarnar/movingblocks/ts-iota/natives/macosx/libbullet-darwin-amd64.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/skaldarnar/movingblocks/ts-iota/natives/macosx/libbullet-darwin-amd64.dylib' (no such file), '/Users/skaldarnar/movingblocks/ts-iota/natives/macosx/libbullet-darwin-amd64.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))
        at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
        at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:388)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:232)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:174)
        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.badlogic.gdx.physics.bullet.NativeSupport.load(NativeSupport.java:117)
        at com.badlogic.gdx.physics.bullet.Bullet.<clinit>(Bullet.java:28)
        at org.terasology.engine.core.TerasologyEngine.<init>(TerasologyEngine.java:149)
        at org.terasology.engine.core.TerasologyEngineBuilder.build(TerasologyEngineBuilder.java:31)
        at org.terasology.engine.Terasology.call(Terasology.java:169)
        at org.terasology.engine.Terasology.call(Terasology.java:69)
        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:138)

As these changes don't look like this could break anything that is not yet broken I guess we can approve and merge.

Not sure what to do about JNBullet libraries in the long run - I believe that we had discussions about getting rid of it, but I'm by no means knowledgable enough to make a good call here...

@jdrueckert
Copy link
Member

Also doesn't seem to break anything obvious on non-mac.

@BenjaminAmos
Copy link
Contributor

For JNBullet, somebody may want to revive MovingBlocks/JNBullet#16.

@jdrueckert
Copy link
Member

Failing test is known sporadic and not expected to be related to this change.
Merging despite failing check.

@jdrueckert jdrueckert merged commit ae83461 into MovingBlocks:develop Feb 18, 2024
6 of 9 checks passed
@skaldarnar skaldarnar added this to the 2023 Revive - Milestone 3 milestone Jul 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to build Terasology on M1 Mac.
5 participants