xmake-io / xmake

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

自定义toolchains设定无法支持gcc@ccmips方式 #1361

Closed rtoslab closed 3 years ago

rtoslab commented 3 years ago

注:提问题时若使用不能用/没效果/有问题/报错此类模糊表达,但又没有根据下面的模板给出任何相关辅助信息的,将会直接标记为Invalid。

描述问题

自定义toolchains设定中无法使用set_toolset("cc", "gcc@ccmips")设定,但以同样方式在全局根作用域使用正常。

期待的结果

希望能在自定义toolchains设定中使用set_toolset("cc", "gcc@ccmips")设定。

错误信息

如果是xmake相关编译问题,请加上-vD参数运行,并给出详细编译输出信息。 D:\WORK\xmake-labs-vxworks-v2>xmake -r -vD checkinfo: cannot runv(gcc@ccmips.exe --version), No such file or directory checking for gcc@ccmips ... no checking for the linker (ld: gcc@ccmips) ... no error: @programdir\core\main.lua:294: @programdir\actions\build\main.lua:146: ...mdir\core\sandbox\modules\import\core\base\scheduler.lua:87: ...mdir\core\sandbox\modules\import\core\base\scheduler.lua:47: @programdir\modules\private\async\runjobs.lua:217: @programdir\core\project\target.lua:586: cannot get program for ld stack traceback: [C]: in function 'error' [@programdir\core\base\os.lua:793]: in function 'raise' [@programdir\core\project\target.lua:586]: in function 'linker' [@programdir\core\project\target.lua:1004]: in function 'targetfile' [@programdir\actions\build\build.lua:34]: in function '_clean_target' [@programdir\actions\build\build.lua:144]: in function 'jobfunc' [@programdir\modules\private\async\runjobs.lua:193]: [C]: in function 'trycall' [@programdir\core\sandbox\modules\try.lua:121]: in function 'try' [@programdir\modules\private\async\runjobs.lua:186]: in function 'cotask' [@programdir\core\base\scheduler.lua:342]:

stack traceback: [C]: in function 'error' @programdir\core\base\os.lua:793: in function 'raise' @programdir\modules\private\async\runjobs.lua:217: in function 'catch' @programdir\core\sandbox\modules\try.lua:127: in function 'try' @programdir\modules\private\async\runjobs.lua:186: in function 'cotask' @programdir\core\base\scheduler.lua:342: in function <@programdir\core\base\scheduler.lua:339> stack traceback: [C]: in function 'error' @programdir\core\base\os.lua:793: in function 'raise' ...mdir\core\sandbox\modules\import\core\base\scheduler.lua:47: in function 'co_start_named' @programdir\modules\private\async\runjobs.lua:184: in function <@programdir\modules\private\async\runjobs.lua:144> [C]: in function 'trycall' @programdir\core\base\scheduler.lua:455: in function 'co_group_begin' ...mdir\core\sandbox\modules\import\core\base\scheduler.lua:85: in function 'co_group_begin' @programdir\modules\private\async\runjobs.lua:144: in function 'runjobs' @programdir\actions\build\build.lua:222: in function 'build' @programdir\actions\build\main.lua:133: in function <@programdir\actions\build\main.lua:123> [C]: in function 'trycall' @programdir\core\sandbox\modules\try.lua:121: in function 'try' @programdir\actions\build\main.lua:122: in function <@programdir\actions\build\main.lua:96> [C]: in function 'load' @programdir\core\base\task.lua:519: in function 'run' @programdir\core\main.lua:292: in function 'cotask' @programdir\core\base\scheduler.lua:342: in function <@programdir\core\base\scheduler.lua:339> stack traceback: [C]: in function 'error' @programdir\core\base\os.lua:793: in function 'raise' @programdir\core\main.lua:294: in function 'cotask' @programdir\core\base\scheduler.lua:342: in function <@programdir\core\base\scheduler.lua:339>

相关环境

请提供编译和运行环境信息,下面是一些必须填写的基础信息,便于我们针对性排查问题:

其他信息

-- define toolchain toolchain("vxworks-gcc")

-- set homepage
set_homepage("https://www.wrs.com/")
set_description("WindRiver GNU Compiler Collection")

-- mark as standalone toolchain
set_kind("standalone")

-- set toolset
set_toolset("cc", "gcc@ccmips")
set_toolset("cxx", "g++@c++mips")
set_toolset("ld", "gcc@ccmips")
set_toolset("sh", "g++@c++mips")
set_toolset("ar", "ar@armips")

toolchain_end()

target("helloworld_dkm_smp.out") set_kind("binary")

add_files(
    "$(projectdir)/src/test/helloworld/*.c"
)

add_toolchains("vxworks-gcc")

通过初步分析,主要出现问题在xmake\core\tool\toolchain.lua中的

-- check the given tool path function _instance:_checktool(toolkind, toolpath)

local tool = find_tool(program, {cachekey = self:cachekey(), program = program, paths = self:bindir(), envs = self:get("runenvs")})

无法正确处理包含@的信息

waruqi commented 3 years ago

你更新到 dev 再试试。

rtoslab commented 3 years ago

已验证通过!