Mongoose dev on Apple M1 tech

If you are asking a question, please follow this template:

  1. My goal is: [describe your goal] to develop my code on one of the new Apple MacBook airs with M1 processor
  2. My actions are: [describe your actions - code, commands, etc]
  3. The result I see is: [show the result - log, etc]
  4. My expectation & question is: [describe your expectation and your question]

To find out if this is possible and what installation processes to use

Thank you

Did you try to follow the steps described here?

@Colin_Ives did you get this resolved?

I’m having issues building on a new 14" macbook pro with the M1 pro silicone.
Was installed using the brew method on the page @nliviu linked

Generating esp32.project.ld
/opt/Espressif/xtensa-esp32-elf/bin/xtensa-esp32-elf-objdump: mgos_captive_portal.c.o: file format not recognized
/opt/Espressif/xtensa-esp32-elf/bin/xtensa-esp32-elf-objdump: mgos_shadow.c.o: invalid operation
/opt/Espressif/xtensa-esp32-elf/bin/xtensa-esp32-elf-objdump: mg_rpc.c.o: invalid operation
/opt/Espressif/xtensa-esp32-elf/bin/xtensa-esp32-elf-objdump: mg_rpc_channel.c.o: invalid operation
/opt/Espressif/xtensa-esp32-elf/bin/xtensa-esp32-elf-objdump: mg_rpc_channel_http.c.o: invalid operation
/opt/Espressif/xtensa-esp32-elf/bin/xtensa-esp32-elf-objdump: mgos_rpc.c.o: invalid operation
Traceback (most recent call last):
  File "/opt/Espressif/esp-idf/tools/ldgen/ldgen.py", line 158, in <module>
    main()
  File "/opt/Espressif/esp-idf/tools/ldgen/ldgen.py", line 114, in main
    dump = StringIO(subprocess.check_output([objdump, "-h", library]).decode())
  File "/usr/lib/python2.7/subprocess.py", line 223, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['xtensa-esp32-elf-objdump', '-h', '/Users/andrew/code/mongoose/build/objs/mosapp/libmosapp.a']' returned non-zero exit status 1
make: *** [/Users/andrew/code/mongoose/build/objs/esp32/esp32.project.ld] Error 1
/opt/Espressif/esp-idf/components/esp32/Makefile.projbuild:32: recipe for target '/Users/andrew/code/mongoose/build/objs/esp32/esp32.project.ld' failed
make: Leaving directory '/app'
Error: exit status 2
/private/tmp/mos-20211202-11143-1q51ff/mos-9bf406d90c65fca0b377220940735015dcfbb76c/cli/build_local.go:697: 
/private/tmp/mos-20211202-11143-1q51ff/mos-9bf406d90c65fca0b377220940735015dcfbb76c/cli/build_local.go:684: 
/private/tmp/mos-20211202-11143-1q51ff/mos-9bf406d90c65fca0b377220940735015dcfbb76c/cli/build_local.go:449: 
/private/tmp/mos-20211202-11143-1q51ff/mos-9bf406d90c65fca0b377220940735015dcfbb76c/cli/build.go:270: 
/private/tmp/mos-20211202-11143-1q51ff/mos-9bf406d90c65fca0b377220940735015dcfbb76c/cli/build.go:213: 
/private/tmp/mos-20211202-11143-1q51ff/mos-9bf406d90c65fca0b377220940735015dcfbb76c/cli/main.go:198: build failed

Definitely not a code issue as it’s running as expected in my CI pipeline.

I’ve recently got a MacMini M1 and did the following:

softwareupdate --install-rosetta
arch -x86_64 zsh
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
/usr/local/bin/brew install libftdi
exit
curl -fsSL https://mongoose-os.com/downloads/mos/install.sh | NO_BREW=1 /bin/bash

I think the first step may be skipped if rosetta is already installed.

Thanks @nliviu I’ve managed to cobble together something based on your steps and I’ve now got the build working.
I had some screwed up permissions that I had to fix before I could get libftdi and libusb installed and linked, but this post helped me out.

For reference, looks like what you’re doing is installing homebrew as x86, which based on this
post
tells me it can coexist with the normal brew installation, but just needs to be referenced at /usr/local/bin/brew and it installs the x86 version of mos at /Users/<username>/.mos/bin/mos

I first installed brew with arm64 architecture (which installs in /opt) and mos as described above, but mos was looking for libftdi in /usr/local/bin which obviously did not exist.

That’s why I installed the x86 version of brew. I didn’t have any permission issues.