Compiling for arm64 (M1 Mac) natively

  • minecraft-physics
    21st Apr 2022 Member 0 Permalink
    Following the instructions on the wiki, I hit the snag that the Homebrew `luajit` module does not support the arm64 architecture. I'd like to edit the wiki to reflect that you need to either switch the 'lua' build option to lua5.1, or compile the whole thing with x86 and run it under Rosetta. I've successfully built from source now ( a marked improvement from the first time I tried this 9 years ago (!)),

    Is this the right approach, or is there another workaround for arm64?

    Edited 2 times by minecraft-physics. Last: 21st Apr 2022
  • jacob1
    21st Apr 2022 Developer 0 Permalink
    Our official** M1 builds have luajit included already, so it is possible. Maybe something in your dev environment is broken, can you post the exact error message you got trying to install luajit?

    You can also try using our prebuilt static libraries, see the "static" section on the compile guide.


    **not yet official, and won't be for a while, as releasing M1 builds requires joining the Apple development program, and I don't feel like spending that much a year just to release an M1 build
  • LBPHacker
    21st Apr 2022 Developer 0 Permalink
    I'm going to quote the editor note at the top of the page you edited before any of us replied to this thread:

    EDITOR NOTE: Please do not edit this guide without consulting with TPT developers first; you risk your changes being mercilessly rolled back without prior notice otherwise.

    Please contact us on this website or in #powder-dev@irc.libera.chat and tell us what you did and how well it worked. We'll update the wiki based on this.

    Edit: It's my fault for not marking the page protected, sorry about that, did it now. I've added a note that luajit is not required and what you should do if you can't or don't want to use it. If you have anything further to add, see above.
    Edited once by LBPHacker. Last: 21st Apr 2022
  • minecraft-physics
    21st Apr 2022 Member 0 Permalink
    I was being lazy, and took the message when running
    brew install --build-from-source luajit

    3 errors generated.
    lj_arch.h:55:2: error: "No support for this architecture (yet)"
    #error "No support for this architecture (yet)"

    at face value, making little further attempt to fix it.
    Edited once by minecraft-physics. Last: 21st Apr 2022
  • LBPHacker
    21st Apr 2022 Developer 0 Permalink
    That's weird because we prebuild luajit for arm64 macs >_>
  • minecraft-physics
    21st Apr 2022 Member 0 Permalink
    Using Rosetta, or natively? It's still be possible to compile it from source as an x86 binary.

    PS this module is about to be depreceated - https://github.com/Homebrew/homebrew-core/pull/99580
  • jacob1
    21st Apr 2022 Developer 1 Permalink
    @minecraft-physics (View Post)
    It looks like luajit 2.0.5 doesn't support arm64, but luajit 2.1-beta3 does. You can tell homebrew to use the latest source instead with --HEAD

    brew install --HEAD luajit

    You could also try using the forked version of luajit you found

    brew install luajit-openresty
  • minecraft-physics
    22nd Apr 2022 Member 0 Permalink
    ... and that fixes it. (specifically brew install --HEAD luajit)

    Thanks! (Sorry for ignoring the warning on the wiki)
    Edited 2 times by minecraft-physics. Last: 22nd Apr 2022
  • asdasd1234
    23rd Jul 2022 Banned 0 Permalink
    This post is hidden because the user is banned
    Edited once by jacob1. Last: 23rd Jul 2022
Locked by jacob1: spambot necro