spiffe.io icon indicating copy to clipboard operation
spiffe.io copied to clipboard

Bug when trying to build docs on an M1 mac

Open ajessup opened this issue 2 years ago • 2 comments

When trying to build the docs on an M1 mac, with Docker provided by Docker Desktop, the following error arises when running make docker-serve.

Building sites … WARN 2022/07/29 14:33:55 Page.URL is deprecated and will be removed in a future release. Use .Permalink or .RelPermalink. If what you want is the front matter URL value, use .Params.url
Traceback (most recent call last):
  File "/home/appuser/.local/share/virtualenvs/app-4PlAip0Q/bin/watchmedo", line 8, in <module>
    sys.exit(main())
  File "/home/appuser/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.8/site-packages/watchdog/watchmedo.py", line 672, in main
    args.func(args)
  File "/home/appuser/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.8/site-packages/watchdog/watchmedo.py", line 526, in shell_command
    observe_with(observer, handler, args.directories, args.recursive)
  File "/home/appuser/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.8/site-packages/watchdog/watchmedo.py", line 180, in observe_with
    observer.start()
  File "/home/appuser/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.8/site-packages/watchdog/observers/api.py", line 262, in start
    emitter.start()
  File "/home/appuser/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.8/site-packages/watchdog/utils/__init__.py", line 93, in start
    self.on_thread_start()
  File "/home/appuser/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.8/site-packages/watchdog/observers/inotify.py", line 118, in on_thread_start
    self._inotify = InotifyBuffer(path, self.watch.is_recursive)
  File "/home/appuser/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.8/site-packages/watchdog/observers/inotify_buffer.py", line 35, in __init__
    self._inotify = Inotify(path, recursive)
  File "/home/appuser/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.8/site-packages/watchdog/observers/inotify_c.py", line 155, in __init__
    Inotify._raise_error()
  File "/home/appuser/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.8/site-packages/watchdog/observers/inotify_c.py", line 406, in _raise_error
    raise OSError(err, os.strerror(err))
OSError: [Errno 38] Function not implemented
make: *** [docker-serve] Error 1

The likely reason for this is that Docker Desktop on M1 macs uses QMEU to emulate, which is incompatible with inotify. Similar issues have been reported with the watchdog library elsewhere, for example:

  • https://github.com/gorakhargosh/watchdog/issues/838
  • https://stephanmeijer.com/Redash-M1-Mac/
  • https://github.com/docker/for-mac/issues/5321

Unfortunately a cursory examination suggests this might not be a simple fix (I tried updating to watchdog 2.1.9 but that didn't solve anything). It's likely that either we'll need to ask M1 users to use a different emulation layer, build from an ARM base image, or just swap out watchdog for something that's not inotify based.

ajessup avatar Jul 29 '22 14:07 ajessup

cc @mchurichi would love to hear any thoughts you have here

ajessup avatar Jul 29 '22 14:07 ajessup

Thanks for opening this, @ajessup. Looks to me that the simplest fix would be to avoid the use of any inotify-based utility. I'll do some research on alternatives.

mchurichi avatar Aug 01 '22 12:08 mchurichi