Skip to content
Snippets Groups Projects

Makefile: add missing dependency of 'opencl.o' on 'oclobj.h'

Merged Sergei Trofimovich requested to merge trofi/x264:fix-build-parallelism into master
All threads resolved!

Without the change parallel build occasionally fails as:

$ make --shuffle
...
gcc ... -c common/opencl.c -o common/opencl-8.o ...
common/opencl.c:116:10: fatal error: common/oclobj.h: No such file or directory
  116 | #include "common/oclobj.h"
      |          ^~~~~~~~~~~~~~~~~

Best reproducible with make --shuffle mode: https://savannah.gnu.org/bugs/index.php?62100

This happens because "common/oclobj.h" is an autogenerated file, but Makefile does not specify dependency of common/opencl-8.o in direct or indirect form.

The change moves dependency on $(GENERATED) from final binaries to intermediate object binaries:

$(OBJS): $(GENERATED)

Except that the actual change adds $(GENERATED) for any buildable objects to be a bit more future proof.

Merge request reports

Pipeline #264298 passed

Pipeline passed for e067ab0b on trofi:fix-build-parallelism

Merged by Anton MitrofanovAnton Mitrofanov 2 years ago (Sep 20, 2022 7:25pm UTC)

Loading

Pipeline #264637 passed

Pipeline passed for e067ab0b on master

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Hi. Not like I am against it but I don't understand why you say that this dependency is not specified? As far as I can see in .depend file there is common/oclobj.h:

    common/opencl-8.o: common/opencl.c common/common.h common/base.h \
     common/osdep.h config.h x264.h x264_config.h common/win32thread.h \
     common/cpu.h common/tables.h common/cabac.h common/bitstream.h \
     common/set.h common/predict.h common/pixel.h common/mc.h common/frame.h \
     common/dct.h common/quant.h common/threadpool.h common/macroblock.h \
     common/x86/util.h common/rectangle.h common/oclobj.h
  • Also if I remember and understand correctly it is used before .depend target because we want to generate possible decencies of generated files also (i.e. call .depend target when all generated files already exist). So may be it would make more sense to add it as dependency for .depend (if we need to change anything).

  • Author Contributor

    Another, probably easier to debug, reproducer:

    $ ./configure
    ...
    $ make common/opencl-8.o
    dependency file generation...
    ./common/opencl.c:116:10: fatal error: common/oclobj.h: No such file or directory
      116 | #include "common/oclobj.h"
          |          ^~~~~~~~~~~~~~~~~
    compilation terminated.
    gcc -Wno-maybe-uninitialized -Wshadow -O3 -ffast-math -m64  -Wall -I. -I. -std=gnu99 -D_GNU_SOURCE -mpreferred-stack-boundary=6 -fPIC -fomit-frame-pointer -fno-tree-vectorize -fvisibility=hidden  -DX264_API_EXPORTS -c common/opencl.c -o common/opencl-8.o -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8
    common/opencl.c:116:10: fatal error: common/oclobj.h: No such file or directory
      116 | #include "common/oclobj.h"
          |          ^~~~~~~~~~~~~~~~~
    compilation terminated.
    make: *** [Makefile:284: common/opencl-8.o] Error 1
    
    $ dev>echo $?
    2
  • added 1 commit

    • 3909b07e - Makefile: add missing dependency of '.depend' on 'oclobj.h'

    Compare with previous version

  • added 1 commit

    • e067ab0b - Makefile: Add missing dependency of '.depend' on 'oclobj.h'

    Compare with previous version

  • Author Contributor

    Merged with existing .depend: config.mak depend. Capitalised the Add.

  • Sergei Trofimovich resolved all threads

    resolved all threads

  • Anton Mitrofanov approved this merge request

    approved this merge request

Please register or sign in to reply
Loading