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

自定义工具链使用报错-工具链提示已存在到时检测存在 bug #5761

Open
davidxiaozhi opened this issue Oct 24, 2024 · 6 comments
Labels

Comments

@davidxiaozhi
Copy link

Xmake 版本

2.9.3

操作系统版本和架构

Linux pse-044 5.15.0-101-generic #111-Ubuntu SMP Tue Mar 5 20:16:58 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

描述问题

无法找到自定义的 toolchain 实现 topscc 这一个使用 shell 对 clang 的包装,该文件是存在的
工具链定义如下:
-- define toolchain
toolchain("venus_topcc")

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

-- set cross toolchains
set_sdkdir("/ops/tops/")
set_bindir("/ops/tops/bin")

-- set toolset
set_toolset("cc", "topscc")
set_toolset("cxx", "topscc")
set_toolset("ld", "clang++", "clang")
set_toolset("sh", "clang++", "clang")
set_toolset("ar", "ar")
set_toolset("ex", "ar")
set_toolset("strip", "strip")
set_toolset("mm", "clang")
set_toolset("mxx", "clang", "clang++")
set_toolset("as", "clang")

add_defines("MYCLANG")

-- check toolchain
on_check(function(toolchain)
return import("lib.detect.find_tool")("clang")
end)

-- on load
on_load(function(toolchain)
-- get march
local march = is_arch("x86_64", "x64") and "-m64" or "-m32"

-- init flags for c/c++
toolchain:add("cxflags", march)
toolchain:add("ldflags", march)
toolchain:add("shflags", march)
if not is_plat("windows") and os.isdir("/usr") then
    for _, includedir in ipairs({ "/ops/tops/include", "/usr/local/include", "/usr/include" }) do
        if os.isdir(includedir) then
            toolchain:add("includedirs", includedir)
        end
    end
    for _, linkdir in ipairs({ "/ops/tops/lib", "/usr/local/lib", "/usr/lib" }) do
        if os.isdir(linkdir) then
            toolchain:add("linkdirs", linkdir)
        end
    end
end

-- init flags for objc/c++  (with ldflags and shflags)
toolchain:add("mxflags", march)

-- init flags for asm
toolchain:add("asflags", march)

end)

-- https://xmake.io/#/zh-cn/manual/custom_toolchain

编译命令报错如下
xmake build -wv gcu_sample_elementwise_add
checking for topscc ... /opt/tops/bin/topscc
checking for the c++ compiler (cxx) ... topscc
error: cannot find known tool script for /opt/tops/bin/topscc
warning: we cannot get tool(cxx) in toolchain(venus_topcc) with linux/x86_64, because it has been not checked yet!
warning: we cannot load toolchain(venus_topcc), because it has been not checked yet!

期待的结果

能够使用自己的工具链,编译

工程配置

target("gcu_sample_elementwise_add")
set_kind("binary")
if is_mode("debug") then
add_defines("DEBUG")
end
set_toolchains("venus_topcc")
add_cxxflags("-Werror -Wall -arch gcu300")
-- -ltopsrt_static -lefrt_static -ltops_comgr_static -lrtcu_static -lz -lelf -ldl -lrt -lpthread
add_includedirs("./Common/")
add_links("topsrt_static","efrt_static","tops_comgr_static","rtcu_static","z","elf","dl","rt","pthread")
add_files("./Samples/2_Concepts_and_Techniques/simpleElemwiseAdd/simpleElemwiseAdd.cpp")

附加信息和错误日志

hecking for topscc ... /opt/tops/bin/topscc
checking for the c++ compiler (cxx) ... topscc
error: cannot find known tool script for /opt/tops/bin/topscc
warning: we cannot get tool(cxx) in toolchain(venus_topcc) with linux/x86_64, because it has been not checked yet!
warning: we cannot load toolchain(venus_topcc), because it has been not checked yet!

@Issues-translate-bot
Copy link

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


Title: Customized tool chain usage error - tool chain prompts that it already exists and then detects the existence of a bug

@waruqi
Copy link
Member

waruqi commented Oct 24, 2024

目前仅支持 已知编译器的自定义,比如 gcc/clang 系。。其他未知编译器 不支持自定义

如果 topscc 是 gcc/clang 系的用法,可以设置 gcc@topscc 告诉 xmake 作为 gcc 的参数用法来使用

@Issues-translate-bot
Copy link

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


Currently only customization of known compilers is supported, such as the gcc/clang system. . Other unknown compilers do not support customization

If topscc is a gcc/clang system usage, you can set gcc@topscc to tell xmake to use it as a parameter usage of gcc

@davidxiaozhi
Copy link
Author

请问设置那个参数

@waruqi
Copy link
Member

waruqi commented Oct 25, 2024

set_toolset

@Issues-translate-bot
Copy link

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


Please set that parameter

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

3 participants