M1 Mac build espruino

Posted on
  • Hey everyone,

    I was trying to build and run espruino on my mac but struggling a little. I had to change 2 files to get the code to compile but now getting this error. Any pointers would be awesome!

    ld: unaligned pointer(s) for architecture arm64
    

    to get to this point i commented out line 891 from fixedpoint.h in lib/tensflow
    also jsnative.c i changed line 157 to

     # ifdef USE_64BIT //without the space 
    

    because of compiler errors i was seeing

  • So you are actually trying to run on Espruino on the Mac itself, rather than cross-compiling it for another target?

    I'd suggest commenting out the TENSORFLOW line in boards/LINUX.py for starters - just to make sure you're not building that in initially and causing yourself more trouble.

    I can't say I've ever actually built it for the M1 (or even to run under Mac OS - I deal mainly with Linux) but it doesn't generally have issues with running under 64 bit x86 (or ARM, obviously) so I wouldn't have thought there'd be big issues.

    ... you could maybe try and build for 32 bit ARM with -m32 as a command to the compiler - since obviously we know 32 bit ARM builds work fine.

  • Hi!

    I just tried on an M1 machine. After removing the TENSORFLOW from boards/LINUX.py and fixing the ifdef as mentioned above I get the following:

    $ make
    ...
    ld: warning: pointer not aligned at address 0x1000ADC12 (_jswSymbolTables + 34 from gen/jswrapper.o)
    ld: warning: pointer not aligned at address 0x1000ADC09 (_jswSymbolTables + 25 from gen/jswrapper.o)
    ld: warning: pointer not aligned at address 0x1000ADC01 (_jswSymbolTables + 17 from gen/jswrapper.o)
    ld: unaligned pointer(s) for architecture arm64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    

    I guess I'd need to 'add few bytes somewhere' to get the pointers aligned... ?

    Cheers!

  • Here is a pull-request that builds /MacBook Pro (13-inch, M1, 2020)/, the espruino --tests-all doesn't crash and this is the output:

    espruino:  355 of 359 tests passed
    espruino: FAILS:
    espruino: /Users/standa/Prg/espruino/Espruino/test­s/test_new_nested2_FAIL.js
    espruino: /Users/standa/Prg/espruino/Espruino/test­s/test_262_FAIL.js
    espruino: /Users/standa/Prg/espruino/Espruino/test­s/test_object_getOwnPropertyNames_FAIL.j­s
    espruino: /Users/standa/Prg/espruino/Espruino/test­s/test_number_constructor_FAIL.js
    espruino: ----------------------------------------­----------
    
  • Thanks! This is great news!

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

M1 Mac build espruino

Posted by Avatar for Chaz @Chaz

Actions