cquery
cquery copied to clipboard
Eigen types are recognized as 'int'
When editing this:
#include <Eigen/Eigen>
int main(int argc, char *argv[])
{
Eigen::Matrix3d bar;
bar(0,0) = 1;
return 0;
}
I get this error: [Error]called object type 'Eigen::Matrix3d' (aka 'int') is not a function or function pointer
The logs don't say anything about the request (just the cache creation). Using the compilation database or the .cquery file give the same result. The completion for the Eigen namespace works properly (Eigen::M offers the different matrix for completion).
I would say this is related to how Eigen is written but YCM is able to correctly handle those types (with completion for the different methods etc) so I'm assuming it comes from cquery.
I believe your project configuration is not correct, likely due to a missing include directory; try using cquery --check <file.cc> until you find the missing include directory.
Can you include your project config here? If ycmd is able to parse the project it'd be good to make sure cquery can as well.
Here's the result:
( 0.000s) [main thread ] utils.cc:319 | Reading /path/to/applications/example/src/main.cpp
( 0.000s) [main thread ] command_line.cc:444 | Using path /path/to/applications/example/src/main.cpp
( 0.000s) [main thread ] project.cc:549 | Trying to load /path/to/build/compile_commands.json
( 0.000s) [main thread ]clang_system_include_extractor.cc:75 | Using compiler drivers /usr/bin/g++, /home/lesur/Clones/cquery/build/release/bin/cquery-clang, clang++, g++
( 0.000s) [main thread ]clang_system_include_extractor.cc:87 | Running /usr/bin/g++ -E -x c++ - -v -working-directory=/path/to/build/libs/configuration_loader
( 0.001s) [main thread ]clang_system_include_extractor.cc:92 | Output:
Using built-in specs.
COLLECT_GCC=/usr/bin/g++
g++: error: unrecognized command line option ‘-working-directory=/path/to/build/libs/configuration_loader’
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.9' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9)
( 0.001s) [main thread ]clang_system_include_extractor.cc:87 | Running /home/lesur/Clones/cquery/build/release/bin/cquery-clang -E -x c++ - -v -working-directory=/path/to/build/libs/configuration_loader
( 0.002s) [main thread ]clang_system_include_extractor.cc:92 | Output:
( 0.001s) [main thread ] loguru.hpp:1767 | atexit
( 0.002s) [main thread ]clang_system_include_extractor.cc:87 | Running clang++ -E -x c++ - -v -working-directory=/path/to/build/libs/configuration_loader
( 0.039s) [main thread ]clang_system_include_extractor.cc:92 | Output:
clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6.0.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
Found CUDA installation: /usr/local/cuda
"/usr/lib/llvm-3.8/bin/clang" -cc1 -triple x86_64-pc-linux-gnu -E -disable-free -disable-llvm-verifier -main-file-name - -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -v -dwarf-column-info -debugger-tuning=gdb -resource-dir /usr/lib/llvm-3.8/bin/../lib/clang/3.8.0 -working-directory /path/to/build/libs/configuration_loader -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/backward -internal-isystem /usr/local/include -internal-isystem /usr/lib/llvm-3.8/bin/../lib/clang/3.8.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -fdebug-compilation-dir /path/to/ ferror-limit 19 -fmessage-length 0 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -o - -x c++ -
clang -cc1 version 3.8.0 based upon LLVM 3.8.0 default target x86_64-pc-linux-gnu
ignoring nonexistent directory "/include"
ignoring duplicate directory "/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0"
#include "..." search starts here:
#include <...> search starts here:
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/backward
/usr/local/include
/usr/lib/llvm-3.8/bin/../lib/clang/3.8.0/include
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
# 1 "<stdin>"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 325 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "<stdin>" 2
( 0.039s) [main thread ] project.cc:157 | Using system include directory flags
-isystem/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0
-isystem/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0
-isystem/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/backward
-isystem/usr/local/include
-isystem/usr/lib/llvm-3.8/bin/../lib/clang/3.8.0/include
-isystem/usr/include/x86_64-linux-gnu
-isystem/usr/include
( 0.039s) [main thread ] project.cc:161 | To disable this set the discoverSystemIncludes config option to false.
( 0.039s) [main thread ] project.cc:66 | Failed to normalize /path/to/libs/foo/include # and a bunch of other modules
( 0.040s) [main thread ] timer.cc:35 | compile_commands.json clang time took 0.515ms
( 0.040s) [main thread ] timer.cc:35 | compile_commands.json our time took 39.39937ms
( 0.040s) [main thread ] project.cc:695 | angle_include_dir: /usr/local/include/opencv/
( 0.041s) [main thread ] project.cc:695 | angle_include_dir: /usr/local/include/
( 0.041s) [main thread ] command_line.cc:452 | Using arguments /usr/bin/g++ -working-directory=/path/to/build/applications/example_with_ext_dep -DOPENCV_TRAITS_ENABLE_DEPRECATED -isystem /path/to/3rdparty/eigen3 -isystem /usr/local/include -isystem /usr/local/include/opencv -Wall -Wpedantic -Wextra -g -std=gnu++14 /path/to/applications/example_with_ext_dep/src/main.cpp -resource-dir= -Wno-unknown-warning-option -fparse-all-comments -isystem/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0 -isystem/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0 -isystem/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/backward -isystem/usr/local/include -isystem/usr/lib/llvm-3.8/bin/../lib/clang/3.8.0/include -isystem/usr/include/x86_64-linux-gnu -isystem/usr/include
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/xmmintrin.h646:3 use of undeclared identifier '__builtin_ia32_storeups'
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/xmmintrin.h696:3 use of undeclared identifier '__builtin_ia32_movntps'
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/xmmintrin.h700:1 static declaration of '_mm_sfence' follows non-static declaration
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/xmmintrin.h700:1 definition of builtin function '_mm_sfence'
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/xmmintrin.h784:1 static declaration of '_mm_getcsr' follows non-static declaration
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/xmmintrin.h784:1 definition of builtin function '_mm_getcsr'
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/xmmintrin.h790:1 static declaration of '_mm_setcsr' follows non-static declaration
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/xmmintrin.h790:1 definition of builtin function '_mm_setcsr'
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/emmintrin.h389:10 use of undeclared identifier '__builtin_ia32_cvtps2pd'
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/emmintrin.h395:10 use of undeclared identifier '__builtin_ia32_cvtdq2pd'
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/emmintrin.h601:3 use of undeclared identifier '__builtin_ia32_storeupd'
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/emmintrin.h686:19 use of undeclared identifier '__builtin_ia32_pavgb128'
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/emmintrin.h692:19 use of undeclared identifier '__builtin_ia32_pavgw128'
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/emmintrin.h1234:3 use of undeclared identifier '__builtin_ia32_storedqu'
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/emmintrin.h1255:3 use of undeclared identifier '__builtin_ia32_movntpd'
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/emmintrin.h1261:3 use of undeclared identifier '__builtin_ia32_movntdq'
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/emmintrin.h1279:1 static declaration of '_mm_clflush' follows non-static declaration
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/emmintrin.h1279:1 definition of builtin function '_mm_clflush'
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/emmintrin.h1285:1 static declaration of '_mm_lfence' follows non-static declaration
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | e-dir=
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/xmmintrin.h646:3 use of undeclared identifier '__builtin_ia32_storeups'
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/xmmintrin.h696:3 use of undeclared identifier '__builtin_ia32_movntps'
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/xmmintrin.h700:1 static declaration of '_mm_sfence' follows non-static declaration
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/xmmintrin.h700:1 definition of builtin function '_mm_sfence'
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/xmmintrin.h784:1 static declaration of '_mm_getcsr' follows non-static declaration
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/xmmintrin.h784:1 definition of builtin function '_mm_getcsr'
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/xmmintrin.h790:1 static declaration of '_mm_setcsr' follows non-static declaration
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/xmmintrin.h790:1 definition of builtin function '_mm_setcsr'
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/emmintrin.h389:10 use of undeclared identifier '__builtin_ia32_cvtps2pd'
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/emmintrin.h395:10 use of undeclared identifier '__builtin_ia32_cvtdq2pd'
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/emmintrin.h601:3 use of undeclared identifier '__builtin_ia32_storeupd'
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/emmintrin.h686:19 use of undeclared identifier '__builtin_ia32_pavgb128'
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/emmintrin.h692:19 use of undeclared identifier '__builtin_ia32_pavgw128'
( 0.681s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/emmintrin.h1234:3 use of undeclared identifier '__builtin_ia32_storedqu'
( 0.682s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/emmintrin.h1255:3 use of undeclared identifier '__builtin_ia32_movntpd'
( 0.682s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/emmintrin.h1261:3 use of undeclared identifier '__builtin_ia32_movntdq'
( 0.682s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/emmintrin.h1279:1 static declaration of '_mm_clflush' follows non-static declaration
( 0.682s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/emmintrin.h1279:1 definition of builtin function '_mm_clflush'
( 0.682s) [ 8CF09700] clang_indexer.cc:2367 | /usr/lib/llvm-3.8/lib/clang/3.8.0/include/emmintrin.h1285:1 static declaration of '_mm_lfence' follows non-static declaration
( 0.682s) [ 8CF09700] clang_indexer.cc:2367 | e-dir=
( 0.682s) [main thread ] clang_indexer.cc:2403 | Got 40 diagnostics
( 0.686s) [main thread ] loguru.hpp:1767 | atexit
You can see that line 66, eigen is included in the include dir:
( 0.041s) [main thread ] command_line.cc:452 | Using arguments /usr/bin/g++ -working-directory=/path/to/build/applications/example_with_ext_dep -DOPENCV_TRAITS_ENABLE_DEPRECATED -isystem /path/to/3rdparty/eigen3 -isystem /usr/local/include -isystem /usr/local/include/opencv -Wall -Wpedantic -Wextra -g -std=gnu++14 /path/to/applications/example_with_ext_dep/src/main.cpp -resource-dir= -Wno-unknown-warning-option -fparse-all-comments -isystem/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0 -isystem/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0 -isystem/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/backward -isystem/usr/local/include -isystem/usr/lib/llvm-3.8/bin/../lib/clang/3.8.0/include -isystem/usr/include/x86_64-linux-gnu -isystem/usr/include
The way we include eigen in our project is by adding a CMake interface and add the 3rdparty folder to the include dirs. Note that we tagged it as system dependency (it's basically the only way to shut all the warnings):
set(EIGEN3_LOCATION 3rdparty/eigen3)
# ...
add_library(Eigen3 INTERFACE)
target_include_directories(Eigen3 SYSTEM INTERFACE ${EIGEN3_LOCATION})
And in this example program's CMake:
set(MODULE_NAME "foo")
set(SRC_FILES
src/main.cpp
)
add_executable(${MODULE_NAME} ${SRC_FILES})
target_link_libraries(${MODULE_NAME} Eigen3)
On the same idea, opencv matrices are not recognized as having the proper type:
cv::Mat descriptors_1;
cv::cuda::GpuMat gpu_descriptor_1(descriptors_1);
no viable conversion from cv::Mat to const cv::_InputArray
Does clang -working-directory=/path/to/build/applications/example_with_ext_dep -DOPENCV_TRAITS_ENABLE_DEPRECATED -isystem /path/to/3rdparty/eigen3 -isystem /usr/local/include -isystem /usr/local/include/opencv -Wall -Wpedantic -Wextra -g -std=gnu++14 /path/to/applications/example_with_ext_dep/src/main.cpp -resource-dir= -Wno-unknown-warning-option -fparse-all-comments -isystem/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0 -isystem/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0 -isystem/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/backward -isystem/usr/local/include -isystem/usr/lib/llvm-3.8/bin/../lib/clang/3.8.0/include -isystem/usr/include/x86_64-linux-gnu -isystem/usr/include run without errors? It should - can you figure out which flag is causing the problems?
It compiles without error :/
FWIW, I also have the same problem, and can confirm that YCM in fact handles this correctly. I couldn't seem to get an easy fix myself, but I have switched back to YCM for now. Hopefully this can be somehow fixed.
Are there any updates here? I am also getting Eigen types parsed as 'int'. The project config has not changed, and the required Eigen files are included. This used to work, so I imagine something changed a few weeks ago.
Update: I don't know what it was. I tried to locate the bug to a particular commit, but failed to reproduce it. And the code example given https://github.com/cquery-project/cquery/issues/659#issue-320854465 also does not throw an error. So maybe try a clean build, @pLesur? Hope that helps.
Did a clean build, but the issue persists unfortunately. I'll do a bit more testing later (I just realized cquery is using llvm-6.0, I don't know if previous versions also did but that could be an issue).
@pLesur You're right. I was hasty in saying that it corrected things. I think I located the faulty commit using git bisect. It is here: https://github.com/cquery-project/cquery/commit/43b4a30f11c6a0ff9ba880e827b02e9f6f84df06
Could you confirm that this is the first bad commit for you? As in this one fails to parse Eigen correctly in your example?
Yup, this one fails and the one right before worked!
Here's a patch to correct the problem. I don't know why that commit was performed, so someone will have to tell me about that.
@jacobdufault Maybe you can help? You seem to have worked on the commit https://github.com/cquery-project/cquery/commit/43b4a30f11c6a0ff9ba880e827b02e9f6f84df06 Eigen.txt
I doubt https://github.com/cquery-project/cquery/commit/43b4a30f11c6a0ff9ba880e827b02e9f6f84df06 has anything to do with this issue. Please note that commit happened later than the time this issue was first created. If you want to Git bisect, you probably need to move backward further to find the real cause. Also you should make sure the cquery cache is purged for each Git bisect test.
I can confirm that the patch works on master for me. And yes, I purged the cache, and regenerated compile_commands.json too, just for good measure.
To be clear, I don't know whether that commit is the one to blame, but undoing a change there does correct the working of my system. I can verify this again if you like, but I am running on master with the patch I have provided in https://github.com/cquery-project/cquery/issues/659#issuecomment-398433910
So I encountered the (exact?) same issue with YCM on another project. I don't know if it helps at all for cquery, but I assume you'd like to know you're not alone in this situation! I'll create an issue later on the YCM repo. Here's some information about the problem...
Using the MWE I posted in the OP:
| compiler\completion system | cquery | YCM |
|---|---|---|
| gcc | nope | ok |
| clang | nope | ok |
However, when working on my current codebase...
| compiler\completion system | cquery | YCM |
|---|---|---|
| gcc | nope | nope |
| clang | nope | ok |
I'll need to get another MWE for my project because there's obviously something missing. It could be due to how I include Eigen.
Anyhow, in the case of YCM, it seems like a compile_commands.json parsing issue (project compiles fine in all cases so it's not CMake). Could it be similar for cquery? Would be quite surprise to encounter the same issue from two unrelated causes. But what do I know ¯\(ツ)/¯
I have encountered a similar issue with current cquery git master. It looks like in my case it is somehow related to clang going mad on gcc's SSE intrinsics:
clang_indexer.cc:2366 | /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include/xmmintrin.h:130:19 use of undeclared identifier '__builtin_ia32_addss'
<and so on...>
A quick'n'dirty workaround I found is to add
target_compile_definitions(myprogram PRIVATE -DEIGEN_DONT_VECTORIZE)
to CMakeLists.txt.
DEIGEN_DONT_VECTORIZE
If you add it directly in compile_commands, how do you add it?