English 中文(简体)
部族红树林系统包括通道
原标题:clangd mangling system include paths

页: 1 -- check=my_file.cu 我拿着这些内容(简化):

I[13:05:09.356] Testing on source file /path/to/my_file.cu
I[13:05:09.362] Loading compilation database...
I[13:05:09.363] Loaded compilation database from /path/to/build/compile_commands.json
I[13:05:09.364] Compile command from CDB is: /path/to/bin/nvcc [...] -isystem=/path/to/lib/include [...] -- /path/to/my_file.cu
[...]
I[13:05:09.364] Parsing command...
I[13:05:09.371] internal (cc1) args are: -cc1 [...] -isystem =/path/to/lib/include [...] -x cuda /path/to/my_file.cu

关键是,汇编数据库中的指挥与平级内部指挥之间存在差异。 姓名:-isystem=/path/to/lib/include =/path/to/lib/include(有空间)。 看来部族没有适当划分“=syntax”这一系统。

Clangd is then unable to find the includes for libs installed system-wide unless I manually add -I /path/to/lib/include with the clangd config file.

表格-isystem=/path/to/lib/include正在由编集指挥部的CMake生成,并在与NVCC/GCC进行汇编时进行罚款。 但是,部族似乎将这一条解释为:<代码>=/path/to/lib/include。 而不是/path/to/lib/include

This is with C++/CUDA libraries, but I don t think that is the root cause.

是否有办法让部族适当打平-isystem为NVCC开的CMake所产生的旗帜? 这是否与部族的预期行为一致?

Minimum reproducible example

# CMakeLists.txt
cmake_minimum_required(VERSION 3.20)

project(demo LANGUAGES CUDA CXX)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# Download GoogleTest
include(FetchContent)
message(STATUS "> Downloading dependency: GoogleTest")
FetchContent_Declare(
  googletest
  URL https://github.com/google/googletest/archive/refs/tags/v1.14.0.zip
)
FetchContent_MakeAvailable(googletest)
message(STATUS "> Downloading dependency: GoogleTest - done")

# Build demo executable
add_executable(demo demo.cu)
target_link_libraries(demo GTest::gtest_main)
// demo.cu
#include <iostream>

int main() { std::cout << "Hello world" << std::endl; }

当与<代码>cmake-B 建设组合时,我们获得以下汇编: DB:

[
{
  "directory": "/home/sbone/repos/cmake_mvp/build",
  "command": "/path/to/bin/nvcc -forward-unknown-to-host-compiler  -isystem=/home/sbone/repos/cmake_mvp/build/_deps/googletest-src/googletest/include -isystem=/home/sbone/repos/cmake_mvp/build/_deps/googletest-src/googletest  --generate-code=arch=compute_52,code=[compute_52,sm_52] -std=c++17 -x cu -c /home/sbone/repos/cmake_mvp/demo.cu -o CMakeFiles/demo.dir/demo.cu.o",
  "file": "/home/sbone/repos/cmake_mvp/demo.cu"
},
{
  "directory": "/home/sbone/repos/cmake_mvp/build/_deps/googletest-build/googlemock",
  "command": "/local/scratch/sbone/mambaforge/envs/cudaj_devel/bin/x86_64-conda-linux-gnu-c++  -I/home/sbone/repos/cmake_mvp/build/_deps/googletest-src/googlemock/include -I/home/sbone/repos/cmake_mvp/build/_deps/googletest-src/googlemock -isystem /home/sbone/repos/cmake_mvp/build/_deps/googletest-src/googletest/include -isystem /home/sbone/repos/cmake_mvp/build/_deps/googletest-src/googletest -fvisibility-inlines-hidden -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /local/scratch/sbone/mambaforge/envs/cudaj_devel/include -Wall -Wshadow -Wundef -Wno-error=dangling-else -DGTEST_HAS_PTHREAD=1 -fexceptions -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -o CMakeFiles/gmock.dir/src/gmock-all.cc.o -c /home/sbone/repos/cmake_mvp/build/_deps/googletest-src/googlemock/src/gmock-all.cc",
  "file": "/home/sbone/repos/cmake_mvp/build/_deps/googletest-src/googlemock/src/gmock-all.cc"
},
{
  "directory": "/home/sbone/repos/cmake_mvp/build/_deps/googletest-build/googlemock",
  "command": "/local/scratch/sbone/mambaforge/envs/cudaj_devel/bin/x86_64-conda-linux-gnu-c++  -isystem /home/sbone/repos/cmake_mvp/build/_deps/googletest-src/googlemock/include -isystem /home/sbone/repos/cmake_mvp/build/_deps/googletest-src/googlemock -isystem /home/sbone/repos/cmake_mvp/build/_deps/googletest-src/googletest/include -isystem /home/sbone/repos/cmake_mvp/build/_deps/googletest-src/googletest -fvisibility-inlines-hidden -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /local/scratch/sbone/mambaforge/envs/cudaj_devel/include -Wall -Wshadow -Wundef -Wno-error=dangling-else -DGTEST_HAS_PTHREAD=1 -fexceptions -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -o CMakeFiles/gmock_main.dir/src/gmock_main.cc.o -c /home/sbone/repos/cmake_mvp/build/_deps/googletest-src/googlemock/src/gmock_main.cc",
  "file": "/home/sbone/repos/cmake_mvp/build/_deps/googletest-src/googlemock/src/gmock_main.cc"
},
{
  "directory": "/home/sbone/repos/cmake_mvp/build/_deps/googletest-build/googletest",
  "command": "/local/scratch/sbone/mambaforge/envs/cudaj_devel/bin/x86_64-conda-linux-gnu-c++  -I/home/sbone/repos/cmake_mvp/build/_deps/googletest-src/googletest/include -I/home/sbone/repos/cmake_mvp/build/_deps/googletest-src/googletest -fvisibility-inlines-hidden -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /local/scratch/sbone/mambaforge/envs/cudaj_devel/include -Wall -Wshadow -Wundef -Wno-error=dangling-else -DGTEST_HAS_PTHREAD=1 -fexceptions -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -o CMakeFiles/gtest.dir/src/gtest-all.cc.o -c /home/sbone/repos/cmake_mvp/build/_deps/googletest-src/googletest/src/gtest-all.cc",
  "file": "/home/sbone/repos/cmake_mvp/build/_deps/googletest-src/googletest/src/gtest-all.cc"
},
{
  "directory": "/home/sbone/repos/cmake_mvp/build/_deps/googletest-build/googletest",
  "command": "/local/scratch/sbone/mambaforge/envs/cudaj_devel/bin/x86_64-conda-linux-gnu-c++  -isystem /home/sbone/repos/cmake_mvp/build/_deps/googletest-src/googletest/include -isystem /home/sbone/repos/cmake_mvp/build/_deps/googletest-src/googletest -fvisibility-inlines-hidden -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /local/scratch/sbone/mambaforge/envs/cudaj_devel/include -Wall -Wshadow -Wundef -Wno-error=dangling-else -DGTEST_HAS_PTHREAD=1 -fexceptions -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -o CMakeFiles/gtest_main.dir/src/gtest_main.cc.o -c /home/sbone/repos/cmake_mvp/build/_deps/googletest-src/googletest/src/gtest_main.cc",
  "file": "/home/sbone/repos/cmake_mvp/build/_deps/googletest-src/googletest/src/gtest_main.cc"
}
]

如您所见,《世界人权宣言》的《守则》中有<条码>-isystem=......具体规定的制度。

注:这有CMake 3.24.3和NVCCcuda_12.2.r12.2/compiler.33191640_0

问题回答




相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签