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

缓存命中后未链接产生新的可执行文件 #2620

Closed
flaribbit opened this issue Jul 31, 2022 · 3 comments
Closed

缓存命中后未链接产生新的可执行文件 #2620

flaribbit opened this issue Jul 31, 2022 · 3 comments
Labels
Milestone

Comments

@flaribbit
Copy link

flaribbit commented Jul 31, 2022

Xmake 版本

2.6.9

操作系统版本和架构

Windows 11 21H2

描述问题

如下,创建新项目,hello 改为 hola 再改回 hello,第三次编译未产生新的可执行文件

~\Desktop
❯ xmake create cache_test
create cache_test ...
  [+]: src\main.cpp
  [+]: xmake.lua
  [+]: .gitignore
create ok!

~\Desktop
❯ cd cache_test

~\Desktop\cache_test via 🌙
❯ xmake b;xmake r
checking for platform ... windows
checking for architecture ... x64
checking for Microsoft Visual Studio (x64) version ... 2022
[ 25%]: ccache compiling.release src\main.cpp
[ 50%]: linking.release cache_test.exe
[100%]: build ok!
hello world!

~\Desktop\cache_test via 🌙 took 4s
❯ sed -i 's/hello/hola/g' src/main.cpp

~\Desktop\cache_test via 🌙
❯ xmake b;xmake r
[ 25%]: ccache compiling.release src\main.cpp
[ 50%]: linking.release cache_test.exe
[100%]: build ok!
hola world!

~\Desktop\cache_test via 🌙 took 3s
❯ sed -i 's/hola/hello/g' src/main.cpp

~\Desktop\cache_test via 🌙
❯ xmake b;xmake r
[ 25%]: ccache compiling.release src\main.cpp
[100%]: build ok!
hola world!

第三次编译时没有链接产生新的可执行文件,运行的仍为第二次编译产生的程序

期待的结果

应该产生新的可执行文件吧

~\Desktop\cache_test via 🌙
❯ xmake b;xmake r
[ 25%]: ccache compiling.release src\main.cpp
+ [ 50%]: linking.release cache_test.exe
[100%]: build ok!
+ hello world!

工程配置

复现方法:

xmake create cache_test
cd cache_test
xmake b; xmake r
sed -i 's/hello/hola/g' src/main.cpp
xmake b; xmake r
sed -i 's/hola/hello/g' src/main.cpp
xmake b; xmake r

附加信息和错误日志

No response

@flaribbit flaribbit added the bug label Jul 31, 2022
@waruqi
Copy link
Member

waruqi commented Jul 31, 2022

这是因为用了 cache obj 后,直接复用了之前缓存的 obj,但是复用的 obj mtime 是老的,所以判断不需要 link,回头我会改进下对缓存文件的 mtime 处理。

@waruqi waruqi added this to the v2.7.1 milestone Jul 31, 2022
@waruqi
Copy link
Member

waruqi commented Aug 1, 2022

应该可以了,再试试,xmake update dev

@flaribbit
Copy link
Author

哇好快 可以了

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

2 participants