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

armcc link过程报runv(xxxx) failed(-1073740949) #2952

Closed
lucas-wu-wakakak opened this issue Oct 21, 2022 · 22 comments
Closed

armcc link过程报runv(xxxx) failed(-1073740949) #2952

lucas-wu-wakakak opened this issue Oct 21, 2022 · 22 comments
Labels
Milestone

Comments

@lucas-wu-wakakak
Copy link

Xmake 版本

2.7.2

操作系统版本和架构

WIN10

描述问题

源文件编译完成无报错,linking.release环节报错,故障如下:runv(xxxx.o xxx.o ...)failed(-1073740940)
stack traceback:
[C]: in function 'error'
[@programdir\core\base\os.lua:897]:
[@programdir\core\sandbox\modules\os.lua:267]: in function 'runv'
[@programdir\modules\core\tools\armlink.lua:59]:
[C]: in function 'xpcall'
[@programdir\core\base\utils.lua:280]:
[@programdir\actions\build\kinds\binary.lua:74]: in function 'callback'
[@programdir\modules\core\project\depend.lua:193]: in function 'on_changed'
[@programdir\actions\build\kinds\binary.lua:55]: in function '_do_link_target'
[@programdir\actions\build\kinds\binary.lua:102]:
[@programdir\actions\build\kinds\binary.lua:129]: in function '_link_target'
[@programdir\actions\build\kinds\binary.lua:157]: in function 'jobfunc'
[@programdir\modules\private\async\runjobs.lua:232]:
[C]: in function 'xpcall'
[@programdir\core\base\utils.lua:280]: in function 'trycall'
[@programdir\core\sandbox\modules\try.lua:117]: in function 'try'
[@programdir\modules\private\async\runjobs.lua:218]: in function 'cotask'
[@programdir\core\base\scheduler.lua:388]:
stack traceback:
[C]: in function 'error'
@programdir\core\base\os.lua:897: in function 'base/os.raiselevel'
(...tail calls...)
@programdir\modules\private\async\runjobs.lua:256: in field 'catch'
@programdir\core\sandbox\modules\try.lua:123: in global 'try'
@programdir\modules\private\async\runjobs.lua:218: in upvalue 'cotask'
@programdir\core\base\scheduler.lua:388: in function <@programdir\core\base\scheduler.lua:385>

期待的结果

能够正常生成axf文件

工程配置

No response

附加信息和错误日志

No response

@waruqi
Copy link
Member

waruqi commented Oct 21, 2022

加 -vD 给我看下完整输出

@lucas-wu-wakakak
Copy link
Author

lucas-wu-wakakak commented Oct 21, 2022

上面的stack traceback: 信息已经是加过-vD了

@waruqi
Copy link
Member

waruqi commented Oct 21, 2022

我要看完整输出,包括 link flags ,不是错误

@lucas-wu-wakakak
Copy link
Author

error: runv(C:\Keil_v5\ARM\armcc\bin\armlink -o build\cross\Cortex-M4.fp\release\firmware.axf xmakebuild\objs\xxxx.c.o xmakebuild\objs\xxxx.c.o(大概120个汇编文件) --cpu Cortex-M4.fp --cpu Cortex-M4.fp --scatter firmware/sct/firmware.sct --strict --summary_stderr --info summarysizes --map --xref --callgraph --symbols --info sizes --info totals --info unused --info veneers --list build/esc_xmake.map) failed(-1073740940)
stack traceback:
[C]: in function 'error'
[@programdir\core\base\os.lua:897]:
[@programdir\core\sandbox\modules\os.lua:267]: in function 'runv'
[@programdir\modules\core\tools\armlink.lua:59]:
[C]: in function 'xpcall'
[@programdir\core\base\utils.lua:280]:
[@programdir\actions\build\kinds\binary.lua:74]: in function 'callback'
[@programdir\modules\core\project\depend.lua:193]: in function 'on_changed'
[@programdir\actions\build\kinds\binary.lua:55]: in function '_do_link_target'
[@programdir\actions\build\kinds\binary.lua:102]:
[@programdir\actions\build\kinds\binary.lua:129]: in function '_link_target'
[@programdir\actions\build\kinds\binary.lua:157]: in function 'jobfunc'
[@programdir\modules\private\async\runjobs.lua:232]:
[C]: in function 'xpcall'
[@programdir\core\base\utils.lua:280]: in function 'trycall'
[@programdir\core\sandbox\modules\try.lua:117]: in function 'try'
[@programdir\modules\private\async\runjobs.lua:218]: in function 'cotask'
[@programdir\core\base\scheduler.lua:388]:
stack traceback:
[C]: in function 'error'
@programdir\core\base\os.lua:897: in function 'base/os.raiselevel'
(...tail calls...)
@programdir\modules\private\async\runjobs.lua:256: in field 'catch'
@programdir\core\sandbox\modules\try.lua:123: in global 'try'
@programdir\modules\private\async\runjobs.lua:218: in upvalue 'cotask'
@programdir\core\base\scheduler.lua:388: in function <@programdir\core\base\scheduler.lua:385>

@waruqi
Copy link
Member

waruqi commented Oct 21, 2022

你可以把这行 link 命令完整复制出来,自己 执行下,看什么错误

@waruqi
Copy link
Member

waruqi commented Oct 21, 2022

那就不知道了,可以搞个 demo 工程测试下,是否报错,或者用排除法自己排查下 各种地方

@lucas-wu-wakakak
Copy link
Author

运行没有报错,但是也没有任何新的文件生成,我先想办法将工程裁剪一下编译吧。

@waruqi
Copy link
Member

waruqi commented Oct 21, 2022

运行没有报错,但是也没有任何新的文件生成,我先想办法将工程裁剪一下编译吧。

那就还是失败的,retcode 也应该是非 0。。

一种可能是你的 link obj 太多,导致 link command 过长了。。windows 上执行命令是有长度限制的,超过了任何命令都会执行失败

@waruqi
Copy link
Member

waruqi commented Oct 21, 2022

可以参考下下面的处理方式,用 winos.argv 去 wrap 下,对 armlink.lua 的 linkargv

return self:program(), table.join("-o", targetfile, objectfiles, flags)

目前 armlink 内部没做 长命令处理,自己先改下 xmake 里面脚本,调下,如果跑通了,提个 pr 过来

argv = winos.cmdargv(argv, {escape = true})

argv = winos.cmdargv(argv)

argv = winos.cmdargv(argv, {escape = true})

@lucas-wu-wakakak
Copy link
Author

好的好的,我先试试,感觉非常有可能是这个问题

@lucas-wu-wakakak
Copy link
Author

加上了winos.cmdargv,报错提示Could not open file @C:\Users\xxxx\AppData\Local\Temp.xmake\221021_AAC24D36F37A4FE7BF0CBD7866BBEFA0.args.txt: Invalid argument
Finished: 0 information, 0 warning, 0 error and 1 fatal error messages. 这个语句是不是只能拦截但并不能解决命令过长的问题呀?

@lucas-wu-wakakak
Copy link
Author

lucas-wu-wakakak commented Oct 21, 2022

好像是语句问题,改完以后命令行是C:\Keil_v5\ARM\armcc\bin\armlink @C:\Users\xxxx\AppData\Local\Temp.xmake\221021_AAC24D36F37A4FE7BF0CBD7866BBEFA0.args.txt
查了下armcc手册,正确的语句是C:\Keil_v5\ARM\armcc\bin\armlink --via=C:\Users\xxxx\AppData\Local\Temp.xmake\221021_AAC24D36F37A4FE7BF0CBD7866BBEFA0.args.txt
,不是@而是--via=

@lucas-wu-wakakak
Copy link
Author

改动点如下:
armlink.lua ->line 53
return self:program(), table.join("-o", targetfile, objectfiles, flags)
改为
local argv = table.join("-o", targetfile, objectfiles, flags)
argv = winos.cmdargv(argv,{escape=true}}
return self:program(), argv

@waruqi
Copy link
Member

waruqi commented Oct 21, 2022

我现在没空细看,不同程序传入 arg.txt 格式稍有差异的,如果觉得 ok 了就先提个 pr 过来。

我回头会 review 的

waruqi added a commit that referenced this issue Oct 21, 2022
@waruqi
Copy link
Member

waruqi commented Oct 21, 2022

再试下,xmake update -s dev

@waruqi waruqi added this to the v2.7.3 milestone Oct 21, 2022
@waruqi
Copy link
Member

waruqi commented Oct 22, 2022

可以了么

@lucas-wu-wakakak
Copy link
Author

pull request 已提

@waruqi
Copy link
Member

waruqi commented Oct 23, 2022

再试下,xmake update -s dev

看下我之前的回复,我已经 dev 改了,让你更新 xmake 到 dev 分支先试下就行了,应该已经修了

不要提交到 master

@lucas-wu-wakakak
Copy link
Author

ok

@waruqi
Copy link
Member

waruqi commented Oct 23, 2022

如果 dev 分支测试ok ,我就直接同步 master ,不用 pr 了,如果还不行,提 pr 到 dev 分支

@lucas-wu-wakakak
Copy link
Author

行,明天我去公司测试一下到时候过来反馈

@lucas-wu-wakakak
Copy link
Author

测试ok,可以合入master,期待早日出release-exe

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