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

Support for macOS 10.14 (Mojave) #75

Closed
joelpurra opened this issue Sep 18, 2021 · 6 comments
Closed

Support for macOS 10.14 (Mojave) #75

joelpurra opened this issue Sep 18, 2021 · 6 comments

Comments

@joelpurra
Copy link

Running Arc on macOS 10.14 (Mojave) broke recently. The issue seems to stem from a recently released precompiled libsdl-arc64.dylib.

dyld: lazy symbol binding failed: Symbol not found: _objc_opt_respondsToSelector
  Referenced from: /private/var/folders/zj/c21l3h8d5w57rhq_tvvvjj400000gn/T/arc/fcc6f76/libsdl-arc64.dylib
  Expected in: /usr/lib/libobjc.A.dylib

dyld: Symbol not found: _objc_opt_respondsToSelector
  Referenced from: /private/var/folders/zj/c21l3h8d5w57rhq_tvvvjj400000gn/T/arc/fcc6f76/libsdl-arc64.dylib
  Expected in: /usr/lib/libobjc.A.dylib

Abort trap: 6

Other open source projects have reported this error on macOS 10.14 when the build targets macOS 10.15.

Could libsdl-arc64.dylib (and potentially other prebuilt library files) be rebuilt with support for macOS 10.14?


Discovered when running Mindustry; v129.1 works, issue starting at v129.2, still exists in v131. Verified using Steam v7-testing v131, mindustry-macos-unstable.zip v131, Mindustry.jar from github releases v129.1-v131, and local builds.

# Tested on macOS 10.14.
git bisect start v129.2 v129.1
git bisect run sh -c 'git clean -fdx :/ && ./gradlew desktop:dist && java -XstartOnFirstThread -jar desktop/build/libs/Mindustry.jar || exit 1'

The specific commit introducing the issue in Mindustry seems to be Anuken/Mindustry@d855840 (updating archash) referencing Anuken/Mindustry#5672 (proposes changes in window handling).

The archash change points to the issue stemming from this repository.

  • 0923799 Mindustry works
  • 52207f8 Changes window handling
  • 88c1a9a Mindustry breaks, has new libsdl-arc64.dylib
@Anuken
Copy link
Owner

Anuken commented Sep 18, 2021

when the build targets macOS 10.15.

It does not. In fact, the build has always targeted 10.9. Every single build flag points to 10.9 as a minimum. The latest MacOS versions seem incapable of targeting 10.14 or below, and the only thing that worked for me in the past was compiling these natives on an ancient Macbook running High Sierra. This laptop is completely dead now, so there's no way for me to do that.

@joelpurra
Copy link
Author

@Anuken: ah, yes. Figured it was something in the build environment for these prebuilt files, rather than in the source code.

I hear you on outdated and failing hardware. Only clinging on to this old installation to play games which broke when the "new 10.15" was released. Seems the issue is now that the "old 10.14" isn't supported...

It'd be nice to know if there's another compatibility flag or workaround available, but this issue may be closed at your convenience as that seems unlikely.

@joelpurra
Copy link
Author

joelpurra commented Sep 18, 2021

@Anuken: by the way, which is the effective minimum macOS version now? The Steam store page for Mindustry still says 10.9, but guess that'll change when v7 stable is publicly released.

@Anuken
Copy link
Owner

Anuken commented Sep 18, 2021

It'd be nice to know if there's another compatibility flag or workaround available

I've tried many different flags & build types, but none of them made a difference. You could try compiling it yourself (brew install ant sdl2 glew ./gradlew backends:backend-sdl:jnigenBuild) and see what happens with the dylib in backend-sdl/libs/macosx64.

@joelpurra
Copy link
Author

joelpurra commented Sep 18, 2021

Sure!

brew install ant sdl2 glew

# NOTE: using OpenJDK.
brew install openjdk
export PATH="/usr/local/opt/openjdk/bin:$PATH"

./gradlew backends:backend-sdl:jnigenBuild

With the rebuilt backends/backend-sdl/libs/macosx64/libsdl-arc64.dylib library files in ../Arc, the latest Mindustry commit on master (Anuken/Mindustry@47dc9c7) works! =)

Unsure if the output is useful for non-10.14 users but feel free to cherry-pick the commit, or ask and I'll create a pull-request with the same.

Seems like something which might be possible to automate on a cloud build farm with macOS support, right?


Outdated arm64 build details

Seems @Anuken performed the same (effective) change in backends/backend-sdl/build.gradle at the same time; rebased on top of the current master. Ignore the below, only kept for possible arm64 build issue reference.

Build failed for arm64 with #error architecture not supported (full output below). Excluding arm64 from the build by removing -arch arm64 worked, although that deleted the built library file too.

Have some (presumably outdated) build tools on this old macbook, but arm64 supports seems to require something newer. Reinstalling/updating Apple's Command Line Tools didn't bring arm64 support, and the latest XCode in the App Store says 10.14 isn't supported.

./gradlew backends:backend-sdl:jnigenBuild with arm64
Downloading https://services.gradle.org/distributions/gradle-7.2-bin.zip
.............................................................................................................

Welcome to Gradle 7.2!

Here are the highlights of this release:
 - Toolchain support for Scala
 - More cache hits when Java source files have platform-specific line endings
 - More resilient remote HTTP build cache behavior

For more details see https://docs.gradle.org/7.2/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)

> Configure project :backends:backend-sdl
Fetching GLEW source...
Fetching SDL-mingw builds...

> Task :arc-core:compileJava
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

> Task :backends:backend-sdl:jnigen
Generating C/C++ for '/games/mindustry/Arc/backends/backend-sdl/src/arc/backend/sdl/jni/SDL.java'...done
Generating C/C++ for '/games/mindustry/Arc/backends/backend-sdl/src/arc/backend/sdl/jni/SDLGL.java'...done
Wrote target 'Linux64' build script '/games/mindustry/Arc/backends/backend-sdl/jni/build-linux64.xml'
Wrote target 'Windows64' build script '/games/mindustry/Arc/backends/backend-sdl/jni/build-windows64.xml'
Wrote target 'Windows' build script '/games/mindustry/Arc/backends/backend-sdl/jni/build-windows32.xml'
Wrote target 'MacOsX64' build script '/games/mindustry/Arc/backends/backend-sdl/jni/build-macosx64.xml'
Wrote master build script '/games/mindustry/Arc/backends/backend-sdl/jni/build.xml'
Apache Ant(TM) version 1.10.11 compiled on July 10 2021
Buildfile: /games/mindustry/Arc/backends/backend-sdl/jni/build-macosx64.xml
Detected Java version: 16 in: /usr/local/Cellar/openjdk/16.0.2/libexec/openjdk.jdk/Contents/Home
Detected OS: Mac OS X
parsing buildfile /games/mindustry/Arc/backends/backend-sdl/jni/build-macosx64.xml with URI = file:/games/mindustry/Arc/backends/backend-sdl/jni/build-macosx64.xml
Project base dir set to: /games/mindustry/Arc/backends/backend-sdl/jni
parsing buildfile jar:file:/usr/local/Cellar/ant/1.10.11/libexec/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/usr/local/Cellar/ant/1.10.11/libexec/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
 [property] Loading Environment env.
Build sequence for target(s) `clean' is [clean]
Complete build sequence is [clean, precompile, create-build-dir, compile, link, strip, postcompile, ]

clean:
   [delete] Directory does not exist: /games/mindustry/Arc/backends/backend-sdl/build/target/native/macosx64
   [delete] Deleting /games/mindustry/Arc/backends/backend-sdl/libs/macosx64/libsdl-arc64.dylib
   [delete] Deleting /games/mindustry/Arc/backends/backend-sdl/libs/macosx64/libsdl-arcarm64.dylib
Build sequence for target(s) `postcompile' is [precompile, create-build-dir, compile, link, strip, postcompile]
Complete build sequence is [precompile, create-build-dir, compile, link, strip, postcompile, clean, ]

precompile:
Property "env.Path" has not been set
Property "env.Path" has not been set
[available] Searching /usr/local/opt/openjdk/bin
[available] Searching /usr/local/bin
[available] Searching /Users/joelpurra/bin
[available] Searching /usr/bin
[available] Found: clang++ in /usr/bin
[available] Searching /usr/local/opt/openjdk/bin
[available] Searching /usr/local/bin
[available] Searching /Users/joelpurra/bin
[available] Searching /usr/bin
[available] Found: clang in /usr/bin
Property "env.Path" has not been set
[available] Searching /usr/local/opt/openjdk/bin
[available] Searching /usr/local/bin
[available] Searching /Users/joelpurra/bin
[available] Searching /usr/bin
[available] Found: strip in /usr/bin

create-build-dir:
     [copy] arc_backend_sdl_jni_SDL.cpp added as arc_backend_sdl_jni_SDL.cpp doesn't exist.
     [copy] arc_backend_sdl_jni_SDLGL.cpp added as arc_backend_sdl_jni_SDLGL.cpp doesn't exist.
     [copy] glew-2.2.0/src/glew.c added as glew-2.2.0/src/glew.c doesn't exist.
     [copy] memcpy_wrap.c added as memcpy_wrap.c doesn't exist.
     [copy] No sources found.
     [copy] Copying 4 files to /games/mindustry/Arc/backends/backend-sdl/build/target/native/macosx64
     [copy] Copying /games/mindustry/Arc/backends/backend-sdl/jni/arc_backend_sdl_jni_SDL.cpp to /games/mindustry/Arc/backends/backend-sdl/build/target/native/macosx64/arc_backend_sdl_jni_SDL.cpp
     [copy] Copying /games/mindustry/Arc/backends/backend-sdl/jni/arc_backend_sdl_jni_SDLGL.cpp to /games/mindustry/Arc/backends/backend-sdl/build/target/native/macosx64/arc_backend_sdl_jni_SDLGL.cpp
     [copy] Copying /games/mindustry/Arc/backends/backend-sdl/jni/glew-2.2.0/src/glew.c to /games/mindustry/Arc/backends/backend-sdl/build/target/native/macosx64/glew-2.2.0/src/glew.c
     [copy] Copying /games/mindustry/Arc/backends/backend-sdl/jni/memcpy_wrap.c to /games/mindustry/Arc/backends/backend-sdl/build/target/native/macosx64/memcpy_wrap.c
   [delete] Deleting /games/mindustry/Arc/backends/backend-sdl/build/target/native/macosx64/arc_backend_sdl_jni_SDL.cpp
   [delete] Deleting /games/mindustry/Arc/backends/backend-sdl/build/target/native/macosx64/arc_backend_sdl_jni_SDLGL.cpp
   [delete] Deleting /games/mindustry/Arc/backends/backend-sdl/build/target/native/macosx64/memcpy_wrap.c

compile:
    [mkdir] Skipping /games/mindustry/Arc/backends/backend-sdl/build/target/native/macosx64 because it already exists.
    [apply] Current OS is Mac OS X
    [apply] arc_backend_sdl_jni_SDL.cpp added as arc_backend_sdl_jni_SDL.o doesn't exist.
    [apply] arc_backend_sdl_jni_SDLGL.cpp added as arc_backend_sdl_jni_SDLGL.o doesn't exist.
    [apply] Executing 'clang++' with arguments:
    [apply] '-I/usr/local/include/SDL2'
    [apply] '-D_THREAD_SAFE'
    [apply] '-c'
    [apply] '-Wall'
    [apply] '-O2'
    [apply] '-arch'
    [apply] 'arm64'
    [apply] '-DFIXED_POINT'
    [apply] '-fmessage-length=0'
    [apply] '-fPIC'
    [apply] '-mmacosx-version-min=10.9'
    [apply] '-stdlib=libc++'
    [apply] '-Ijni-headers'
    [apply] '-Ijni-headers/mac'
    [apply] '-I.'
    [apply] '-Iglew-2.2.0/include'
    [apply] '/games/mindustry/Arc/backends/backend-sdl/jni/arc_backend_sdl_jni_SDL.cpp'
    [apply] '-o'
    [apply] '/games/mindustry/Arc/backends/backend-sdl/build/target/native/macosx64/arc_backend_sdl_jni_SDL.o'
    [apply]
    [apply] The ' characters around the executable and arguments are
    [apply] not part of the command.
    [apply] In file included from /games/mindustry/Arc/backends/backend-sdl/jni/arc_backend_sdl_jni_SDL.cpp:1:
    [apply] In file included from ./arc_backend_sdl_jni_SDL.h:2:
    [apply] In file included from jni-headers/jni.h:39:
    [apply] In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/stdio.h:108:
    [apply] In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/stdio.h:64:
    [apply] In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/_stdio.h:68:
    [apply] #error Unsupported architecture
    [apply]  ^
    [apply] In file included from /games/mindustry/Arc/backends/backend-sdl/jni/arc_backend_sdl_jni_SDL.cpp:1:
    [apply] In file included from ./arc_backend_sdl_jni_SDL.h:2:
    [apply] In file included from jni-headers/jni.h:39:
    [apply] In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/stdio.h:108:
    [apply] In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/stdio.h:64:
    [apply] In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/_stdio.h:71:
    [apply] In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/_types.h:27:
    [apply] In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/_types.h:33:
    [apply] #error architecture not supported
    [apply]  ^
    [apply] In file included from /games/mindustry/Arc/backends/backend-sdl/jni/arc_backend_sdl_jni_SDL.cpp:1:
    [apply] In file included from ./arc_backend_sdl_jni_SDL.h:2:
    [apply] In file included from jni-headers/jni.h:39:
    [apply] In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/stdio.h:108:
    [apply] In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/stdio.h:64:
    [apply] In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/_stdio.h:71:
    [apply] In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/_types.h:27:
    [apply] typedef __int64_t       __darwin_blkcnt_t;      /* total blocks */
    [apply]         ^
    [apply] note: '__int128_t' declared here
    [apply] typedef __int32_t       __darwin_blksize_t;     /* preferred block size */
    [apply]         ^
    [apply] note: '__int128_t' declared here
    [apply] typedef __int32_t       __darwin_dev_t;         /* dev_t */
    [apply]         ^
    [apply] note: '__int128_t' declared here
    [apply] typedef __uint32_t      __darwin_gid_t;         /* [???] process and group IDs */
    [apply]         ^
    [apply] note: '__uint128_t' declared here
    [apply] typedef __uint32_t      __darwin_id_t;          /* [XSI] pid_t, uid_t, or gid_t*/
    [apply]         ^
    [apply] note: '__uint128_t' declared here
    [apply] typedef __uint64_t      __darwin_ino64_t;       /* [???] Used for 64 bit inodes */
    [apply]         ^
    [apply] note: '__uint128_t' declared here
    [apply] typedef __darwin_natural_t __darwin_mach_port_name_t; /* Used by mach */
    [apply]         ^
    [apply] typedef __uint16_t      __darwin_mode_t;        /* [???] Some file attributes */
    [apply]         ^
    [apply] note: '__uint128_t' declared here
    [apply] typedef __int64_t       __darwin_off_t;         /* [???] Used for file sizes */
    [apply]         ^
    [apply] note: '__int128_t' declared here
    [apply] typedef __int32_t       __darwin_pid_t;         /* [???] process and group IDs */
    [apply]         ^
    [apply] note: '__int128_t' declared here
    [apply] typedef __uint32_t      __darwin_sigset_t;      /* [???] signal set */
    [apply]         ^
    [apply] note: '__uint128_t' declared here
    [apply] typedef __int32_t       __darwin_suseconds_t;   /* [???] microseconds */
    [apply]         ^
    [apply] note: '__int128_t' declared here
    [apply] typedef __uint32_t      __darwin_uid_t;         /* [???] user IDs */
    [apply]         ^
    [apply] note: '__uint128_t' declared here
    [apply] typedef __uint32_t      __darwin_useconds_t;    /* [???] microseconds */
    [apply]         ^
    [apply] note: '__uint128_t' declared here
    [apply] In file included from /games/mindustry/Arc/backends/backend-sdl/jni/arc_backend_sdl_jni_SDL.cpp:1:
    [apply] In file included from ./arc_backend_sdl_jni_SDL.h:2:
    [apply] In file included from jni-headers/jni.h:39:
    [apply] In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/stdio.h:108:
    [apply] In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/stdio.h:64:
    [apply] In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/_stdio.h:71:
    [apply] typedef __uint32_t      __darwin_wctype_t;
    [apply]         ^
    [apply] note: '__uint128_t' declared here
    [apply] In file included from /games/mindustry/Arc/backends/backend-sdl/jni/arc_backend_sdl_jni_SDL.cpp:1:
    [apply] In file included from ./arc_backend_sdl_jni_SDL.h:2:
    [apply] In file included from jni-headers/jni.h:39:
    [apply] In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/stdio.h:108:
    [apply] In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/stdio.h:64:
    [apply] In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/_stdio.h:75:
    [apply] In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_va_list.h:31:
    [apply] #error architecture not supported
    [apply]  ^
    [apply] In file included from /games/mindustry/Arc/backends/backend-sdl/jni/arc_backend_sdl_jni_SDL.cpp:1:
    [apply] In file included from ./arc_backend_sdl_jni_SDL.h:2:
    [apply] In file included from jni-headers/jni.h:39:
    [apply] In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/stdio.h:108:
    [apply] In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/stdio.h:64:
    [apply] In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/_stdio.h:75:
    [apply] typedef __darwin_va_list va_list;
    [apply]         ^
    [apply] fatal error: too many errors emitted, stopping now [-ferror-limit=]
    [apply] 20 errors generated.

BUILD FAILED
/games/mindustry/Arc/backends/backend-sdl/jni/build-macosx64.xml:116: apply returned: 1
        at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:675)
        at org.apache.tools.ant.taskdefs.ExecuteOn.runExec(ExecuteOn.java:410)
        at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:527)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:299)
        at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:567)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
        at org.apache.tools.ant.Task.perform(Task.java:350)
        at org.apache.tools.ant.Target.execute(Target.java:449)
        at org.apache.tools.ant.Target.performTasks(Target.java:470)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1401)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1374)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1264)
        at org.apache.tools.ant.Main.runBuild(Main.java:818)
        at org.apache.tools.ant.Main.startAnt(Main.java:223)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:284)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101)

Total time: 1 second

> Task :backends:backend-sdl:jnigenBuildMacOsXARM64 FAILED
Executing '[ant, -f, /games/mindustry/Arc/backends/backend-sdl/jni/build-macosx64.xml, -Drelease=true, clean, postcompile, -v]'

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':backends:backend-sdl:jnigenBuildMacOsXARM64'.
> Ant execution for build-macosx64.xml failed.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 40s
6 actionable tasks: 6 executed

@Anuken
Copy link
Owner

Anuken commented Sep 18, 2021

Unsure if the output is useful for non-10.14 users

I had someone test it on a 10.13 machine, and it appears to work - looks like an issue specific to compilation on Catalina and above. I'll use the dylib from your branch, thanks.

Seems like something which might be possible to automate on a cloud build farm with macOS support, right?

Github Actions doesn't support anything below Catalina as far as I'm aware, and I don't know what other services to use.

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

No branches or pull requests

2 participants