xmake-io / xmake

🔥 A cross-platform build utility based on Lua
https://xmake.io
Apache License 2.0
10.04k stars 786 forks source link

bin2c构建优先级错误 #4801

Open hackermdch opened 7 months ago

hackermdch commented 7 months ago

Xmake 版本

v2.8.8+master.b3b3bf69d

操作系统版本和架构

Windows 11 21H2

描述问题

使用utils.bin2c生成头文件时,模块单元会在bin2c头文件生成之前编译,这导致如果在模块单元中#include了bin2c头文件,将会报找不到文件错误。

期待的结果

bin2c应优先生成头文件。

工程配置

simple.zip

附加信息和错误日志

[  0%]: <test> generating.module.deps main.cpp
F:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\HostX64\x64\cl.exe -nologo -std:c++latest -Ibuild\.gens\test\windows\x64\release\rules\utils\bin2c /EHsc -TP -scanDependencies build\.gens\test\windows\x64\release\rules\bmi\cache\modules\574a3743\main.cpp.module.json main.cpp -ifcOutput build\.gens\test\windows\x64\release\rules\bmi\cache\modules\574a3743 -Fobuild\.objs\test\windows\x64\release\main.cpp.obj
[  0%]: <test> generating.module.deps md.cppm
F:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\HostX64\x64\cl.exe -nologo -std:c++latest -Ibuild\.gens\test\windows\x64\release\rules\utils\bin2c /EHsc -TP -scanDependencies build\.gens\test\windows\x64\release\rules\bmi\cache\modules\574a3743\md.cppm.module.json md.cppm -ifcOutput build\.gens\test\windows\x64\release\rules\bmi\cache\modules\574a3743 -Fobuild\.objs\test\windows\x64\release\md.cppm.obj
[  0%]: <test> generating.module.deps F:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\modules\std.ixx
F:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\HostX64\x64\cl.exe -nologo -std:c++latest -Ibuild\.gens\test\windows\x64\release\rules\utils\bin2c /EHsc -TP -scanDependencies build\.gens\test\windows\x64\release\rules\bmi\cache\modules\c3448101\std.ixx.module.json "F:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.39.33519\\modules\\std.ixx" -ifcOutput build\.gens\test\windows\x64\release\rules\bmi\cache\modules\c3448101 -Fobuild\.objs\test\windows\x64\release\72f3977fa5814c16a209bf424af9f80f\std.ixx.obj
main.cpp
[  0%]: <test> generating.module.deps F:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\modules\std.compat.ixx
F:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\HostX64\x64\cl.exe -nologo -std:c++latest -Ibuild\.gens\test\windows\x64\release\rules\utils\bin2c /EHsc -TP -scanDependencies build\.gens\test\windows\x64\release\rules\bmi\cache\modules\c3448101\std.compat.ixx.module.json "F:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.39.33519\\modules\\std.compat.ixx" -ifcOutput build\.gens\test\windows\x64\release\rules\bmi\cache\modules\c3448101 -Fobuild\.objs\test\windows\x64\release\72f3977fa5814c16a209bf424af9f80f\std.compat.ixx.obj
md.cppm
std.ixx
md.cppm(6): fatal error C1083: 无法打开包括文件: “text.txt.h”: No such file or directorystd.compat.ixx

error: @programdir\core\main.lua:306: @programdir\actions\build\main.lua:148: @programdir\modules\async\runjobs.lua:320: @programdir\core\sandbox\modules\os.lua:378: execv(F:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\HostX64\x64\cl.exe -nologo -std:c++latest -Ibuild\.gens\test\windows\x64\release\rules\utils\bin2c /EHsc -TP -scanDependencies build\.gens\test\windows\x64\release\rules\bmi\cache\modules\574a3743\md.cppm.module.json md.cppm -ifcOutput build\.gens\test\windows\x64\release\rules\bmi\cache\modules\574a3743 -Fobuild\.objs\test\windows\x64\release\md.cppm.obj) failed(2)
stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:957]:
    [@programdir\core\sandbox\modules\os.lua:378]:
    [@programdir\core\sandbox\modules\os.lua:291]: in function 'vrunv'
    [...\c++\modules\modules_support\msvc\dependency_scanner.lua:49]: in function 'callback'
    [@programdir\modules\core\project\depend.lua:217]: in function 'on_changed'
    [...\c++\modules\modules_support\msvc\dependency_scanner.lua:40]: in function 'generate_dependency_for'
    [...rules\c++\modules\modules_support\dependency_scanner.lua:216]: in function 'jobfunc'
    [@programdir\modules\async\runjobs.lua:237]:

stack traceback:
        [C]: in function 'error'
        @programdir\core\base\os.lua:957: in function 'os.raiselevel'
        (...tail calls...)
        @programdir\core\main.lua:306: in upvalue 'cotask'
        @programdir\core\base\scheduler.lua:404: in function <@programdir\core\base\scheduler.lua:397>
Issues-translate-bot commented 7 months ago

Bot detected the issue body's language is not English, translate it automatically.


Title: bin2c build priority error

waruqi commented 7 months ago

跟这个问题类似,目前暂时还没时间搞 https://github.com/xmake-io/xmake/issues/3420#issuecomment-1443748638

Issues-translate-bot commented 7 months ago

Bot detected the issue body's language is not English, translate it automatically.


Similar to this issue, I haven’t had time to deal with it yet https://github.com/xmake-io/xmake/issues/3420#issuecomment-1443748638