build2 / build2

build2 build system
MIT License
596 stars 16 forks source link

Assertion failed: `r_->mode_ != members_mode::always` #364

Open boris-kolpackov opened 9 months ago

boris-kolpackov commented 9 months ago
$ bdep test
error: no rule to update (for test) ..\..\..\sw-build2-cuda-toolkit-msvc\libnvrtc\libnvrtc\impl_target{cuda_nvrtc-windows-x86_64-11.6.124-archive}
  info: target ..\..\..\sw-build2-cuda-toolkit-msvc\libnvrtc\libnvrtc\impl_target{cuda_nvrtc-windows-x86_64-11.6.124-archive} is not declared in any buildfile
  info: re-run with --verbose=4 for more information
  info: while applying rule test to update (for test) ..\..\..\sw-build2-cuda-toolkit-msvc\libnvrtc\libnvrtc\libs{nvrtc}
  info: while applying rule bin.lib to update (for test) ..\..\..\sw-build2-cuda-toolkit-msvc\libnvrtc\libnvrtc\lib{nvrtc}
  info: while applying rule test to update (for test) ..\..\..\sw-build2-cuda-toolkit-msvc\libnvrtc\dir{libnvrtc\}
  info: while applying rule test to update (for test) ..\..\..\sw-build2-cuda-toolkit-msvc\dir{libnvrtc\}
info: failed to update (for test) ..\..\..\sw-build2-cuda-toolkit-msvc\dir{libnvrtc\}
$ bdep test
error: no rule to update (for test) ..\..\..\sw-build2-cuda-toolkit-msvc\libnvrtc\libnvrtc\impl_target{cuda_nvrtc-windows-x86_64-11.6.124-archive}
  info: target ..\..\..\sw-build2-cuda-toolkit-msvc\libnvrtc\libnvrtc\impl_target{cuda_nvrtc-windows-x86_64-11.6.124-archive} is not declared in any buildfile
  info: re-run with --verbose=4 for more information
  info: while applying rule test to update (for test) ..\..\..\sw-build2-cuda-toolkit-msvc\libnvrtc\libnvrtc\libs{nvrtc}
  info: while applying rule bin.lib to update (for test) ..\..\..\sw-build2-cuda-toolkit-msvc\libnvrtc\libnvrtc\lib{nvrtc}
  info: while applying rule test to update (for test) ..\..\..\sw-build2-cuda-toolkit-msvc\libnvrtc\dir{libnvrtc\}
  info: while applying rule test to update (for test) ..\..\..\sw-build2-cuda-toolkit-msvc\dir{libnvrtc\}
Assertion failed: r_->mode_ != members_mode::always, file C:\build2-build\build2-toolchain-0.17.0-a.0.20231214073339.6d7df2370760\build2\libbuild2/target.ixx, line 614
error: process b terminated abnormally: aborted

Feel like the assert is the consequence of the preceding error (which maybe causes the group member resolution to fail?)

helmesjo commented 9 months ago

Possibly related: #366

These two errors are both related to the (ab)use of depdb dyndep --dyn-target AFAIK.

helmesjo commented 5 months ago

@boris-kolpackov I managed to get this again and sniped a reproducer (macos).

$ bdep --version
bdep 0.17.0
libbpkg 0.17.0
libbutl 0.17.0

build2-assert.tar.gz

$ tar -xf build2-assert.tar.gz && cd cppfront/cppfront
$ b
warning: configured src_root ../../../cppfront/cppfront/ does not match forwarded ./
synchronizing /Users/fho/git/b2pkgs/cppfront-gcc/:
  update cppfront-tests/0.1.0-a.0.20240622165335
Assertion failed: (r_->mode_ != members_mode::always), function switch_mode, file target.ixx, line 614.
error: process bpkg terminated abnormally: aborted (SIGABRT)
../../../cppfront-gcc/build/bootstrap/pre-bdep-sync.build:10:9: error: process bdep exited with code 1
  info: command line: bdep sync --hook=1 --verbose 1 --config /Users/fho/git/b2pkgs/cppfront-gcc
boris-kolpackov commented 2 months ago

I cannot reproduce it using the commands you have provided because I don't have the build configuration (/Users/fho/git/b2pkgs/cppfront-gcc/). I've tried to re-initialize it:

$ tar -xf build2-assert.tar.gz
$ cd cppfront
$ rm -rf .bdep
$ bdep init -C @gcc cc
$ cd cppfront
$ b

But that builds fine.

helmesjo commented 2 months ago

@boris-kolpackov

Use these (you'll have to modify the dbs absolute paths). cd to libavutil/src & run bdep clean and you should see it. Note that the error stems from libavutil/src/buildfile: line 17 which has the wrong name for the target group (impl_target{avutil} instead of impl_target{avutil2}).

build2-FFmpeg-msvc.zip build2-FFmpeg.zip bdep-clean.txt (--verbose=6)

helmesjo commented 1 month ago

Another (minimal) reproducer: libhello.zip

Tested and fails both on Windows & Linux (WSL) during bdep init.

boris-kolpackov commented 1 month ago

Ok, I believe the configure case is fixed (the original report doesn't seem to be the same issue). With the latest reproducer I now get:

$ b configure
error: no rule to configure updating libhello/libhello/impl_target{conditional-asm-obja}
  info: target libhello/libhello/impl_target{conditional-asm-obja} is not declared in any buildfile
  info: re-run with --verbose=4 for more information
  info: while matching rule cxx.link to configure updating libhello/liba{hello}
  info: while applying rule bin.lib to configure updating libhello/lib{hello}
  info: while applying rule config.alias to configure updating dir{libhello/}
  info: while applying rule config.alias to configure updating dir{./}
error: no rule to configure updating libhello/libhello/impl_target{conditional-asm-objs}
  info: target libhello/libhello/impl_target{conditional-asm-objs} is not declared in any buildfile
  info: re-run with --verbose=4 for more information
  info: while matching rule cxx.link to configure updating libhello/libs{hello}
  info: while applying rule bin.lib to configure updating libhello/lib{hello}
  info: while applying rule config.alias to configure updating dir{libhello/}
  info: while applying rule config.alias to configure updating dir{./}

Which is consistent what we were getting with update:

$ b
error: group libhello/libhello/impl_target{conditional-src} has no static or dynamic members
  info: while applying rule <ad hoc buildscript recipe> to update libhello/libhello/impl_target{conditional-src}
  info: while matching rule cxx.link to update libhello/libs{hello}
  info: while applying rule bin.lib to update libhello/lib{hello}
  info: while applying rule build.alias to update dir{libhello/}
  info: while applying rule build.alias to update dir{./}
error: no rule to update libhello/libhello/impl_target{conditional-asm-obja}
  info: target libhello/libhello/impl_target{conditional-asm-obja} is not declared in any buildfile
  info: re-run with --verbose=4 for more information
  info: while matching rule cxx.link to update libhello/liba{hello}
  info: while applying rule bin.lib to update libhello/lib{hello}
  info: while applying rule build.alias to update dir{libhello/}
  info: while applying rule build.alias to update dir{./}
info: failed to update dir{./}