dense-analysis / dense-analysis/ale

C++ headers' location are not taken into account when parsed from Makefile

Open
#3,520 1 comment 1 reaction 0 assignees View on GitHub
bug
Dominant language
Vim Script
Stars
14k
Forks
1.5k
Avg merge
17h 49m
Merged PRs (30d)
1

Description

## Information

**VIM version**

```
NVIM v0.4.4
Build type: Release
```

Same error with regular vim:

```
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Nov 15 2020 16:46:37)
Included patches: 1-1989
```

Operating System: `Linux grocpc 5.10.4-arch2-1 #1 SMP PREEMPT Fri, 01 Jan 2021 05:29:53 +0000 x86_64 GNU/Linux`

## What went wrong

I'm writing a C++ project where files are organised in different directoried. Include directories are specified in the Makefile and ALE reads them well as you can see in the `ALEInfo`. However, the linter doesn't take them into account and throws a `no such file or directory` error on their `#include` statement. ALEInfo also shows that the `-I` option isn't used when linting the file.

## Reproducing the bug

1. I divided a project into folders
2. I set the relevant `-I` options in the Makefile
3. I made sure Makefile parsing was on
4. The linter didn't recognise the include directories and threw an error

### :ALEInfo

```
Current Filetype: cpp
Available Linters: ['cc', 'ccls', 'clangcheck', 'clangd', 'clangtidy', 'clazy', 'cppcheck', 'cpplint', 'cquery', 'flawfinder']
Linter Aliases:
'cc' -> ['gcc', 'clang', 'g++', 'clang++']
Enabled Linters: ['cc']
Ignored Linters: []
Suggested Fixers:
'astyle' - Fix C/C++ with astyle.
'clang-format' - Fix C/C++ and cuda files with clang-format.
'clangtidy' - Fix C/C++ and ObjectiveC files with clang-tidy.
'remove_trailing_lines' - Remove all blank lines at the end of a file.
'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
'uncrustify' - Fix C, C++, C#, ObjectiveC, ObjectiveC++, D, Java, Pawn, and VALA files with uncrustify.
Linter Variables:

let g:ale_cpp_cc_executable = ''
let g:ale_cpp_cc_options = '-std=c++17 -Wall -Wextra -Wpedantic -Wfloat-equal'
let g:ale_cpp_parse_makefile = 1
Global Variables:

let g:ale_cache_executable_check_failures = v:null
let g:ale_change_sign_column_color = 1
let g:ale_command_wrapper = ''
let g:ale_completion_delay = v:null
let g:ale_completion_enabled = 0
let g:ale_completion_max_suggestions = v:null
let g:ale_disable_lsp = 0
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%code: %%s'
let g:ale_echo_msg_info_str = 'Info'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_fix_on_save = 0
let g:ale_fixers = {}
let g:ale_history_enabled = 1
let g:ale_history_log_output = 1
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1
let g:ale_lint_on_filetype_changed = 1
let g:ale_lint_on_insert_leave = 1
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'normal'
let g:ale_linter_aliases = {}
let g:ale_linters = {'c': ['gcc'], 'cpp': ['g++']}
let g:ale_linters_explicit = 0
let g:ale_linters_ignore = {}
let g:ale_list_vertical = 0
let g:ale_list_window_size = 10
let g:ale_loclist_msg_format = '%code: %%s'
let g:ale_lsp_root = {}
let g:ale_max_buffer_history_size = 20
let g:ale_max_signs = -1
let g:ale_maximum_file_size = v:null
let g:ale_open_list = 0
let g:ale_pattern_options = v:null
let g:ale_pattern_options_enabled = v:null
let g:ale_set_balloons = 0
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = 0
let g:ale_sign_error = ' ✘'
let g:ale_sign_info = ' ●'
let g:ale_sign_offset = 1000000
let g:ale_sign_style_error = ' ✘'
let g:ale_sign_style_warning = ' ●'
let g:ale_sign_warning = ' ●'
let g:ale_sign_highlight_linenrs = 0
let g:ale_statusline_format = v:null
let g:ale_type_map = {}
let g:ale_use_global_executables = v:null
let g:ale_virtualtext_cursor = 0
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
Command History:

(executable check - failure) clang++
(finished - exit code 0) ['/usr/bin/zsh', '-c', 'cd ''/home/groctel/Documents/Repositorios/ugr-informatica/3º 1er cuatrimestre/Informática gráfica/Prácticas'' && make -n --always-make']

<<>>
mkdir -p ./obj
mkdir -p ./bin
g++ -std=c++17 -g -Wall -Wextra -Wpedantic -Wfloat-equal -I./libig -ljpeg -lGLEW -lGLU -lglut -lGL -DLINUX -c libig/globals.cpp -o obj/globals.o
g++ -std=c++17 -g -Wall -Wextra -Wpedantic -Wfloat-equal -I./libig -ljpeg -lGLEW -lGLU -lglut -lGL -DLINUX -c libig/ply.cpp -o obj/ply.o
g++ -std=c++17 -g -Wall -Wextra -Wpedantic -Wfloat-equal -I./libig -ljpeg -lGLEW -lGLU -lglut -lGL -DLINUX -c mallas/malla.cpp -o obj/malla.o
g++ -std=c++17 -g -Wall -Wextra -Wpedantic -Wfloat-equal -I./libig -ljpeg -lGLEW -lGLU -lglut -lGL -DLINUX -c mallas/obj_revolucion.cpp -o obj/obj_revolucion.o
g++ -std=c++17 -g -Wall -Wextra -Wpedantic -Wfloat-equal -I./libig -ljpeg -lGLEW -lGLU -lglut -lGL -DLINUX -c mallas/cilindro.cpp -o obj/cilindro.o
g++ -std=c++17 -g -Wall -Wextra -Wpedantic -Wfloat-equal -I./libig -ljpeg -lGLEW -lGLU -lglut -lGL -DLINUX -c mallas/cono.cpp -o obj/cono.o
g++ -std=c++17 -g -Wall -Wextra -Wpedantic -Wfloat-equal -I./libig -ljpeg -lGLEW -lGLU -lglut -lGL -DLINUX -c mallas/cubo.cpp -o obj/cubo.o
g++ -std=c++17 -g -Wall -Wextra -Wpedantic -Wfloat-equal -I./libig -ljpeg -lGLEW -lGLU -lglut -lGL -DLINUX -c src/ejes.cpp -o obj/ejes.o
g++ -std=c++17 -g -Wall -Wextra -Wpedantic -Wfloat-equal -I./libig -ljpeg -lGLEW -lGLU -lglut -lGL -DLINUX -c src/escena.cpp -o obj/escena.o
g++ -std=c++17 -g -Wall -Wextra -Wpedantic -Wfloat-equal -I./libig -ljpeg -lGLEW -lGLU -lglut -lGL -DLINUX -c mallas/esfera.cpp -o obj/esfera.o
g++ -std=c++17 -g -Wall -Wextra -Wpedantic -Wfloat-equal -I./libig -ljpeg -lGLEW -lGLU -lglut -lGL -DLINUX -c luces/luz.cpp -o obj/luz.o
g++ -std=c++17 -g -Wall -Wextra -Wpedantic -Wfloat-equal -I./libig -ljpeg -lGLEW -lGLU -lglut -lGL -DLINUX -c luces/luz_direccional.cpp -o obj/luz_direccional.o
g++ -std=c++17 -g -Wall -Wextra -Wpedantic -Wfloat-equal -I./libig -ljpeg -lGLEW -lGLU -lglut -lGL -DLINUX -c luces/luz_posicional.cpp -o obj/luz_posicional.o
g++ -std=c++17 -g -Wall -Wextra -Wpedantic -Wfloat-equal -I./libig -ljpeg -lGLEW -lGLU -lglut -lGL -DLINUX -c src/material.cpp -o obj/material.o
g++ -std=c++17 -g -Wall -Wextra -Wpedantic -Wfloat-equal -I./libig -ljpeg -lGLEW -lGLU -lglut -lGL -DLINUX -c mallas/tetraedro.cpp -o obj/tetraedro.o
g++ -std=c++17 -g -Wall -Wextra -Wpedantic -Wfloat-equal -I./libig -ljpeg -lGLEW -lGLU -lglut -lGL -DLINUX -o bin/practicas src/practicas.cpp obj/cilindro.o obj/cono.o obj/cubo.o obj/ejes.o obj/escena.o obj/esfera.o obj/globals.o obj/luz.o obj/luz_direccional.o obj/luz_posicional.o obj/malla.o obj/material.o obj/obj_revolucion.o obj/ply.o obj/tetraedro.o
<<>>

(finished - exit code 1) ['/usr/bin/zsh', '-c', '''gcc'' -S -x c++ -o /dev/null -iquote ''/home/groctel/Documents/Repositorios/ugr-informatica/3º 1er cuatrimestre/Informática gráfica/Prácticas/mallas'' -std=c++17 -Wall -Wextra -Wpedantic -Wfloat-equal - < ''/tmp/nvimdnZFv8/3/malla.hpp''']

<<>>
:12:10: fatal error: colores.hpp: No such file or directory
compilation terminated.
<<>>
```

Of course:

```
➜ find . -name "*colores*"
./libig/colores.hpp
```

Contributor guide

Open the contributing guide

Research direction

Start by tracing ALE's Makefile parsing and the `cc` linter command construction shown in ALEInfo. Reproduce the issue with `make -n` and the displayed `g++` invocation; done means the Makefile's `-I./libig` option reaches linting and `colores.hpp` resolves successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, vim
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.