like-dbg icon indicating copy to clipboard operation
like-dbg copied to clipboard

macOS case-insensitive filesystem breaks build

Open 0xricksanchez opened this issue 2 years ago • 2 comments

Despite having the whole process containerised the Linux kernel build process fails on macOS APFS systems due to the disks being case-insensitive:

make[1]: *** Documentation/Kbuild: Is a directory.  Stop.
make: *** [Makefile:1850: _clean_Documentation] Error 2
Traceback (most recent call last):
  File "/Users/ck/Tools/Research/like-dbg/./start_kgdb.py", line 536, in <module>
    main()
  File "/Users/ck/Tools/Research/like-dbg/./start_kgdb.py", line 517, in main
    KernelBuilder().run()
  File "/Users/ck/Tools/Research/like-dbg/./start_kgdb.py", line 404, in run
    super().run()
  File "/Users/ck/Tools/Research/like-dbg/./start_kgdb.py", line 302, in run
    self.run_container()
  File "/Users/ck/Tools/Research/like-dbg/./start_kgdb.py", line 390, in run_container
    self._build_mrproper()
  File "/Users/ck/Tools/Research/like-dbg/./start_kgdb.py", line 344, in _build_mrproper
    self._run_ssh(f"{self.cc} ARCH={self.arch} make mrproper")
  File "/Users/ck/Tools/Research/like-dbg/./start_kgdb.py", line 332, in _run_ssh
    return self.ssh_conn.run(f"cd {self.docker_mnt}/{self.kernel_root} && {cmd}").exited
  File "<decorator-gen-3>", line 2, in run
  File "/usr/local/lib/python3.9/site-packages/fabric/connection.py", line 30, in opens
    return method(self, *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/fabric/connection.py", line 725, in run
    return self._run(self._remote_runner(), command, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/invoke/context.py", line 102, in _run
    return runner.run(command, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/fabric/runners.py", line 72, in run
    return super(Remote, self).run(command, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/invoke/runners.py", line 380, in run
    return self._run_body(command, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/invoke/runners.py", line 442, in _run_body
    return self.make_promise() if self._asynchronous else self._finish()
  File "/usr/local/lib/python3.9/site-packages/invoke/runners.py", line 509, in _finish
    raise UnexpectedExit(result)
invoke.exceptions.UnexpectedExit: Encountered a bad command exit code!

Command: 'cd /io/kernel_root && CC=gcc ARCH=arm64 make mrproper'

0xricksanchez avatar Jun 30 '22 19:06 0xricksanchez

I think you're having the same issue as when trying to build AOSP on MacOS, there are a few guides, but the gist of it is creating a case-sensitive disk image, mounting it and doing what you need in it:

  • The guide that pointed me in the right direction: https://michael137.github.io/2020-04-16-android-kernel/
  • A script with a command line to create the disk image you'll need (not tested myself, but could help) https://gist.github.com/MartinMReed/b5e8a56651fd25569ff3#file-aosp-sh-L282

I don't think I've seen any other workarounds for that issue. Hope it helps

thelumberjhack avatar Aug 04 '22 22:08 thelumberjhack

Sounds about right. I figured the two most straightforward options would be either

  • Mounting an external disk (like you said), or
  • When setting up a mac with APSF directly make it a case-sensitive one by ticking that box...

Either option is something I don't see myself fixing in here, so I added the low priority tag for now. If anyone has a sweet hack to make it work regardless PR's are always welcome :)

0xricksanchez avatar Aug 07 '22 13:08 0xricksanchez