bgfx icon indicating copy to clipboard operation
bgfx copied to clipboard

Apple ARM macOS 11 build fails

Open DominusExult opened this issue 4 years ago • 4 comments

I have an Apple DTK and tried building Mame, failed at bgfx and then tried bgf directly to make a proper report.

Describe the bug Linking example-17-drawstress fails due to unknown arch

To Reproduce Steps to reproduce the behavior:

Following the instructions, I cloned the three repositories and in bgfx ran "make osx". The error I got was:

==== Building example-17-drawstress (debug64) ====
Creating ../../osx64_clang/obj/x64/Debug/example-17-drawstress
Creating ../../osx64_clang/obj/x64/Debug/example-17-drawstress/examples/17-drawstress
Creating ../../osx64_clang/bin/example-17-drawstress.app/Contents/MacOS
drawstress.cpp
Linking example-17-drawstress
ld: warning: ignoring file ../../osx64_clang/obj/x64/Debug/example-17-drawstress/examples/17-drawstress/drawstress.o, building for macOS-arm64 but attempting to link with file built for unknown-x86_64
ld: warning: ignoring file ../../osx64_clang/bin/libexample-glueDebug.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file ../../osx64_clang/bin/libexample-commonDebug.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file ../../osx64_clang/bin/libbimgDebug.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file ../../osx64_clang/bin/libbxDebug.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file ../../osx64_clang/bin/libbgfxDebug.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file ../../osx64_clang/bin/libbimg_decodeDebug.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture arm64:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [../../osx64_clang/bin/example-17-drawstress.app/Contents/MacOS/example-17-drawstressDebug] Error 1
make[1]: *** [example-17-drawstress] Error 2
make: *** [osx-debug64] Error 2

Additional context When building Mame, I ran into some strange problems with the macOS 11 SDK. See https://mametesters.org/view.php?id=7746 I fear this is not working due to some APPKit stuff of the SDK not working when compiled on and for the Apple ARM. As the above error shows that it isn't compiling for ARM but for x86_64

DominusExult avatar Sep 21 '20 08:09 DominusExult

I have no access to Apple DTK, and no one submitted patch for it yet. You can try to fix it and submit PR, or you need to wait for someone else to do it.

bkaradzic avatar Sep 21 '20 14:09 bkaradzic

I'll see if I can make sense of it. My guess is that it needs an additional osx target that sets the correct arch. For now consider this as a heads up that there is something wrong.

DominusExult avatar Sep 22 '20 12:09 DominusExult

Apple might provide patches: https://twitter.com/pixelpartner/status/1275349098036695041/photo/1

bkaradzic avatar Sep 22 '20 15:09 bkaradzic

Through a hacked up makefile and genie.lua mame finally compiled, including bgfx. So I guess you just need to adapt your makefile accordingly https://pastebin.com/aeErxjPF but in a nicer way (this was really just done to allow it to compile, not to commit this :))

DominusExult avatar Sep 29 '20 09:09 DominusExult