页: 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
。