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

使用 compile_commands.json 时报错 Unknown argument: '-sdk' #3286

Closed
Parallel-Paradox opened this issue Jan 13, 2023 · 3 comments
Closed
Labels
Milestone

Comments

@Parallel-Paradox
Copy link

Parallel-Paradox commented Jan 13, 2023

Xmake 版本

xmake v2.7.5

操作系统版本和架构

macOS Ventura 13.1

描述问题

在 vscode 中使用 clangd 插件作为跳转环境, 使用 xmake project -k compile_commands 生成 compile_commands.json 文件后, 虽然不影响 build 和 run, 但 clangd 会在头文件开始处报错 Unknown argument: '-sdk'.

观察生成的 compile_commands.json 文件中部分表项:

{
  "directory": "...",
  "arguments": ["/usr/bin/xcrun", “-sdk”, "macosx" , "clang", "-c", ...],
  "file": "..."
},

将 arguments 中的 "-sdk", "macosx" 删除后报错提示消失.

期待的结果

生成 arguments 时是否不应有 “-sdk” 参数?

工程配置

mvp.zip

附加信息和错误日志

image

@waruqi
Copy link
Member

waruqi commented Jan 13, 2023

maybe you should open an issue to clangd

@Parallel-Paradox
Copy link
Author

I try to revert the arguments combination change in #3159 and this error disappear.

"arguments": ["/usr/bin/xcrun -sdk macosx clang",

Looks like there is a conflict between CLion and clangd.

waruqi added a commit that referenced this issue Jan 21, 2023
@waruqi
Copy link
Member

waruqi commented Jan 21, 2023

我改进了下,转成全路径了,再试试,xmake update -s dev

@waruqi waruqi closed this as completed Jan 21, 2023
@waruqi waruqi added this to the v2.7.6 milestone Jan 21, 2023
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