-
-
Notifications
You must be signed in to change notification settings - Fork 784
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
XMake链接参数生成错误 #5524
Comments
Title: XMake link parameter generation error |
使用以下配置可以在我的平台上通过编译,测试发现llvm-config --system-libs在我的机器上会生成空串,但我必须要将其注释掉。 |
Using the following configuration can compile on my platform. Testing found that llvm-config --system-libs will generate an empty string on my machine, but I have to comment it out. |
add_ldflags 默认会自动检测,不保证一定检测成功,根据warnings 提示加 force 就行了。。正常。 |
不建议走 shell 这么玩,走 package 集成,也能找系统库。 https://github.com/xmake-io/xmake-repo/blob/dev/packages/l/llvm/fetch.lua |
It is not recommended to use shell to do this. You can also use package integration to find system libraries. https://github.com/xmake-io/xmake-repo/blob/dev/packages/l/llvm/fetch.lua |
https://discord.com/channels/785173387962089492/1037914914477592716/1278755928589602847 package("libllvm")
do
on_install(function (package)
import("lib.detect.find_tool")
local llvm_config = find_tool("llvm-config")
local cflags_raw = os.iorunv(llvm_config.program, { "--cflags" })
local cppflags_raw = os.iorunv(llvm_config.program, { "--cppflags" })
local cxxflags_raw = os.iorunv(llvm_config.program, { "--cxxflags" })
local ldflags_raw = os.iorunv(llvm_config.program, { "--ldflags" })
local cflags = cflags_raw:split("%s+") or {}
local cppflags = cppflags_raw:split("%s+") or {}
local cxxflags = cxxflags_raw:split("%s+") or {}
local ldflags = ldflags_raw:split("%s+") or {}
package:add("cflags", cflags)
package:add("cxflags", cppflags)
package:add("cxxflags", cxxflags)
package:add("ldflags", ldflags)
end)
end
package_end()
add_requires("libllvm") |
Xmake 版本
xmake v2.9.4+20240729
操作系统版本和架构
macOS Sequoia 15.0
描述问题
XMake生成了错误的链接参数
命令llvm-config生成如下:
xmake生成的链接命令如下:
错误信息:
我单方面认为是因为XMake链接参数生成错误
期待的结果
生成正确的链接选项,如
工程配置
add_rules("mode.debug", "mode.release")
add_rules("plugin.compile_commands.autoupdate")
local llvm_config = "/opt/homebrew/opt/llvm/bin/llvm-config"
target("BugTest")
set_kind("binary")
add_files("src/*.cpp")
set_toolchains("llvm")
附加信息和错误日志
The text was updated successfully, but these errors were encountered: