Open laoshaw opened 2 years ago
Forgot to mention, I did have: let g:ale_c_cc_executable="/opt/arm-none-gcc/bin/arm-none-gcc" and this one always showed up in ALEInfo, it's just ignored as ALE treats my code as native c code and uses all native settings for it.
If I do not have any above manual changes and I produce a compile_commands.json file that has correct directory, cross-compiler name, flags etc, ALEInfo still shows it uses 'clang' to build instead of my 'arm-none-gcc' in compile_commands.json', it is ignoring that line for some reason(other flags are picked up correctly, however)
work around: put something like let g:ale_c_cc_executable="/usr/bin/arm-none-eabi-gcc"
into local.vimrc will force ALE to use cross compiler, still ALE ignores first argument in compile_commands.json(e.g. the compiler)
Information
VIM version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Feb 01 2022 09:16:32) Included patches: 1-2269, 3612, 3625, 3669, 3741
ubuntu 20.04
What went wrong
I use cross-compiler(arm-none-gcc) and ALE sends out a lot of warning because it is use native gcc and could not find the correct path for cross-compiler's headers. I use compiler as the linter(not clangtidy etc which respects compile_commands.json but gcc/clang ignores compile_commands.json)
so I change
let g:ale_linters={'c':['arm-none-gcc']}
evenlet g:ale_linters={'c':['my/path/to/arm-none-gcc']}
, as long as I put cross compiler here, ALEInfo will no longer show ale_linter and ale_c_cc_options at all. If I change it back to a native gcc/clang, ale_linter etc shows as expected.Reproducing the bug
in .vimrc, do:
let g:ale_linters={'c':['arm-none-gcc']}
, open any c file, run :ALEinfo, the new linter setting is totally ignored and default native linters are used instead.:ALEInfo