espressif / idf-eclipse-plugin

Espressif-IDE (based on Eclipse CDT) for ESP-IDF CMake based projects 4.x and above
Eclipse Public License 2.0
305 stars 121 forks source link

hello_word example builds with 15 errors in Eclipse's Problem tab, partly outside desired output build directory (IEP-809) #632

Open JBHunterI opened 1 year ago

JBHunterI commented 1 year ago

I built your hello_world example from the ESP-IDF Eclipse Plugin v2.7.0 with no changes, & it caused the Problem tab to fill with 15 errors, the comes-up with this pop-up when you try to run it, although it seems to run fine: image

Also, I tried to specify an output directory other than "build", and it still created a "build" directory with only an "ide" directory in it: ------------------------------------ Eclipse 'Console' tab: CDT Global Build Console Building in: C:...\eclipseESP_ws\hello_world\build Configuring in: C:...\eclipseESP_ws\hello_world\build cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=C:\App\ESP\esp-idf-v5.0\tools\cmake\toolchain-esp32c3.cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCCACHE_ENABLE=1 -DIDF_TARGET=esp32c3 -B C:...\eclipseESP_ws\hello_world\Release C:...\eclipseESP_ws\hello_world -- Found Git: C:/App/ESP/tools/idf-git/2.34.2/cmd/git.exe (found version "2.34.1.windows.1") -- ccache will be used for faster recompilation -- The C compiler identification is GNU 11.2.0 -- The CXX compiler identification is GNU 11.2.0 -- The ASM compiler identification is GNU -- Found assembler: C:/App/ESP/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/riscv32-esp-elf-gcc.exe -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/App/ESP/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/riscv32-esp-elf-gcc.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/App/ESP/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/riscv32-esp-elf-g++.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Project is not inside a git repository, or git repository has no commits; will not use 'git describe' to determine PROJECT_VER. -- Building ESP-IDF components for target esp32c3 -- Checking Python dependencies... Constraint file: C:\App\ESP\espidf.constraints.v5.0.txt Requirement files:

Used stat D/IRAM: 52084 bytes ( 273036 remain, 16.0% used)

  .data size:    5312 bytes

  .bss  size:    3712 bytes

  .text size:   43060 bytes

Used Flash size : 107864 bytes

  .text     :   79072 bytes

  .rodata   :   28536 bytes

Total image size: 156236 bytes (.bin may be padded larger)

C:\App\ESP\python_env\idf5.0_py3.8_env\Scripts\python.exe C:\App\ESP\esp-idf-v5.0\components\partition_table\gen_esp32part.py C:...\eclipseESP_ws\hello_world\Release\partition_table\partition-table.bin Total time taken to build the project: 145,853 ms

------------------------------------ Eclipse 'Problems' tab: (15 errors, 0 warnings, 0 others) Field 'cores' could not be resolved /hello_world/main/hello_world_main.c line 24 Field 'features' could not be resolved /hello_world/main/hello_world_main.c line 25 Field 'features' could not be resolved /hello_world/main/hello_world_main.c line 26 Field 'features' could not be resolved /hello_world/main/hello_world_main.c line 35 Field 'revision' could not be resolved /hello_world/main/hello_world_main.c line 28 Symbol 'CHIP_FEATURE_BLE' could not be resolved /hello_world/main/hello_world_main.c line 26 Symbol 'CHIP_FEATURE_BT' could not be resolved /hello_world/main/hello_world_main.c line 25 Symbol 'CHIP_FEATURE_EMB_FLASH' could not be resolved /hello_world/main/hello_world_main.c line 35 Symbol 'CONFIG_IDF_TARGET' could not be resolved /hello_world/main/hello_world_main.c line 23 Symbol 'ESP_OK' could not be resolved /hello_world/main/hello_world_main.c line 29 Symbol 'NULL' could not be resolved /hello_world/main/hello_world_main.c line 29 Symbol 'portTICK_PERIOD_MS' could not be resolved /hello_world/main/hello_world_main.c line 41 Symbol 'stdout' could not be resolved /hello_world/main/hello_world_main.c line 44 Type 'esp_chip_info_t' could not be resolved /hello_world/main/hello_world_main.c line 19 Type 'uint32_t' could not be resolved /hello_world/main/hello_world_main.c line 20

------------------------------------ from a CMD shell: C:...\eclipseESP_ws\hello_world> dir Volume in drive C is OSDISK Volume Serial Number is E81B-E90D

Directory of C:...\eclipseESP_ws\hello_world

11/15/2022 11:40 AM

. 11/15/2022 11:40 AM .. 11/10/2022 05:14 PM 896 .cproject 11/15/2022 11:38 AM 152,528 .project 11/10/2022 05:14 PM .settings 11/15/2022 11:38 AM build <--- ?!?!?!? 11/15/2022 11:26 AM 357 CMakeLists.txt 11/15/2022 11:40 AM 0 log.txt <--- this file 11/10/2022 05:14 PM main 11/15/2022 11:26 AM 649 pytest_hello_world.py 11/15/2022 11:26 AM 2,394 README.md 11/15/2022 11:38 AM Release <--- specified output build directory 11/15/2022 11:36 AM 47,805 sdkconfig 11/15/2022 11:26 AM 0 sdkconfig.ci 8 File(s) 204,629 bytes 6 Dir(s) 300,690,399,232 bytes free

C:...\eclipseESP_ws\hello_world> dir build Volume in drive C is OSDISK Volume Serial Number is E81B-E90D

Directory of C:...\eclipseESP_ws\hello_world\build

11/15/2022 11:38 AM

. 11/15/2022 11:38 AM .. 11/15/2022 11:38 AM ide 0 File(s) 0 bytes 3 Dir(s) 301,544,120,320 bytes free

C:..\eclipseESP_ws\hello_world> dir build\ide Volume in drive C is OSDISK Volume Serial Number is E81B-E90D

Directory of C:...\eclipseESP_ws\hello_world\build\ide

11/15/2022 11:38 AM

. 11/15/2022 11:38 AM .. 11/15/2022 11:38 AM esp_idf_components 0 File(s) 0 bytes 3 Dir(s) 301,544,120,320 bytes free

C:...\eclipseESP_ws\hello_world> dir /ad Release Volume in drive C is OSDISK Volume Serial Number is E81B-E90D

Directory of C:...\eclipseESP_ws\hello_world\Release <--- where all output is supposed to go

11/15/2022 11:38 AM

. 11/15/2022 11:38 AM .. 11/15/2022 11:38 AM bootloader 11/15/2022 11:36 AM bootloader-prefix 11/15/2022 11:38 AM CMakeFiles 11/15/2022 11:36 AM config 11/15/2022 11:36 AM esp-idf 11/15/2022 11:36 AM partition_table 0 File(s) 0 bytes 8 Dir(s) 300,690,464,768 bytes free

C:...\eclipseESP_ws\hello_world>

I confirmed the exact same project built with idf.py -B from the ESP-IDF CMD shell doesn't create this build\ide\esp-idf-components directory structure in the root of the example project. I'm worried this will interfere with anything I build in the "build" directory, as your build_system -> cmake -> multi_config example will have me do. Any ideas?

prj commented 1 year ago

Same here. Installed just the ESP IDF tools, created a project from example template, and nothing gets resolved. IDE unusable.

I am going to try VSCode, if you look at this issue then it has been unsolved for years now, and getting this plugin to work is some voodoo dance of finding the very special Eclipse version where it works.

Even the espressif-ide installed with their own installer has this problem with Hello World. So this plugin is unusable in reality.

JBHunterI commented 1 year ago

I've been told VSCode/PlatformIO isn't an option since Espressif seems to have chosen to only officially support Eclipse as the graphical IDE. I'm now trying to use only the ESP-IDF shell command-line tools to build & write to Flash (ex: idf.py build/menuconfig/flash) and debug using openocd + gdbgui/gdbtui. That leaves me free to use my favorite editor/IDE to manage the source files, and only deal with ESP-IDF issues. I'll still have to make sure everyone else in my dev team will be able to do use what I check-in with this IDF Eclipse Plugin, but at at least I won't have to deal with its instability. This workflow is also more portable between development workstation OS's (Windows, Linux, macOS).

prj commented 1 year ago

I tried VSCode, and it's even worse. If you try to follow what it says, then it doesn't even build. There are no error messages, just lots of things that do absolutely nothing.

I managed to get the Eclipse to work. I think they screwed it up bigtime at some point. The solution is to use the 2.4.2 version. I am even using v5.0 tools with it.

All I did was remove the 2.7.0 that came with the tools, and drop the 2.4.2 in there instead. Build the project and no errors or problems, everything gets resolved just fine. Here is a link: https://github.com/espressif/idf-eclipse-plugin/releases/tag/v2.4.2

Get the relevant whole distro under "Espressif IDE" for your OS. See if the issue is solved for you as well this way. It's like it is magic. Just works. 2.6.0 also has the same issue, I did not try 2.5.0. I am testing with the softAP project on an ESP32-S3.

kolipakakondal commented 1 year ago

Hi @prj I am sorry that it didn't work out of the box. Would you mind dropping a mail to ide.support@espressif.com so that we could connect over Zoom/Teams(whatever works for you) and understand more about your issue?

kolipakakondal commented 1 year ago

Hi @JBHunterI

By default build output is written to /project-path/build directory. However, you should be able to change this using the build configuration window through CMake arguments as specified here

But there is a catch here, even if you specify a different build directory you still find the /project/build/ide/esp_idf_components folder to support editor source code navigation. Please remember actual build-generated artifacts will be written to the custom build directory which you have specified, for example in your case /project/release. There shouldn't be a problem with this in resolving headers and indexing. Anyway, will provide a fix for this as soon as possible.

If you still have a problem with unresolved headers, please provide us with a sample example so that we could verify.

Thanks

prj commented 1 year ago

@kolipakakondal I do not do anything special whatsoever. I simply installed using the Windows online installer, and installed also esp IDE. Then started it from c:\Espressif\tools\Espressif-IDE. After that I created a project based on SoftAP template. After first build everything is resolved, after a second build nothing is anymore. I did not modify any settings.

Then I deleted my workspace, and tried the same exact process by installing the plugin on Eclipse 2022-12, from the update site and pointing to the already existing tools, with the exact same result. I actually tried this multiple times, thinking I am doing something wrong.

I then again deleted the workspace, downloaded 2.4.2, removed the current espressif-ide folder and placed 2.4.2 there instead. Again created a new SoftAP template based project, built it, and now everything stayed resolved also after multiple consecutive builds and flashes.

I don't think any remote is necessary, you clearly introduced some kind of bug after 2.4.2 (or maybe 2.5.0, I don't know). This issue is widely reported on your own forums, on reddit and other places. I am not the only one with the issue. Either way, I will stick with 2.4.2 for now, as I can start to get work done instead of fighting with the development environment.

kolipakakondal commented 1 year ago

Then I deleted my workspace, and tried the same exact process by installing the plugin on Eclipse 2022-12, from the update site and pointing to the already existing tools, with the exact same result.

Eclipse CDT 2022-12 is a new release that is not yet supported by the plugin. I would recommend using Eclipse CDT 2022-09 and 06 versions. Will keep you posted on the new eclipse version support availability.

kolipakakondal commented 1 year ago

@kolipakakondal I do not do anything special whatsoever. I simply installed using the Windows online installer, and installed also esp IDE. Then started it from c:\Espressif\tools\Espressif-IDE. After that I created a project based on SoftAP template. After first build everything is resolved, after a second build nothing is anymore. I did not modify any settings.

I was trying to test this issue on Windows and macOS and I couldn't reproduce this issue. Maybe something else is missing.

Tested environment:

Just in case if it's useful I have uploaded a recording of this complete scenario starting from downloading Espressif IDE v2.7.0 ESP-IDF Windows Installer to building a project. https://www.youtube.com/watch?v=gU3UHvOyvLE

prj commented 1 year ago

I can tell you right away what I did differently, I started with the online installer and I used toolset 5.0. Not the 2nd installer you selected.

Not sure if that affects anything. 2.4.2 is working perfectly for me, and I am using that for now.

If I will have time, I will record the full installation process for you... but I don't really want to break my existing setup.

kolipakakondal commented 1 year ago

I did further testing with the Online installer

Anyway if you come across the same error please share us the sample project, error log, and parser log.

prj commented 1 year ago

Did you use the default workspace location or a different, new workspace location? Also, I use ESP32-S3 target. But I think target did not matter.

kolipakakondal commented 1 year ago

Did you use the default workspace location or a different, new workspace location? Also, I use ESP32-S3 target. But I think target did not matter.

I was using the new workspace location and tried with esp32-s3 as well.

kolipakakondal commented 1 year ago

My bad, there seems to be an issue with the Hello_world template with esp-idf v5.0(not earlier versions). I could find some unresolved symbols. Let us work on this.

Thanks for all the pointers.

Workaround: Unresolved symbol issues from Hello-world disappear if we move esp_chip_info.h import statement to the top

kolipakakondal commented 1 year ago

We got more leads on this issue - In IDF v5.0, It was upgraded from -std=gnu++11 to -std=gnu++20, and also upgraded the compiler to the version which supports C++20. Unfortunately, neither Eclipse CDT nor IDF Eclipse plugin has the support for the C++20 language features hence CDT Parser is unable to parse certain files where the new C++20 features are used. That's the reason, you see unresolved symbol issues on certain files with IDF v5.0 but not with the earlier versions of IDF.

For someone If you don't need esp-idf v5.0, you can switch back to v4.4.3 until we get a fix for this.

I will keep you posted!

p.s:

This is where the CDT Parser is going wrong org.eclipse.cdt.internal.core.parser.ParserException: Encountered an ambiguous node "std::uses_allocator_construction_args<_Tp1>(__a, std::forward<_Up>(__u))" at /Users/kondal/.espressif/tools/xtensa-esp32-elf/esp-2022r1-11.2.0/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/11.2.0/bits/uses_allocator_args.h, line 170 while parsing /Users/kondal/esp/esp-idf/components/nvs_flash/src/nvs_api.cpp at

C++14 and C++20 feature support bugs https://bugs.eclipse.org/bugs/show_bug.cgi?id=551720 https://bugs.eclipse.org/bugs/show_bug.cgi?id=451086

JBHunterI commented 1 year ago

I guess this is also the cause for the "Errors running builder 'CDT Core Builder' on project 'hello_world'." error in IDF Eclipse Plugin does not yet support Eclipse CDT 2022-12 (IEP-826) #654 then?

maxbrito500 commented 1 year ago

Same thing here. Had to install version 4.4.3 to remove the syntax error messages from the IDE.

Please add this information on the main page. It is confusing to install the most recent recommended version that is obviously giving these kind of errors.

valkuc commented 1 year ago

Looks like this is the same as discussed here - https://github.com/espressif/idf-eclipse-plugin/issues/643#issuecomment-1476711686

gregtoth commented 1 year ago

I've noticed that on every other launch of Espressif-IDE, the indexer works, symbols resolve, and Open Declaration drill-down works as expected. But for the other launches the indexer is broken, there are tons of unresolved symbols listed in Problems, and Open Declaration doesn't work. Example: Launch ide and indexer is broken. Quit IDE, then launch again, and indexer is okay. Quit ide, then launch again, and indexer is broken. This cycle repeats over and over and seems to be 100% repeatable with clean install of Espressif-IDE 2.10.0, IDF v5.1, and blink example project. Maybe a clue as to the underlying indexer issue?

Another Update: The alternating working/not working behavior happens when a file is left open when exiting Espressif-IDE. For example, if hello_world/main/hello_world_main.c is currently open when exit Espressif-IDE, then re-launch Espressif-IDE and that file automatically re-opens, the indexer alternates between working and not working on subsequent IDE launches. If you close all files before exiting Espressif-IDE, then re-launch the IDE, the indexer seems to work properly and continues to work properly on subsequent launches as long as there are no source files open when you exit and re-launch.