-
Notifications
You must be signed in to change notification settings - Fork 263
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
-march=armv7-a will cause ccls not to work #107
Comments
This happens because libclang doesn't support |
cquery works fine with the same compile_commands.json. is ccls possible to handle this issue? |
Could you please try to also put Without setting target triplet Clang assumes your target is same as the host (i.e. not cross compiling), so it barks at It looks like cquery blacklists |
clang -target armv7a-linux-gnueabi -E -dM -xc /dev/null
ln -s your_clang armv7a-linux-gnueabi-clang
./armv7a-linux-gnueabi -E -dM -xc /dev/null A {
"arguments": [ "armv7a-linux-gnueabi-clang++", "-c", "-o", "a.o", "a.cc" ],
"directory": "/tmp/d",
"file": "a.cc"
} For GCC options that are unknown to clang, you can exclude them with the initialization option "clang": { "extraArgs": ["-mno-thumb-interwork", "-fconserve-stack", "-fno-var-tracking-assignments"]} |
Thank you guys for the patient explanation. It works now (with some random crash, rarely). I was expecting ccls to works out-of-box. |
I would also want to make ccls work out-of-box in this case, but (IMO) there are simply no good way to do it while keeping the correct behavior. You have to at least point Clang to your cross toolchain's system headers, so it sounds like it must involve some arg mangle. Sidenote: With correct $ clang++-7 --target=arm-linux-gnueabi -march=armv7-a -v -x c++ -
clang version 7.0.0-6 (tags/RELEASE_700/final)
Target: arm-linux-gnueabi
Thread model: posix
InstalledDir: /usr/bin
"/usr/lib/llvm-7/bin/clang" -cc1 -triple armv7-linux-gnueabi -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name - -mrelocation-model static <...snipped...> See how the triplet passed to cc1 is actually Edit: Typo in target triplet. |
@LoongW May I ask you to contribute a wiki page (cross compilation) for posterity since you've figured it out? As @Riatre, it would be nice to work out-of-box but driver code is hard to write and maintain on the Clang API user side. As a quick example:
Extra fun in https://github.com/llvm-mirror/clang/tree/master/include/clang/Driver/Distro.h https://github.com/llvm-mirror/clang/tree/master/lib/Driver/ToolChains/Linux.cpp Studying this piece of code strengthened my idea that user should just tweak Users mostly use GCC as the cross compiler. clang provides excellent emulation but sometimes you still need to tweak a bit to make it work: On the other hand, cross compiling users have gone through the relatively complex toolchain usage process it is reasonable to expect them to handle this configuration twiddling. A wiki page is very welcomed to help others :) @Riatre ah yes, |
This PR #171 may help.
|
I am trying to use ccls with a cross-compiled project with compile_commands.json. There is a flags
-march=armv7-a
that cause ccls always to show 'xxx is being indexed'.The text was updated successfully, but these errors were encountered: