Skip to content

Can't pass packagedeps for clang toolchain package #6887

@star-hengxing

Description

@star-hengxing

Xmake Version

dev

Operating System Version and Architecture

windows

Describe Bug

https://github.com/std-microblock/breeze-shell/actions/runs/18226897391/job/51900357988

[1/21] C:\Users\star\scoop\apps\llvm\current\bin\clang.exe -DZYDIS_SHOULD_EXPORT -D_CRT_SECURE_NO_WARNINGS -IC:/Users/star/AppData/Local/.xmake/cache/packages/2510/z/zydis/v4.1.1/source/include -IC:/Users/star/AppData/Local/.xmake/cache/packages/2510/z/zydis/v4.1.1/source/build_f563c443 -IC:/Users/star/AppData/Local/.xmake/cache/packages/2510/z/zydis/v4.1.1/source/src -m64 --target=x86_64-windows-msvc -O0 -g -Xclang -gcodeview -fms-runtime-lib=dll -std=gnu11 -D_DLL -D_MT -Xclang --dependent-lib=msvcrt -MD -MT CMakeFiles/Zydis.dir/src/String.c.obj -MF CMakeFiles\Zydis.dir\src\String.c.obj.d -o CMakeFiles/Zydis.dir/src/String.c.obj -c C:/Users/star/AppData/Local/.xmake/cache/packages/2510/z/zydis/v4.1.1/source/src/String.c
FAILED: [code=1] CMakeFiles/Zydis.dir/src/String.c.obj
C:\Users\star\scoop\apps\llvm\current\bin\clang.exe -DZYDIS_SHOULD_EXPORT -D_CRT_SECURE_NO_WARNINGS -IC:/Users/star/AppData/Local/.xmake/cache/packages/2510/z/zydis/v4.1.1/source/include -IC:/Users/star/AppData/Local/.xmake/cache/packages/2510/z/zydis/v4.1.1/source/build_f563c443 -IC:/Users/star/AppData/Local/.xmake/cache/packages/2510/z/zydis/v4.1.1/source/src -m64 --target=x86_64-windows-msvc -O0 -g -Xclang -gcodeview -fms-runtime-lib=dll -std=gnu11 -D_DLL -D_MT -Xclang --dependent-lib=msvcrt -MD -MT CMakeFiles/Zydis.dir/src/String.c.obj -MF CMakeFiles\Zydis.dir\src\String.c.obj.d -o CMakeFiles/Zydis.dir/src/String.c.obj -c C:/Users/star/AppData/Local/.xmake/cache/packages/2510/z/zydis/v4.1.1/source/src/String.c
In file included from C:/Users/star/AppData/Local/.xmake/cache/packages/2510/z/zydis/v4.1.1/source/src/String.c:27:
C:/Users/star/AppData/Local/.xmake/cache/packages/2510/z/zydis/v4.1.1/source/include\Zydis/Internal/String.h:43:10: fatal error: 'Zycore/LibC.h' file not found
   43 | #include <Zycore/LibC.h>
      |          ^~~~~~~~~~~~~~~
1 error generated.

platform_envs.CMAKE_C_FLAGS = _get_cflags(package, {cross = true})
end
if package:has_tool("cxx", "clang", "clang_cl") then
platform_envs.CMAKE_CXX_FLAGS = _get_cxxflags(package, {cross = true})
end

diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
index 9c357772a..927f3daf8 100644
--- a/xmake/modules/package/tools/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -873,10 +873,10 @@ function _get_envs_for_flags(package, configs, opt)
         -- use clang-cl or clang, and we need pass --target=xxx flags
         if package:has_tool("cc", "clang", "clang_cl") then
             -- @see https://github.com/xmake-io/xmake-repo/issues/7662
-            platform_envs.CMAKE_C_FLAGS = _get_cflags(package, {cross = true})
+            platform_envs.CMAKE_C_FLAGS = _get_cflags(package, {cross = true, packagedeps = opt.packagedeps})
         end
         if package:has_tool("cxx", "clang", "clang_cl") then
-            platform_envs.CMAKE_CXX_FLAGS = _get_cxxflags(package, {cross = true})
+            platform_envs.CMAKE_CXX_FLAGS = _get_cxxflags(package, {cross = true, packagedeps = opt.packagedeps})
         end
     elseif package:is_plat("wasm") then
         -- pass toolchain flags cross-compilation

Expected Behavior

N/A

Project Configuration

N/A

Additional Information and Error Logs

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions