Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

大工程里vsxmake单独编译一个cpp卡住的问题 #5860

Open
wagcheg opened this issue Nov 21, 2024 · 10 comments
Open

大工程里vsxmake单独编译一个cpp卡住的问题 #5860

wagcheg opened this issue Nov 21, 2024 · 10 comments
Labels
Milestone

Comments

@wagcheg
Copy link

wagcheg commented Nov 21, 2024

Xmake 版本

v2.9.2

操作系统版本和架构

Windows 11

描述问题

工程里300+工程3000+文件
单编一个cpp卡住无输出

看代码虽然指定了target但是还是遍历了所有target

期待的结果

正常使用单编一个cpp的功能

工程配置

附加信息和错误日志

xmake build -y -P . --files=“/path/path/path/path/100.cpp" "foo100"

@wagcheg wagcheg added the bug label Nov 21, 2024
@Issues-translate-bot
Copy link

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


Title: The problem of vsxmake compiling a cpp alone in a large project is stuck

Xmake version

v2.9.2

Operating system version and architecture

Windows 11

Describe the problem

300+ projects and 3000+ files in the project
Single editing of a cpp is stuck and there is no output.

Looking at the code, although target is specified, all targets are still traversed.

Expected results

Normally use the function of single-programming a cpp

Project configuration

none

Additional information and error logs

xmake build -y -P . --files="/path/path/path/path/100.cpp" "foo100"

@star-hengxing
Copy link
Contributor

参考 #2033 看一下堆栈

@wagcheg
Copy link
Author

wagcheg commented Nov 22, 2024

many_targets_with_longpath_files.zip
复现xmake b --files="1.cpp" "t1"

@wagcheg
Copy link
Author

wagcheg commented Nov 22, 2024

[wc@wc many_targets_with_longpath_files]$ XMAKE_PROFILE=stuck xmake b --files="1.cpp" "t1"
<subprocess: cat>: cat /proc/cpuinfo
checking for platform ... linux
checking for architecture ... x86_64
<subprocess: which>: which gcc
<subprocess: gcc>: /usr/bin/gcc --version
<subprocess: which>: which zig
<subprocess: which>: which zig
<subprocess: which>: which nim
<subprocess: which>: which nim
^C
^C[xmake]: [engine]: stack traceback:
@programdir/modules/async/runjobs.lua:180: in function <@programdir/modules/async/runjobs.lua:56>
(...tail calls...)
@programdir/actions/build/build_files.lua:205: in function <@programdir/actions/build/build_files.lua:196>
(...tail calls...)
@programdir/actions/build/main.lua:107: in global '_do_build'
@programdir/actions/build/main.lua:126: in function <@programdir/actions/build/main.lua:120>
[C]: in function 'xpcall'
@programdir/core/base/utils.lua:244: in function 'base/utils.trycall'
@programdir/core/sandbox/modules/try.lua:117: in global 'try'
@programdir/actions/build/main.lua:118: in global 'build_targets'
@programdir/actions/build/main.lua:201: in function <@programdir/actions/build/main.lua:165>
(...tail calls...)
[C]: in function 'xpcall'
@programdir/core/base/utils.lua:244: in function 'base/utils.trycall'
(...tail calls...)
@programdir/core/base/task.lua:491: in function 'base/task.run'
@programdir/core/main.lua:327: in upvalue 'cotask'
@programdir/core/base/scheduler.lua:406: in function <@programdir/core/base/scheduler.lua:399>
^C追踪或断点陷阱(核心已转储)

@wagcheg
Copy link
Author

wagcheg commented Nov 22, 2024

2024-11-22_23-20
我的修改

@Issues-translate-bot
Copy link

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


2024-11-22_23-20
my modifications

@wagcheg
Copy link
Author

wagcheg commented Nov 22, 2024

压缩包里有火焰图
替换profiler.lua
XMAKE_PROFILE=flamegraph xmake b --files="1.cpp" "t1" > perf.folded
flamegraph.pl perf.folded > perf.svg
这个问题和文件路径长度有关系 实际环境里的长度比这个还要长些
应该是对全部文件匹配一次耗时太高
我的修改降低了要遍历的文件数量

@Issues-translate-bot
Copy link

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


There is a flame graph in the compressed package
Replace profiler.lua
XMAKE_PROFILE=flamegraph xmake b --files="1.cpp" "t1" > perf.folded
flamegraph.pl perf.folded > perf.svg
This problem is related to the length of the file path. The length in the actual environment is longer than this.
It should be that matching all files at once takes too much time.
My modification reduced the number of files to traverse

waruqi added a commit that referenced this issue Nov 23, 2024
waruqi added a commit that referenced this issue Nov 23, 2024
@waruqi
Copy link
Member

waruqi commented Nov 23, 2024

跟长文件没关系,整个匹配也就 6s,是 target job 链死循环了。再试试 xmake update -s dev

@waruqi waruqi added this to the v2.9.7 milestone Nov 23, 2024
@Issues-translate-bot
Copy link

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


It has nothing to do with long files, the entire matching only takes 6 seconds, and the target job chain is in an endless loop. Try xmake update -s dev again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants