Summary: | KDevelop can't find header files if the project path contains spaces | ||
---|---|---|---|
Product: | [Applications] kdevelop | Reporter: | Bernhard Scheirle <bernhard+kde> |
Component: | Build tools: CMake | Assignee: | kdevelop-bugs-null |
Status: | REOPENED --- | ||
Severity: | normal | CC: | aleixpol, kfunk |
Priority: | HI | ||
Version: | 5.0.2 | ||
Target Milestone: | 5.0.4 | ||
Platform: | Neon | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Attachments: | Example project |
Description
Bernhard Scheirle
2016-10-24 10:58:18 UTC
Created attachment 101737 [details]
Example project
Running kdevelop with KDEV_CLANG_DISPLAY_ARGS=1 outputs: Invocation: clang -ferror-limit=100 -fspell-checking -Wdocumentation -Wunused-parameter -Wunreachable-code -Wall -std=c++11 -nostdinc -nostdinc++ -xc++ -isystem/usr/include/c++/5 -isystem/usr/include/x86_64-linux-gnu/c++/5 -isystem/usr/include/c++/5/backward -isystem/usr/local/include -isystem/usr/lib/llvm-3.8/lib/clang/3.8.0/include -isystem/usr/include/x86_64-linux-gnu -isystem/usr/include -I/path with spaces/build" -I"/path with spaces -imacros /tmp/kdevelop.J31470 /path with spaces/folder/header.cpp As you can see some paths are not escaped properly! I can't reproduce your problem, using latest KDevelop with Clang 3.9. All works fine for me. This is what I get: ``` Invocation: clang -ferror-limit=100 -fspell-checking -Wdocumentation -Wunused-parameter -Wunreachable-code -Wall -std=c++11 -nostdinc -nostdinc++ -xc++ -isystem/home/kfunk/Downloads/path with spaces build -isystem/usr/include/c++/6 -isystem/usr/include/x86_64-linux-gnu/c++/6 -isystem/usr/include/c++/6/backward -isystem/usr/local/include -isystem/usr/lib/llvm-3.9/lib/clang/3.9.0/include -isystem/usr/include/x86_64-linux-gnu -isystem/usr/include -I/home/kfunk/Downloads/path with spaces -imacros /tmp/kdevelop.U27790 /home/kfunk/Downloads/path with spaces/folder/header.cpp ``` Note that the output here is slightly misleading, there are no '"' around the include paths. Internally, the arguments are passed as a list of arguments, thus spacing in one argument is not a problem. Anyhow, in your case, the quoting indeed looks wrong: ``` -I/path with spaces/build" -I"/path with spaces ``` That's either because CMake creates a bogus compile_commands.json file or we fail to parse it properly. Could you please a) Check out the newest AppImage on https://www.kdevelop.org/download and try to reproduce? b) Post the contents of the compile_commands.json in the build directory? KDevelop: 5.0.4 from KDE Neon Clang: 3.8.0 After importing the project KDevelop found the header file with no errors/warnings. But then after pruning the project the header file can't be found anymore. After importing the project: compile_commands.json: [ { "directory": "/path with spaces/build", "command": "/usr/bin/c++ -I. -I../ -g -o CMakeFiles/space.dir/main.cpp.o -c \"/path with spaces/main.cpp\"", "file": "/path with spaces/main.cpp" }, { "directory": "/path with spaces/build", "command": "/usr/bin/c++ -I. -I../ -g -o CMakeFiles/space.dir/folder/header.cpp.o -c \"/path with spaces/folder/header.cpp\"", "file": "/path with spaces/folder/header.cpp" } ] Log: Invocation: clang -ferror-limit=100 -fspell-checking -Wdocumentation -Wunused-parameter -Wunreachable-code -Wall -std=c++11 -nostdinc -nostdinc++ -xc++ -isystem/usr/include/c++/5 -isystem/usr/include/x86_64-linux-gnu/c++/5 -isystem/usr/include/c++/5/backward -isystem/usr/local/include -isystem/usr/lib/llvm-3.8/lib/clang/3.8.0/include -isystem/usr/include/x86_64-linux-gnu -isystem/usr/include -I/path with spaces/build -I/path with spaces -imacros /tmp/kdevelop.XM8558 /path with spaces/folder/header.cpp Every (especially quoting) looks right. Now prune the project (Project->Prune Selection) and reload header.cpp (Hit F5): compile_commands.json: [ { "directory": "/path with spaces/build", "command": "/usr/bin/c++ -I\"/path with spaces/build\" -I\"/path with spaces\" -g -o CMakeFiles/space.dir/main.cpp.o -c \"/path with spaces/main.cpp\"", "file": "/path with spaces/main.cpp" }, { "directory": "/path with spaces/build", "command": "/usr/bin/c++ -I\"/path with spaces/build\" -I\"/path with spaces\" -g -o CMakeFiles/space.dir/folder/header.cpp.o -c \"/path with spaces/folder/header.cpp\"", "file": "/path with spaces/folder/header.cpp" } ] Log: Invocation: clang -ferror-limit=100 -fspell-checking -Wdocumentation -Wunused-parameter -Wunreachable-code -Wall -std=c++11 -nostdinc -nostdinc++ -xc++ -isystem/usr/include/c++/5 -isystem/usr/include/x86_64-linux-gnu/c++/5 -isystem/usr/include/c++/5/backward -isystem/usr/local/include -isystem/usr/lib/llvm-3.8/lib/clang/3.8.0/include -isystem/usr/include/x86_64-linux-gnu -isystem/usr/include -I/path with spaces/build" -I"/path with spaces -imacros /tmp/kdevelop.UJ9631 /path with spaces/folder/header.cpp Note: * compile_commands.json uses absolute paths after pruning the project for the build and project root directory. * After pruning the quoting is wrong (build" -I"/path) * The KDevelop-5.0.4-x86_64.AppImage behaves exactly the same. Thanks. I'll check again. |