-
-
Notifications
You must be signed in to change notification settings - Fork 763
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
三个子项目使用了同一个c++模块,同一个文件不应该被编译三次?error C3474: 无法打开输出文件 #3746
Comments
如果在不同 target 中添加的,当然得重新编译,每个 target 的配置 编译 flags 不一定完全一致,即使完全一致,也是独立的。正常
只要看到 无法打开文件。。路径有比较长的,并且其他平台没问题的,通常都是 win 长路径限制,跟 msvc 没啥关系。。自己改短下 |
但是这个文件长度147并没有超过260?
|
你上面的 ci 跑的,也是这个根目录?我不记得 ci 上默认 clone 会 clone 到 C: root 下 |
我在我的电脑上也跑了,一样结果 |
那就不知道了,通常这种就是长度限制,你可以再改短下试试,insert-into-a-binary-search-tree-test 比如改成 xxx 试试 另外,报错后 看下, |
我试了一下,这个目录确实存在 C:\leetcode-test\build.gens\insert-into-a-binary-search-tree-test\windows\x64\test\rules\modules\cache\cd9c01bf\ |
那这个多半还是长路径的问题,而且这个是 msvc 里面报出来的。。不是 xmake 。。如果是在 xmake 内部,会自动处理部分长路径的限制去绕过,但是 cl.exe 里面。xmake 改不了。。 这个要么就是继续改短路径试试,没其他办法。。或者可以到微软那边反馈下。 |
我发现有时候又不会出错,该不会是概率性事件? |
我想明白了,原因应该是并行编译导致三个进程访问了同一个文件,所以报错,是不是应该使用加锁的方法,避免资源竞争 |
无法加锁,你可以调下这里。
按理不同 target 编译相同 modules files 。。module hash 应该不同 (cd9c01bf),不应该是相同路径。。 build.gens\insert-into-a-binary-search-tree-test\windows\x64\test\rules\modules\cache\cd9c01bf\leetcode_treenode_cpp.TreeNode.ifc |
经过我的测试确实是并行编译的问题,指定 |
你刚不已经说过了么。我是说按上面我说的,调下,看看为什么会生成三个相同路径 ifc path |
应该不是这个key的问题,这三个key并没有一样
这个key是在 |
看你上面的 logs,三次编译,是在三个 target 下,对应的 obj 都是不同路径,但是 ifc output 路径却是上面三个相同路径,都是 cd9c01bf 这个 modulehash ,所以得调下 为什么是相同 hash 。。
我说的就是这个阶段
|
我修复了,更新下试试,xmake update -s dev |
I fixed it, try updating it, xmake update -s dev |
Xmake 版本
v2.7.9+HEAD.c87922676
操作系统版本和架构
Microsoft Windows [版本 10.0.22621.1702] amd64
描述问题
https://github.com/masx200/leetcode-test/actions/runs/4982469146/jobs/8918177103
我有三个子项目都用到了同一个文件,这个文件被编译三次是不是不应该?
把三个项目分开单独编译都没问题,但是合到一起编译就报错了?
compiling.module.test leetcode_treenode_cpp.TreeNode
这句话出现了三次我发现在macos上使用clang16编译没有问题,看来是msvc的bug了?
期待的结果
不应该出现错误
工程配置
主配置文件
xmake.lua
leetcode-treenode-cpp/xmake.lua
insert-into-a-binary-search-tree/xmake.lua
insufficient-nodes-in-root-to-leaf-paths/xmake.lua
附加信息和错误日志
The text was updated successfully, but these errors were encountered: