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

Update the CI script to build fat x86_64/ARM binaries for macOS #149

Open
sofakng opened this issue Jan 22, 2021 · 6 comments
Open

Update the CI script to build fat x86_64/ARM binaries for macOS #149

sofakng opened this issue Jan 22, 2021 · 6 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@sofakng
Copy link

sofakng commented Jan 22, 2021

Are there any efforts to port this to the Apple M1 chip?

I'm not sure if there is x86 assembly (I'm guessing yes?) but I would be great to have a native version for better optimizations, etc.

@Screwtapello Screwtapello changed the title Support for Apple M1 chip? (re: has anybody been able to compile it?) Update the CI script to build fat x86_64/ARM binaries for macOS Jan 23, 2021
@Screwtapello
Copy link
Contributor

When the Apple M1 chip was first released, somebody on the official discord bought one and compiled higan (and bsnes), and it just worked first time, no porting needed.

A thing we could do is to make sure macOS binaries (nightlies and releases) include both x86_64 and ARM support. I'm not sure what's involved in that (I assume step 1 is for GitHub to update their XCode version, I don't know if they've already done that), but if it's not too complex I would accept a PR for that.

@Screwtapello Screwtapello added enhancement New feature or request help wanted Extra attention is needed labels Jan 23, 2021
@jchv
Copy link
Contributor

jchv commented Jan 23, 2021

There is some assembly in libco, but it doesn't matter since libco is already ported to many architectures including AArch64.

The WIP n64 and psx JITs are both hardcoded using x86 assembly. Those cores need to be excluded from the build until the JIT is ported. (I have done some partial work on this, but haven't pushed it anywhere.)

Otherwise Higan compiles perfectly fine on M1. You do need to specify local=false to Make because otherwise the Makefile will try to apply -march=native and it won't work.

@sofakng
Copy link
Author

sofakng commented Jan 24, 2021

Thanks ... I've modified the GNUMakefile (inside byuu) to set local to false. It compiles several files but then errors:

Compiling higan/n64/interface/interface.cpp ...
In file included from ../higan/n64/interface/interface.cpp:1:
In file included from ../higan/n64/n64.hpp:7:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/nmmintrin.h:15:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/smmintrin.h:13:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/tmmintrin.h:13:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/pmmintrin.h:13:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/emmintrin.h:13:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/xmmintrin.h:13:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/mmintrin.h:33:5: error: 
      use of undeclared identifier '__builtin_ia32_emms'; did you mean
      '__builtin_isless'?
    __builtin_ia32_emms();
    ^

Here is the full log:
log.txt

@jchv
Copy link
Contributor

jchv commented Jan 24, 2021

Ah, sorry; I mean to say that the n64 and ps1 cores need to be manually removed. Set the cores variable to remove the ps1 and n64 cores. Just as a note, you do not need to edit the Makefile; you can specify these things as arguments to make, like:

make -j12 local=false cores="sfc gb gba ..."

(Good low hanging fruit would be automatically not including ps1 and n64 on platforms where the JIT isn't ported yet.)

@sofakng
Copy link
Author

sofakng commented Jan 24, 2021

Oh, I'm really sorry... I missed the part where you mentioned excluding the PSX and N64 cores.

I've excluded them and it compiles fine. I'll go ahead and close this issue. Thanks so much for the help!

@sofakng sofakng closed this as completed Jan 24, 2021
@sofakng sofakng reopened this Jan 24, 2021
@sofakng
Copy link
Author

sofakng commented Jan 24, 2021

Sorry - I've re-opened this issue. I see that you changed the title and it would be great to have ARM binaries (ie. Apple M1) to be built automatically. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants