Skip to content

Commit 08a130a

Browse files
zhangyuezhangyue
authored andcommitted
fix(build): gate ops --whole-archive link on WITH_ASCEND
`src/CMakeLists.txt:442` referenced `no_workspace_kernel` / `no_workspace_kernel_build` from inside `if(GENERATE_PYTHON_BINDINGS)` without checking `WITH_ASCEND`. Those targets are only created in the `WITH_ASCEND` block above (244-309), so non-Ascend `pip install -e .[dev]` failed at CMake configure with `No target "no_workspace_kernel"` and `dependency target "no_workspace_kernel_build" does not exist`. Mirror the gate: `if(WITH_ASCEND AND BUILD_ASCEND_CUSTOM)`. Verified non-Ascend (`-DWITH_ASCEND=OFF -DWITH_CPU=ON`) and Ascend (auto-detect) configure both pass.
1 parent f303e41 commit 08a130a

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,8 +438,12 @@ if(GENERATE_PYTHON_BINDINGS)
438438
# `aclrtlaunch_*` live in `ops.cc`, so link here with
439439
# `--whole-archive` to ensure all launch functions are available.
440440
# `$<TARGET_FILE>` works for both real `ascendc_library()` targets and
441-
# `IMPORTED` targets pointing at a pre-built `.a`.
442-
if(BUILD_ASCEND_CUSTOM)
441+
# `IMPORTED` targets pointing at a pre-built `.a`. The
442+
# `no_workspace_kernel` target is only created inside the
443+
# `WITH_ASCEND` block above, so this branch must mirror that gate;
444+
# otherwise non-Ascend builds error out with "No target
445+
# no_workspace_kernel".
446+
if(WITH_ASCEND AND BUILD_ASCEND_CUSTOM)
443447
target_link_libraries(ops PRIVATE
444448
-Wl,--whole-archive $<TARGET_FILE:no_workspace_kernel> -Wl,--no-whole-archive)
445449
# `ops` link step must wait for `build.sh` to produce the `.a`.

0 commit comments

Comments
 (0)