microsoft / vscode-makefile-tools

MAKE integration in Visual Studio Code
Other
185 stars 55 forks source link

include errors detected based on information provided by the configurationProvider setting. (C/C++ 1696) #444

Closed asdaqsamir closed 12 months ago

asdaqsamir commented 1 year ago

I am able to build the makefile project fine using makefile extension but for some reason the includes are not being found by vscode.

My settings.json file looks like the following:

{
    "makefile.makeDirectory": "build",
    "makefile.makefilePath": "build/makefile_gcc_4.8.2_x86-64.mk",
    "makefile.makePath": "C:/ivy/keypad/lib/make/bin/make.exe",
    "makefile.configurations": [
        {
            "name": "Default",
            "makeArgs": [
                "-j",
                "15",
                "-O"
            ]
        }
    ],
    "C_Cpp.default.configurationProvider": "ms-vscode.makefile-tools"
}

See the image below for errors: image

Originally posted by @github-actions[bot] in https://github.com/microsoft/vscode-cpptools/issues/8797#issuecomment-1110883177

sean-mcmanus commented 1 year ago

This appears to be an issue related to Makefile tools. You can verify this by running C/C++: Log Diagnostics after the cml_keypad_indicator_group.c is open and look for "Custom configurations:" in the logging, which will show which "includePath" we're receiving from Makefile tools.

andreeis commented 1 year ago

@asdaqsamir , please set in your .vscode/settings.json:

"makefile.loggingLevel": "Debug", "makefile.extensionOutputFolder": "./MyOutputFolder" (or wherever you want us to create a folder or point to an existing folder where we can drop some files without causing you any inconvenience), "makefile.extensionLog": "extension.log"

Then reopen your project in VSCode, let the extension configure process finish (you can watch in the Makefile Tools output channel that logging stops and there is a "Configure finished" or similar message) then share with us these files from MyOutputFolder: dryrun.log and extension.log

Additionally, you can open the .c file in your screenshot, then run the command "C/C++ diagnostics" from the palette and share with us the text in the "C/C++ Diagnostics" output channel.

I see your "Default" configuration defined in settings.json and I assume you also selected it in the "C/C++" left panel UI (via the edit pen to the right of "Configuration" UI element).

asdaqsamir commented 1 year ago

My settings.json looks like this now:

{
    "makefile.loggingLevel": "Debug",
    "makefile.extensionOutputFolder": "build",
    "makefile.extensionLog": "extension.log",
    "makefile.makeDirectory": "build",
    "makefile.makefilePath": "build/makefile_gcc_4.8.2_x86-64.mk",
    "makefile.makePath": "C:/ivy/keypad/lib/make/bin/make.exe",
    "makefile.configurations": [
        {
            "name": "Default",
            "makeArgs": [
                "-j",
                "15",
                "-O"
            ]
        }
    ],
    "C_Cpp.default.configurationProvider": "ms-vscode.makefile-tools"
}

See attached for extension.log, dryrun.log, configurationCache.log and targets.log. configurationCache.log dryrun.log extension.log targets.log

Following output is by running the "C/C++ Log diagnostics"

-------- Diagnostics - 3/24/2023, 2:35:25 PM
Version: 1.14.5
Current Configuration:
{
    "name": "Win32",
    "includePath": [
        "c:\\ivy\\keypad\\lib\\lib_cml\\asset\\feature\\keypad\\v00/**"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE"
    ],
    "windowsSdkVersion": "10.0.19041.0",
    "cStandard": "c17",
    "cppStandard": "c++17",
    "intelliSenseMode": "windows-msvc-x64",
    "intelliSenseModeIsExplicit": false,
    "cStandardIsExplicit": false,
    "cppStandardIsExplicit": false,
    "mergeConfigurations": false,
    "compilerPath": "cl.exe",
    "compilerPathIsExplicit": false,
    "configurationProvider": "ms-vscode.makefile-tools",
    "browse": {
        "limitSymbolsToIncludedHeaders": true,
        "path": [
            "${workspaceFolder}/**"
        ]
    }
}
Custom browse configuration: 
{
    "browsePath": []
}
Custom configurations:
[ C:\ivy\keypad\lib\lib_cml\asset\feature\keypad\v00\src\cml_keypad_indicator_group.c ]
{
    "defines": [
        "HAL_XLCAN",
        "NDEBUG",
        "MODULE_PLATFORM_AR",
        "A6MX"
    ],
    "includePath": [],
    "forcedInclude": [],
    "compilerPath": "c:\\ivy\\keypad\\lib\\lib_oel\\environment\\mingw\\bin\\x86_64-w64-mingw32-gcc.exe",
    "compilerArgs": [
        "-B",
        "../../../../../..\\lib_oel\\environment\\mingw\\bin",
        "-g3",
        "-Wpacked",
        "-Wno-unknown-pragmas",
        "-Wall",
        "-fno-peephole",
        "-fshort-enums",
        "-funsigned-char",
        "-c",
        "-o",
        "do_tgt_gcc_4.8.2_x86-64/cml_keypad_indicator_group.o",
        "../src/cml_keypad_indicator_group.c"
    ]
}
Translation Unit Mappings:
[ C:\ivy\keypad\lib\lib_cml\asset\feature\keypad\v00\src\cml_keypad_indicator_group.c ]:
    C:\ivy\keypad\lib\lib_cml\asset\feature\keypad\v00\src\cml_keypad_indicator_group.c
Translation Unit Configurations:
[ C:\ivy\keypad\lib\lib_cml\asset\feature\keypad\v00\src\cml_keypad_indicator_group.c ]:
    Process ID: 20940
    Memory Usage: 46 MB
    Compiler Path: C:\ivy\keypad\lib\lib_oel\environment\mingw\bin\x86_64-w64-mingw32-gcc.exe
    Includes:
        C:\ivy\keypad\lib\lib_oel\environment\mingw\lib64\gcc\x86_64-w64-mingw32\4.8.3\include
        C:\ivy\keypad\lib\lib_oel\environment\mingw\lib64\gcc\x86_64-w64-mingw32\4.8.3\include-fixed
        C:\ivy\keypad\lib\lib_oel\environment\mingw\x86_64-w64-mingw32\include
    Defines:
        HAL_XLCAN
        NDEBUG
        MODULE_PLATFORM_AR
        A6MX
    Standard Version: c11
    IntelliSense Mode: windows-gcc-x64
    Other Flags:
        --gcc
        --gnu_version=40803
Total Memory Usage: 46 MB

I tried to edit the "Configuration" and I see the "Default" option. But when I select it, It doesn't change the Configuration, it's still showing "unset". image

However, when I build the project, it builds successfully and shows me a notification saying that it's building the current makefile configuration "Default".

Also I am not sure if it's related, but when I start vscode, the makefile does not configure automatically and I do have to use the command palette and type "Makefile: Configure", so that I can see the C++ makefile UI on the left side and than I clean and build.

sean-mcmanus commented 1 year ago

The "includePath": [], indicates the C/C++ extension isn't being sent the includePath. One potential workaround would be to add "mergeConfigurations": true and a manually configured "includePath": [] and remove the defines from "defines": [] in c_cpp_properties.json.

andreeis commented 1 year ago

@asdaqsamir by reading dryrun.log I don't see any -I arguments passed to the compiler. We have no way of knowing where you expect to include headers from. That's why Makefile Tools passes [] include paths to CppTools. Are the headers at the same location as the cml_keypad_indicator_group.c? Otherwise how is the build (which you say succeeds) knows to find them?

asdaqsamir commented 1 year ago

@andreeis The project has been setup in a way that it depends on other makefiles (some people call them makelets), the most important of these makefiles are the includes.mk and lib.mk located in the build folder:

build: contains all the makefiles that are needed to build the makefile project

Note that most of the makefile project is stitched together in $(VOB_ROOT)/lib_machine/tools/makefile/makefile_sim_win64.mk which is added at the end of makefile_gcc_4.8.2_x86-64.mk for the purpose of compiling within a common makefile architecture. In this makeflile, all the internal and external includes come together using the variables INC_PATHS_INT and INC_PATHS_EXT.

You can see all the files in the pic below: image

Also not sure if it's related but in the output tab of vscode, I see the following error message after successfully building the project.

Error: the task 'makefile: Makefile Tools Build Task' neither specifies a command nor a dependsOn property. The task will be ignored. Its definition is:
{
    "type": "shell",
    "id": "shell,C:\\ivy\\keypad\\lib\\make\\bin\\make.exe,-f,c:\\ivy\\keypad\\lib\\lib_cml\\asset\\feature\\keypad\\v00\\build\\makefile_gcc_4.8.2_x86-64.mk,-C,c:\\ivy\\keypad\\lib\\lib_cml\\asset\\feature\\keypad\\v00\\build,-j,15,-O,",
    "problemMatcher": [],
    "label": "makefile: Makefile Tools Build Task"
}

And the Terminal tab shows the following showing a successful build and copying the .a file:

 *  Executing task: & 'C:\ivy\keypad\lib\make\bin\make.exe' '-f' 'c:\ivy\keypad\lib\lib_cml\asset\feature\keypad\v00\build\makefile_gcc_4.8.2_x86-64.mk' '-C' 'c:\ivy\keypad\lib\lib_cml\asset\feature\keypad\v00\build' '-j' '15' '-O' 

make: Entering directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build'
creating do_tgt_gcc_4.8.2_x86-64
if not exist do_tgt_gcc_4.8.2_x86-64 mkdir do_tgt_gcc_4.8.2_x86-64
make: Leaving directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build'
make: Entering directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build'
making do_tgt_gcc_4.8.2_x86-64/inc_all_opts.txt compiler include options file ...
make: Leaving directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build'
"C:/ivy/keypad/lib/make/bin/make" --no-print-directory -s -B -f ../../../../../../lib_machine/tools/makefile/helper_echo.mk goal=TGT_INC_ALL_OPTS TGT_INC_ALL_OPTS > do_tgt_gcc_4.8.2_x86-64/inc_all_opts.txt
make: Entering directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build'
making do_tgt_gcc_4.8.2_x86-64/.objects object files list file ...
make: Leaving directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build'
"C:/ivy/keypad/lib/make/bin/make" --no-print-directory -s -B -f ../../../../../../lib_machine/tools/makefile/helper_echo.mk goal=OBJ_FILES OBJ_FILES > do_tgt_gcc_4.8.2_x86-64/.objects
make: Entering directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build'
../src/cml_keypad_comm_mngr.c do_tgt_gcc_4.8.2_x86-64/cml_keypad_comm_mngr.o
..\..\..\..\..\..\lib_oel\environment\mingw\bin\x86_64-w64-mingw32-gcc.exe -B ../../../../../..\lib_oel\environment\mingw\bin -g3 -Wpacked -Wno-unknown-pragmas -Wall -fno-peephole -fshort-enums -funsigned-char -c -DHAL_XLCAN -DNDEBUG -DMODULE_PLATFORM_AR -DA6MX   @do_tgt_gcc_4.8.2_x86-64/inc_all_opts.txt -o do_tgt_gcc_4.8.2_x86-64/cml_keypad_comm_mngr.o 
../src/cml_keypad_comm_mngr.c
make: Leaving directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build'
make: Entering directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build'
../src/cml_keypad_switch.c do_tgt_gcc_4.8.2_x86-64/cml_keypad_switch.o
..\..\..\..\..\..\lib_oel\environment\mingw\bin\x86_64-w64-mingw32-gcc.exe -B ../../../../../..\lib_oel\environment\mingw\bin -g3 -Wpacked -Wno-unknown-pragmas -Wall -fno-peephole -fshort-enums -funsigned-char -c -DHAL_XLCAN -DNDEBUG -DMODULE_PLATFORM_AR -DA6MX   @do_tgt_gcc_4.8.2_x86-64/inc_all_opts.txt -o do_tgt_gcc_4.8.2_x86-64/cml_keypad_switch.o ../src/cml_keypad_switch.c
make: Leaving directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build'
make: Entering directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build'
../src/cml_keypad_switch_proc.c do_tgt_gcc_4.8.2_x86-64/cml_keypad_switch_proc.o 
..\..\..\..\..\..\lib_oel\environment\mingw\bin\x86_64-w64-mingw32-gcc.exe -B ../../../../../..\lib_oel\environment\mingw\bin -g3 -Wpacked -Wno-unknown-pragmas -Wall -fno-peephole -fshort-enums -funsigned-char -c -DHAL_XLCAN -DNDEBUG -DMODULE_PLATFORM_AR -DA6MX   @do_tgt_gcc_4.8.2_x86-64/inc_all_opts.txt -o do_tgt_gcc_4.8.2_x86-64/cml_keypad_switch_proc.o ../src/cml_keypad_switch_proc.c
../src/cml_keypad_switch_proc.c: In function 'cml_keypad_switch_proc_set_state':
../src/cml_keypad_switch_proc.c:232:51: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
             nvm_block_write( wp->nv_handle, 0, 0, (uint8_t *)wp->nv_state, NVM_CURRENT_TASK_PRIORITY );
                                                   ^
../src/cml_keypad_switch_proc.c: In function 'cml_keypad_switch_proc_init_nv':
../src/cml_keypad_switch_proc.c:298:13: warning: variable 'out_state' set but not used [-Wunused-but-set-variable]
     SData_t out_state = {0, DATA_STATUS_OK};
             ^
../src/cml_keypad_switch_proc.c: In function 'cml_keypad_switch_proc_update':
../src/cml_keypad_switch_proc.c:450:67: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
                             nvm_block_write( wp->nv_handle, 0, 0, (uint8_t *)wp->nv_state, NVM_CURRENT_TASK_PRIORITY );
                                                                   ^
../src/cml_keypad_switch_proc.c:497:63: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
                         nvm_block_write( wp->nv_handle, 0, 0, (uint8_t *)wp->nv_state, NVM_CURRENT_TASK_PRIORITY );
                                                               ^
make: Leaving directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build'
make: Entering directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build'
../src/cml_keypad_switch_group.c do_tgt_gcc_4.8.2_x86-64/cml_keypad_switch_group.o
..\..\..\..\..\..\lib_oel\environment\mingw\bin\x86_64-w64-mingw32-gcc.exe -B ../../../../../..\lib_oel\environment\mingw\bin -g3 -Wpacked -Wno-unknown-pragmas -Wall -fno-peephole -fshort-enums -funsigned-char -c -DHAL_XLCAN -DNDEBUG -DMODULE_PLATFORM_AR -DA6MX   @do_tgt_gcc_4.8.2_x86-64/inc_all_opts.txt -o do_tgt_gcc_4.8.2_x86-64/cml_keypad_switch_group.o ../src/cml_keypad_switch_group.c
make: Leaving directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build'
make: Entering directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build'
../src/cml_keypad_illumination.c do_tgt_gcc_4.8.2_x86-64/cml_keypad_illumination.o 
..\..\..\..\..\..\lib_oel\environment\mingw\bin\x86_64-w64-mingw32-gcc.exe -B ../../../../../..\lib_oel\environment\mingw\bin -g3 -Wpacked -Wno-unknown-pragmas -Wall -fno-peephole -fshort-enums -funsigned-char -c -DHAL_XLCAN -DNDEBUG -DMODULE_PLATFORM_AR -DA6MX   @do_tgt_gcc_4.8.2_x86-64/inc_all_opts.txt -o do_tgt_gcc_4.8.2_x86-64/cml_keypad_illumination.o ../src/cml_keypad_illumination.c
make: Leaving directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build'
make: Entering directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build'
../src/cml_keypad_indicator_proc.c do_tgt_gcc_4.8.2_x86-64/cml_keypad_indicator_proc.o 
..\..\..\..\..\..\lib_oel\environment\mingw\bin\x86_64-w64-mingw32-gcc.exe -B ../../../../../..\lib_oel\environment\mingw\bin -g3 -Wpacked -Wno-unknown-pragmas -Wall -fno-peephole -fshort-enums -funsigned-char -c -DHAL_XLCAN -DNDEBUG -DMODULE_PLATFORM_AR -DA6MX   @do_tgt_gcc_4.8.2_x86-64/inc_all_opts.txt -o do_tgt_gcc_4.8.2_x86-64/cml_keypad_indicator_proc.o ../src/cml_keypad_indicator_proc.c
make: Leaving directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build'
make: Entering directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build'
../src/cml_keypad_indicator.c do_tgt_gcc_4.8.2_x86-64/cml_keypad_indicator.o
..\..\..\..\..\..\lib_oel\environment\mingw\bin\x86_64-w64-mingw32-gcc.exe -B ../../../../../..\lib_oel\environment\mingw\bin -g3 -Wpacked -Wno-unknown-pragmas -Wall -fno-peephole -fshort-enums -funsigned-char -c -DHAL_XLCAN -DNDEBUG -DMODULE_PLATFORM_AR -DA6MX   @do_tgt_gcc_4.8.2_x86-64/inc_all_opts.txt -o do_tgt_gcc_4.8.2_x86-64/cml_keypad_indicator.o 
../src/cml_keypad_indicator.c
make: Leaving directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build'
make: Entering directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build'
../src/cml_keypad_indicator_group.c do_tgt_gcc_4.8.2_x86-64/cml_keypad_indicator_group.o 
..\..\..\..\..\..\lib_oel\environment\mingw\bin\x86_64-w64-mingw32-gcc.exe -B ../../../../../..\lib_oel\environment\mingw\bin -g3 -Wpacked -Wno-unknown-pragmas -Wall -fno-peephole -fshort-enums -funsigned-char -c -DHAL_XLCAN -DNDEBUG -DMODULE_PLATFORM_AR -DA6MX   @do_tgt_gcc_4.8.2_x86-64/inc_all_opts.txt -o do_tgt_gcc_4.8.2_x86-64/cml_keypad_indicator_group.o ../src/cml_keypad_indicator_group.c
make: Leaving directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build'
make: Entering directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build'
Making do_tgt_gcc_4.8.2_x86-64\libcml_keypad.a...
..\..\..\..\..\..\lib_oel\environment\mingw\bin\ar -r do_tgt_gcc_4.8.2_x86-64\libcml_keypad.a @do_tgt_gcc_4.8.2_x86-64/.objects
..\..\..\..\..\..\lib_oel\environment\mingw\bin\ar: creating do_tgt_gcc_4.8.2_x86-64\libcml_keypad.a
make: Leaving directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build'
make: Entering directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build'
Copying do_tgt_gcc_4.8.2_x86-64\libcml_keypad.a to ..\\..\\v00-a\\tgt_gcc_4.8.2_x86-64\libcml_keypad.a 
        1 file(s) copied.
make: Leaving directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build'
asdaqsamir commented 1 year ago

@sean-mcmanus I tried the workaround, it takes care of the problem originally reported of not being able to find the include files. Now I can go to definition of the included header files, however this approach is not very desired because for other makefile projects I would have to take all the include paths from includes.mk and add them to the c_cpp_properties.json.

Also note, I am unable to use certain functionality when I right click. For example, clicking on "Switch Header/Source" does not do anything.

c_cpp_properties.json looks like this now:

{
    "configurations": [
        {
            "name": "Default",
            "includePath": [
                "include",
                "../../../../../lib_cml/asset/base/v00/include",
                "../../../../../lib_cml/asset/interface/v00/include",
                "../../../../../lib_oel/oel/include",
                "../../../../../lib_oel/oel/include_oeluk",
                "../../../../../lib_a4/scl/include",
                "../../../../../lib_a4/hal/include",
                "../../../../../lib_standards/c/include"
            ],
            "configurationProvider": "ms-vscode.makefile-tools"
        }
    ],
    "version": 4
}

settings.json looks like this now:

{
    "makefile.loggingLevel": "Debug",
    "makefile.extensionOutputFolder": ".vscode",
    "makefile.extensionLog": "extension.log",
    "makefile.makeDirectory": "build",
    "makefile.makefilePath": "build/makefile_gcc_4.8.2_x86-64.mk",
    "makefile.makePath": "C:/ivy/keypad/lib/make/bin/make.exe",
    "makefile.configurations": [
        {
            "name": "Default",
            "makeArgs": [
                "-j",
                "15",
                "-O"
            ]
        }
    ],
    "C_Cpp.default.configurationProvider": "ms-vscode.makefile-tools",
    "C_Cpp.default.mergeConfigurations": true
}

and the "C/C++ Diagnostic Log" looks like this:

-------- Diagnostics - 3/25/2023, 8:30:42 AM
Version: 1.14.5
Current Configuration:
{
    "name": "Default",
    "includePath": [
        "c:\\ivy\\keypad\\lib\\lib_cml\\asset\\feature\\keypad\\v00\\include",
        "c:\\ivy\\keypad\\lib\\lib_cml\\asset\\base\\v00\\include",
        "c:\\ivy\\keypad\\lib\\lib_cml\\asset\\interface\\v00\\include",
        "c:\\ivy\\keypad\\lib\\lib_oel\\oel\\include",
        "c:\\ivy\\keypad\\lib\\lib_oel\\oel\\include_oeluk",
        "c:\\ivy\\keypad\\lib\\lib_a4\\scl\\include",
        "c:\\ivy\\keypad\\lib\\lib_a4\\hal\\include",
        "c:\\ivy\\keypad\\lib\\lib_standards\\c\\include"
    ],
    "configurationProvider": "ms-vscode.makefile-tools",
    "compilerPathIsExplicit": false,
    "cStandardIsExplicit": false,
    "cppStandardIsExplicit": false,
    "intelliSenseModeIsExplicit": false,
    "macFrameworkPath": [],
    "windowsSdkVersion": "10.0.19041.0",
    "cStandard": "c17",
    "cppStandard": "c++17",
    "intelliSenseMode": "windows-msvc-x64",
    "mergeConfigurations": true,
    "compilerPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Professional\\VC\\Tools\\MSVC\\14.29.30133\\bin\\Hostx64\\x64\\cl.exe",
    "browse": {
        "path": [
            "include",
            "../../../../../lib_cml/asset/base/v00/include",
            "../../../../../lib_cml/asset/interface/v00/include",
            "../../../../../lib_oel/oel/include",
            "../../../../../lib_oel/oel/include_oeluk",
            "../../../../../lib_a4/scl/include",
            "../../../../../lib_a4/hal/include",
            "../../../../../lib_standards/c/include",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Custom browse configuration: 
{
    "browsePath": []
}
Translation Unit Mappings:
[ C:\ivy\keypad\lib\lib_cml\asset\feature\keypad\v00\src\cml_keypad_comm_mngr.c ]:
    C:\ivy\keypad\lib\lib_cml\asset\feature\keypad\v00\src\cml_keypad_comm_mngr.c
[ C:\ivy\keypad\lib\lib_cml\asset\feature\keypad\v00\src\cml_keypad_indicator_group.c ]:
    C:\ivy\keypad\lib\lib_cml\asset\feature\keypad\v00\src\cml_keypad_indicator_group.c
Translation Unit Configurations:
[ C:\ivy\keypad\lib\lib_cml\asset\feature\keypad\v00\src\cml_keypad_comm_mngr.c ]:
    Process ID: 15576
    Memory Usage: 57 MB
    Compiler Path: C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64\cl.exe
    Includes:
        C:\ivy\keypad\lib\lib_cml\asset\feature\keypad\v00\include
        C:\ivy\keypad\lib\lib_cml\asset\base\v00\include
        C:\ivy\keypad\lib\lib_cml\asset\interface\v00\include
        C:\ivy\keypad\lib\lib_oel\oel\include
        C:\ivy\keypad\lib\lib_oel\oel\include_oeluk
        C:\ivy\keypad\lib\lib_a4\scl\include
        C:\ivy\keypad\lib\lib_a4\hal\include
        C:\ivy\keypad\lib\lib_standards\c\include
        C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include
        C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\atlmfc\include
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\winrt
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt
    Standard Version: ms_c17
    IntelliSense Mode: windows-msvc-x64
[ C:\ivy\keypad\lib\lib_cml\asset\feature\keypad\v00\src\cml_keypad_indicator_group.c ]:
    Process ID: 2064
    Memory Usage: 56 MB
    Compiler Path: C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64\cl.exe
    Includes:
        C:\ivy\keypad\lib\lib_cml\asset\feature\keypad\v00\include
        C:\ivy\keypad\lib\lib_cml\asset\base\v00\include
        C:\ivy\keypad\lib\lib_cml\asset\interface\v00\include
        C:\ivy\keypad\lib\lib_oel\oel\include
        C:\ivy\keypad\lib\lib_oel\oel\include_oeluk
        C:\ivy\keypad\lib\lib_a4\scl\include
        C:\ivy\keypad\lib\lib_a4\hal\include
        C:\ivy\keypad\lib\lib_standards\c\include
        C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include
        C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\atlmfc\include
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\winrt
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt
    Standard Version: ms_c17
    IntelliSense Mode: windows-msvc-x64
Total Memory Usage: 113 MB

Also note that this error still shows up in the Output tab of vscode:

Error: the task 'makefile: Makefile Tools Build Task' neither specifies a command nor a dependsOn property. The task will be ignored. Its definition is:
{
    "type": "shell",
    "id": "shell,C:\\ivy\\keypad\\lib\\make\\bin\\make.exe,-f,c:\\ivy\\keypad\\lib\\lib_cml\\asset\\feature\\keypad\\v00\\build\\makefile_gcc_4.8.2_x86-64.mk,-C,c:\\ivy\\keypad\\lib\\lib_cml\\asset\\feature\\keypad\\v00\\build,-j,15,-O,",
    "problemMatcher": [],
    "label": "makefile: Makefile Tools Build Task"
}
asdaqsamir commented 1 year ago

I just wanted to thank you for all your help with this issue.

A side question, in "C/C++ Diagnostic Log" why does it show properties of windows compiler even though I am using gcc as the compiler in the makefile make path? The log above shows Visual Studio 2019 Professional includes and compiler paths.

andreeis commented 1 year ago

@asdaqsamir , currently the extension parses only "make --dry-run" output log and finds only paths given to /I /FI compiler switches. We have a work item to include things given via the "INCLUDE" environment variable (which the microsoft MSVC toolset like cl.exe uses). I can't find the GitHub issue now to reference it. Until I find it, I will use this issue you opened (which otherwise I would have closed it as by design). We can add your variables to it (or add a setting for users to mention that it represents an INCLUDE environment variable setting). We don't know when we can get to implement this support (parse include paths from key environment variables but we will triage soon and let you know).

The error in the tasks output channel is something new, not caused by us, I opened a work item towards the VSCode team: https://github.com/microsoft/vscode/issues/176670.

@sean-mcmanus I'll let you answer the last question about compiler gcc and diagnostics log.

asdaqsamir commented 1 year ago

@andreeis thank you for considering this as a feature, (possibly https://github.com/microsoft/vscode-makefile-tools/issues/185) but I think these are make variables and not environment variables. I am sure it will help others out there, I did a quick search on google for "how to add include path to makefile" and the first link is to this https://stackoverflow.com/questions/4134764/how-to-define-several-include-path-in-makefile (posted 12 years ago) and many upvotes. In summary, following are three possible solutions using make variables:

INC=$(DIR1) $(DIR2) ...
INC_PARAMS=$(foreach d, $(INC), -I$d)
or
INC_PARAMS=$(INC:%=-I%)
or
INC_PARAMS = $(addprefix -I,$(INC))

I think we are using the last one of the three using addprefix.

Also, now that I realize that it's parsing dryrun.log, I did a dry run using the following command in powershell: C:\ivy\keypad\lib\make\bin\make.exe -f makefile_gcc_4.8.2_x86-64.mk --dry-run --always-make --keep-going --print-directory

and I got the following output:

make: Entering directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build'
echo creating do_tgt_gcc_4.8.2_x86-64
if not exist do_tgt_gcc_4.8.2_x86-64 mkdir do_tgt_gcc_4.8.2_x86-64
echo making do_tgt_gcc_4.8.2_x86-64/.objects object files list file ...
"C:/ivy/keypad/lib/make/bin/make" --no-print-directory -s -B -f ../../../../../../lib_machine/tools/makefile/helper_echo.mk goal=OBJ_FILES OBJ_FILES > do_tgt_gcc_4.8.2_x86-64/.objects
The system cannot find the path specified.
../../../../../../lib_machine/tools/makefile/makefile_sim_win64.mk:402: recipe for target 'do_tgt_gcc_4.8.2_x86-64/.objects' failed
make: *** [do_tgt_gcc_4.8.2_x86-64/.objects] Error 1
echo making do_tgt_gcc_4.8.2_x86-64/inc_all_opts.txt compiler include options file ...
"C:/ivy/keypad/lib/make/bin/make" --no-print-directory -s -B -f ../../../../../../lib_machine/tools/makefile/helper_echo.mk goal=TGT_INC_ALL_OPTS TGT_INC_ALL_OPTS > do_tgt_gcc_4.8.2_x86-64/inc_all_opts.txt
The system cannot find the path specified.
../../../../../../lib_machine/tools/makefile/helper_common_rules.mk:332: recipe for target 'do_tgt_gcc_4.8.2_x86-64/inc_all_opts.txt' failed
make: *** [do_tgt_gcc_4.8.2_x86-64/inc_all_opts.txt] Error 1
make: Leaving directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build'

Looks like it's not able to find certain directories, strange because it builds just fine if I just remove the --dry-run option in there

sean-mcmanus commented 1 year ago

The switch header source issue is probably https://github.com/microsoft/vscode-cpptools/issues/2635 .

Makefile Tools isn't sending the compilerPath, which is why the compiler is cl instead of gcc. It's possible you might be able to set the compilerPath explicitly that case in c_cpp_properties.json or C_Cpp.default.compilerPath, but I don't remember if it'll be used with the configurationProvider set (since normally it's taken from that).

andreeis commented 1 year ago

@sean-mcmanus , why do you say Makefile Tools is not sending the compiler path? I see in the attached (above) extension.log that we parse correctly the path to Compiler Path: c:\ivy\keypad\lib\lib_oel\environment\mingw\bin\x86_64-w64-mingw32-gcc.exe

@asdaqsamir , thank you for the extra details about the various possibilities to define the INCLUDES. We will address all those scenarios to increase the coverage and adoption of the extension. I'll research myself too when we get to that, but in case you know already or is close and handy to you, if you know of any other similar concepts like for libraries or what else make can accept via environment variables and via make variables, we don't mind if you flood us with links :). For example, for the Microsoft MSVSC toolset, the cl.exe/link.exe accept INCLUDE environment variable but also LIB, LINK and few others, which are alternatives to compiler/linker switch arguments and some devs use them.

sean-mcmanus commented 1 year ago

I'm referring to the logging from comment https://github.com/microsoft/vscode-makefile-tools/issues/444#issuecomment-1483825930, which has no configuration provider info being sent for some reason. I don't see the compiler path logging you're referring to, but if it shows the compiler path is being sent with the custom configuration then then it should be using that instead of cl.exe.

andreeis commented 12 months ago

@asdaqsamir , I recorded the info about the make variables capable of providing additional include info in issue 130 and otherwise, for this current ticket, I am closing it since after another read it looks that we answered all the questions that have been asked. If you still see the issue with the configuration provider not being sent (or not sending compiler path), as Sean noticed in some of the earlier provided logs... then please reactivate and send us one more set of logs to have a look on the freshest state of your project.