Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make never stops making #1

Open
moonheart08 opened this issue Apr 29, 2020 · 5 comments
Open

Make never stops making #1

moonheart08 opened this issue Apr 29, 2020 · 5 comments

Comments

@moonheart08
Copy link

...
rgbasm -p 0xFE -isrc/ -isrc/include/ -Wall -Wextra -h -M dep/vectors.mk -MG -MP -MQ obj/vectors.o -MQ dep/vectors.mk -o obj/vectors.o src/vectors.asm
rgbasm -p 0xFE -isrc/ -isrc/include/ -Wall -Wextra -h -M dep/sgb.mk -MG -MP -MQ obj/sgb.o -MQ dep/sgb.mk -o obj/sgb.o src/sgb.asm
rgbasm -p 0xFE -isrc/ -isrc/include/ -Wall -Wextra -h -M dep/misc.mk -MG -MP -MQ obj/misc.o -MQ dep/misc.mk -o obj/misc.o src/misc.asm
rgbasm -p 0xFE -isrc/ -isrc/include/ -Wall -Wextra -h -M dep/header.mk -MG -MP -MQ obj/header.o -MQ dep/header.mk -o obj/header.o src/header.asm
rgbasm -p 0xFE -isrc/ -isrc/include/ -Wall -Wextra -h -M dep/crash_handler.mk -MG -MP -MQ obj/crash_handler.o -MQ dep/crash_handler.mk -o obj/crash_handler.o src/crash_handler.asm
rgbasm -p 0xFE -isrc/ -isrc/include/ -Wall -Wextra -h -M dep/vectors.mk -MG -MP -MQ obj/vectors.o -MQ dep/vectors.mk -o obj/vectors.o src/vectors.asm
rgbasm -p 0xFE -isrc/ -isrc/include/ -Wall -Wextra -h -M dep/sgb.mk -MG -MP -MQ obj/sgb.o -MQ dep/sgb.mk -o obj/sgb.o src/sgb.asm
rgbasm -p 0xFE -isrc/ -isrc/include/ -Wall -Wextra -h -M dep/misc.mk -MG -MP -MQ obj/misc.o -MQ dep/misc.mk -o obj/misc.o src/misc.asm
rgbasm -p 0xFE -isrc/ -isrc/include/ -Wall -Wextra -h -M dep/header.mk -MG -MP -MQ obj/header.o -MQ dep/header.mk -o obj/header.o src/header.asm
rgbasm -p 0xFE -isrc/ -isrc/include/ -Wall -Wextra -h -M dep/crash_handler.mk -MG -MP -MQ obj/crash_handler.o -MQ dep/crash_handler.mk -o obj/crash_handler.o src/crash_handler.asm
rgbasm -p 0xFE -isrc/ -isrc/include/ -Wall -Wextra -h -M dep/vectors.mk -MG -MP -MQ obj/vectors.o -MQ dep/vectors.mk -o obj/vectors.o src/vectors.asm
rgbasm -p 0xFE -isrc/ -isrc/include/ -Wall -Wextra -h -M dep/sgb.mk -MG -MP -MQ obj/sgb.o -MQ dep/sgb.mk -o obj/sgb.o src/sgb.asm
rgbasm -p 0xFE -isrc/ -isrc/include/ -Wall -Wextra -h -M dep/misc.mk -MG -MP -MQ obj/misc.o -MQ dep/misc.mk -o obj/misc.o src/misc.asm
rgbasm -p 0xFE -isrc/ -isrc/include/ -Wall -Wextra -h -M dep/header.mk -MG -MP -MQ obj/header.o -MQ dep/header.mk -o obj/header.o src/header.asm
rgbasm -p 0xFE -isrc/ -isrc/include/ -Wall -Wextra -h -M dep/crash_handler.mk -MG -MP -MQ obj/crash_handler.o -MQ dep/crash_handler.mk -o obj/crash_handler.o src/crash_handler.asm
rgbasm -p 0xFE -isrc/ -isrc/include/ -Wall -Wextra -h -M dep/vectors.mk -MG -MP -MQ obj/vectors.o -MQ dep/vectors.mk -o obj/vectors.o src/vectors.asm
rgbasm -p 0xFE -isrc/ -isrc/include/ -Wall -Wextra -h -M dep/sgb.mk -MG -MP -MQ obj/sgb.o -MQ dep/sgb.mk -o obj/sgb.o src/sgb.asm
rgbasm -p 0xFE -isrc/ -isrc/include/ -Wall -Wextra -h -M dep/misc.mk -MG -MP -MQ obj/misc.o -MQ dep/misc.mk -o obj/misc.o src/misc.asm
rgbasm -p 0xFE -isrc/ -isrc/include/ -Wall -Wextra -h -M dep/header.mk -MG -MP -MQ obj/header.o -MQ dep/header.mk -o obj/header.o src/header.asm
rgbasm -p 0xFE -isrc/ -isrc/include/ -Wall -Wextra -h -M dep/crash_handler.mk -MG -MP -MQ obj/crash_handler.o -MQ dep/crash_handler.mk -o obj/crash_handler.o src/crash_handler.asm
rgbasm -p 0xFE -isrc/ -isrc/include/ -Wall -Wextra -h -M dep/vectors.mk -MG -MP -MQ obj/vectors.o -MQ dep/vectors.mk -o obj/vectors.o src/vectors.asm
rgbasm -p 0xFE -isrc/ -isrc/include/ -Wall -Wextra -h -M dep/sgb.mk -MG -MP -MQ obj/sgb.o -MQ dep/sgb.mk -o obj/sgb.o src/sgb.asm
rgbasm -p 0xFE -isrc/ -isrc/include/ -Wall -Wextra -h -M dep/misc.mk -MG -MP -MQ obj/misc.o -MQ dep/misc.mk -o obj/misc.o src/misc.asm
rgbasm -p 0xFE -isrc/ -isrc/include/ -Wall -Wextra -h -M dep/header.mk -MG -MP -MQ obj/header.o -MQ dep/header.mk -o obj/header.o src/header.asm
^Cmake: *** Deleting file 'dep/header.mk'

I imagine it's suppost to stop at some point? ^^

@ISSOtm
Copy link
Owner

ISSOtm commented Apr 29, 2020

This happens when some file needs to be made (INCLUDEed or INCBINed file), but Make doesn't know how to.

Here's what happens:

  1. Make invokes RGBASM to generate dependency lists
  2. RGBASM tries to INCLUDE or INCBIN file X, which doesn't exist, so it stops there (but outputs it as a dependency)
  3. Make sees the dependency lists have been updated, and restarts from the beginning
  4. Make sees the missing file, but doesn't know how to make it
  5. GOTO 1

@ISSOtm ISSOtm pinned this issue Apr 29, 2020
@ISSOtm
Copy link
Owner

ISSOtm commented Apr 29, 2020

(Pinning this because it's a common problem, so others are likely to encounter it)

@ISSOtm ISSOtm closed this as completed in 9d6c135 Mar 14, 2021
@ISSOtm
Copy link
Owner

ISSOtm commented Aug 26, 2023

The problem hasn't gone away, actually, but Make 4.4 introduced a warning that may explain it.

I believe I have a fix, but I'd like someone affected by this problem to help test it. Any volunteers?

@ISSOtm ISSOtm reopened this Aug 26, 2023
@ISSOtm
Copy link
Owner

ISSOtm commented Nov 5, 2023

gb-starter-kit incorrectly specified its dependencies, which could cause build failures like the above on all OSes. This was fixed in 8d6deab.

Unfortunately, investigation reveals a new, OS-dependent build issue with due to insufficient timestamp resolution.

This only occurs on Windows for all current1 versions of Make, and on macOS with the default Make 3.81 (I have tested, and using Homebrew's Make 4.4.1 does not present the issue).

Workaround

Disable parallel building on Windows and Make prior to 4.0.
This should slow down the build enough to not trigger this issue.

That didn't work.

Technical details

This issue causes output like:

CreateProcess(C:\Program Files\Git\usr\bin\stat.exe,stat -c "%Y %y" assets/crash_font.1bpp.pb8.size,...)
Live child 0000000002382550 (assets/crash_font.1bpp.pb8.size) PID 37241680 
1699191197 2023-11-05 13:33:17.332802800 +0000
Reaping winning child 0000000002382550 PID 37241680 
stat -c '%Y %y' obj/crash_handler.mk
CreateProcess(C:\Program Files\Git\usr\bin\stat.exe,stat -c "%Y %y" obj/crash_handler.mk,...)
Live child 0000000002382550 (assets/crash_font.1bpp.pb8.size) PID 37241680 
1699191197 2023-11-05 13:33:17.222649000 +0000

  Prerequisite 'assets/crash_font.1bpp.pb8.size' is older than target 'obj/crash_handler.mk'.

Notice that the mtime is higher for the .size file than the .mk, but Make still considers the former to be older than the latter. This appears to be because Make only considers timestamps up to the second (FILE_TIMESTAMP_HI_RES in its source code), at least on Windows, and ties are resolved as "prerequisite is older".

Footnotes

  1. I will be asking the Make maintainers about enabling high-resolution timestamps on Windows, so maybe a future version of Make will fix this.

@ISSOtm
Copy link
Owner

ISSOtm commented Nov 5, 2023

A tentative patch that disabled parallelism on Windows and Make 3.81 did not resolve the issue, it only made it slightly less common. There is a fix for macOS—use a more recent Make—but nothing for Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants