NVIDIA / nvidia-settings

NVIDIA driver control panel
http://www.nvidia.com/object/unix.html
GNU General Public License v2.0
297 stars 77 forks source link

_out/Linux_x86_64/antialias.png.h: No such file or directory #59

Open fabianhjr opened 3 years ago

fabianhjr commented 3 years ago

Upon attempting to package the latest release for NixOS there is this issue:

/bin/bash: _out/Linux_x86_64/antialias.png.h: No such file or directory
make[1]: *** [Makefile:320: _out/Linux_x86_64/antialias.png.h] Error 1

From this line: https://github.com/NVIDIA/nvidia-settings/blob/cbb7bd5325f7ae91281e291b80dec4e29b66b3cb/src/gtk%2B-2.x/ctkbanner.c#L37

aaronp24 commented 3 years ago

I can't seem to reproduce this problem, although I'm not using NixOS. Can you please attach a complete build log from make NV_VERBOSE=1?

These PNG file headers are supposed to be generated by this snippet in the Makefile:

define BINARY_DATA_HEADER_RULE
  $$(OUTPUTDIR)/$(notdir $(1)).h:
    $(at_if_quiet){ \
      $$(PRINTF) "extern const char _binary_$(subst .,_,$(notdir $(1)))_start[];\n"; \
      $$(PRINTF) "extern const char _binary_$(subst .,_,$(notdir $(1)))_end[];\n"; \
    } > $$@
endef

# Build $(IMAGE_HEADERS)
$(foreach png,$(IMAGE_FILES), \
  $(eval $(call BINARY_DATA_HEADER_RULE,$(png))))
fabianhjr commented 3 years ago

Sorry, you are right it was an issue on my end unu

Thanks for the help

manveru commented 3 years ago

Sorry to resurrect a closed issue, but this happened to me today as well. The issue was that running the build parallelized seems to cause this issue (on 32 cores at least). I encountered this on NixOS, so in case someone else is looking for a fix, add this to your overlay:

  nvidiaPackages.stable.settings = prev.nvidiaPackages.stable.settings.overrideAttrs (old: { enableParallelBuilding = false; });
rmorell commented 3 years ago

You're right, I reproduced this. The fix is to modify the code aaronp24 quoted like this:

define BINARY_DATA_HEADER_RULE
  $$(OUTPUTDIR)/$(notdir $(1)).h:
+   $(at_if_quiet)$(MKDIR) $$(OUTPUTDIR)
    $(at_if_quiet){ \
      $$(PRINTF) "extern const char _binary_$(subst .,_,$(notdir $(1)))_start[];\n"; \
      $$(PRINTF) "extern const char _binary_$(subst .,_,$(notdir $(1)))_end[];\n"; \
    } > $$@
endef

# Build $(IMAGE_HEADERS)
$(foreach png,$(IMAGE_FILES), \
  $(eval $(call BINARY_DATA_HEADER_RULE,$(png))))
aaronp24 commented 3 years ago

Thanks for tracking this down, Robert! Reopening.

danfe commented 3 years ago

The fix is correct in principal, but canonical way to depend on a directory in this case is via GNU make's order-only-prerequisite: $$(OUTPUTDIR)/$(notdir $(1)).h: | $$(OUTPUTDIR) I think, which DTRT in a declarative way, without manually calling $(MKDIR).

P.S. Of course, as long as there is a target for creating the $$(OUTPUTDIR) somewhere to be seen.