Skip to content
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

Update eclipse-setup.rst : indexing library files #157

Closed
wants to merge 1 commit into from
Closed

Update eclipse-setup.rst : indexing library files #157

wants to merge 1 commit into from

Conversation

motla
Copy link
Contributor

@motla motla commented Dec 12, 2016

No description provided.

@CLAassistant
Copy link

CLAassistant commented Dec 12, 2016

CLA assistant check
All committers have signed the CLA.

@projectgus
Copy link
Contributor

Thanks for contributing this, I'm guessing these are the steps to remove the errors from missing symbols when Eclipse parses the source files.

Do you have any idea why the Eclipse CDT makefile parser doesn't find these header files when it parses the Makefile output?

@motla
Copy link
Contributor Author

motla commented Dec 15, 2016

The IDF_PATH has to be defined as an environnement variable inside the project and is not part of the Makefile.

But even if it would, it's not the good way to include libraries. Seems that there is an option in general Eclipse preferences, in "C/C++ → New C/C++ Project Wizard → Makefile Project", inside "Discovery Options", there is an "Automate discovery of paths and symbols" checkbox. But when you check it there is a Warning telling you that this method is deprecated. And it doesn't seem to work anyway.
The standard Eclipse way would be to add every "include" folder manually to the "Paths and Symbols" section of "C/C++ General" in the project preferences. But there is no sub-folder detection feature, thus it is very unpractical and will not take any ESP-IDF updates into account. The easier way is to add a linked folder to the ESP-IDF components (which considers sub-files/folders as well).

It may be mentionned that if there is already a "components" folder inside the project, you must choose a different name for the linked folder. Maybe it's the occasion to suggest a standard virtual-name for the linked folder inside an Eclipse project, as "components" is a bit unclear. Maybe "idf-library" or "idf-components" ?

@krzychb
Copy link
Collaborator

krzychb commented Dec 17, 2016

I like this update. This is far better alternative to manually adding individual folders proposed in #17.

It may be mentionned that if there is already a "components" folder inside the project, you must choose a different name for the linked folder. Maybe it's the occasion to suggest a standard virtual-name for the linked folder inside an Eclipse project, as "components" is a bit unclear. Maybe "idf-library" or "idf-components"

This is exactly what I had to do in first project I checked as it already had components folder!
I vote for "idf-components".

@projectgus
Copy link
Contributor

As it happens, I think we've found a fix for #17 that doesn't require manually adding any paths. Can you try the branch mentioned here:
https://github.com/espressif/esp-idf/tree/bugfix/eclipse_windows_paths

... and please let us know if there are still any manual additions required for Eclipse to index esp-idf correctly? Thanks.

@krzychb
Copy link
Collaborator

krzychb commented Jan 3, 2017

Here are my notes following procedure described in https://github.com/espressif/esp-idf/blob/bugfix/eclipse_windows_paths/docs/eclipse-setup.rst

1. Step: Installing Eclipse IDE

Same issue as reported under #166 (comment)

$ make menuconfig
c:/msys32/esp-idf/make/project.mk:63: *** If IDF_PATH is overriden on command line, it must be an absolute path with no embedded shell special characters.  Stop.

After changing export IDF_PATH="c:/msys32/esp-idf" to export IDF_PATH="/c/msys32/esp-idf", this issue is gone.

Only a warning is shown:

$ make menuconfig
WARNING: esp-idf git submodule components/esptool_py/esptool may be out of date. Run 'git submodule update' in IDF_PATH dir to update.

No more issues observed.

2. Step: Project Properties

I had no problems entering all listed configuration changes.

3. Step: Build Project

Attempting to build esp-idf-template I got the following message:

14:18:09 **** Incremental Build of configuration Default for project esp-idf-template ****
bash C:/msys32/esp-idf/tools/windows/eclipse_make.sh all 
Running make in C:\msys32\esp\esp-idf-template\
C:/msys32/esp-idf/make/project.mk:62: *** If IDF_PATH is overriden on command line, it must be an absolute path with no embedded shell special characters.  Stop.

14:18:09 Build Finished (took 456ms)

Changing IDF_PATH in "C/C++ Build" -> "Environment" to /c/msys32/esp-idf resolves this issue and I see a clean Eclipse window:

clean-eclipse

This is really remarkable taken you have shorten respective make command in tools/windows/eclipse_make.sh 👍

@krzychb
Copy link
Collaborator

krzychb commented Jan 3, 2017

@projectgus,

I have checked couple of more projects.

Finally, for the first time ever, I do not see red marks indicating issues besides the project names in the panel on left.

image

AWESOME.

If somebody is wondering, how to quickly set up a new project and enter all Project Properties, try the following:

  1. Select Copy from context menu on already configured project.
  2. Paste entering a new project name.
  3. Replace all old project files with new, not touching Eclipse .settings folder and files:
.settings
.cproject
.project

Update:

Another option, to skip step 3, is to set up and configure an empty project.
Pro Tip: Name it e.g. "_default" to sit handy at the top of the "Project Explorer" view.

@projectgus
Copy link
Contributor

Thanks @krzychb for the comprehensive testing. It sounds like the only issue you're seeing is still related to #166, so I'll reply to you there.

@motla (or anyone else who is interested), still very keen to hear what you think about this approach as well.

@motla
Copy link
Contributor Author

motla commented Jan 7, 2017

@projectgus I tested it at home on OSX, seems to work fine but only after the first successful build. Is that normal?

I also had to do the following in order to build correctly inside Eclipse on OSX:

  • add the "(...)/xtensa-esp32-elf/bin" folder to PATH environment variable (as for Windows)
  • set PYTHONPATH environment variable to "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages" in order to access the pyserial module (building inside the Terminal worked well without doing this).

@projectgus
Copy link
Contributor

Closing this PR as I think all of the issues mentioned in the thread are fixed in esp-idf master.

If there are outsanding issues with configuring Eclipse, or getting Eclipse to find all source files, then please open new issues for them.

@projectgus projectgus closed this Mar 21, 2017
@Bjohnson131
Copy link

I have changed the path as stated in #157 (comment). This only produces a pathing error for me.

@wnoliveira
Copy link
Contributor

https://github.com/espressif/esp-idf/tree/bugfix/eclipse_windows_paths this link doesn't work anymore. Do you have the new link @projectgus ?

@projectgus
Copy link
Contributor

projectgus commented May 22, 2018

@wnoliveira This change is merged in 8dede8f so any recent ESP-IDF master branch (or any stable release from v2.0 onwards) should have it.

Are you seeing problems with Eclipse indexing on Windows? Often this is one of the minor fiddly parts of the setup steps mentioned here:
https://esp-idf.readthedocs.io/en/latest/get-started/eclipse-setup-windows.html

(BTW, the new CMake-based build system is intended to make this process much less fiddly. Although we don't have Eclipse setup instructions yet.)

@wnoliveira
Copy link
Contributor

wnoliveira commented May 22, 2018

@projectgus actually, I am having troubles with Linux environment too. Now, I can compile through Eclipse and no errors are displayed. However, when I go to Project Properties/ C/C++ General/ Paths and Symbols there is no includes paths. Do you know if it's normal?

I will test the new CMake system too 👍

@projectgus
Copy link
Contributor

Do you know if it's normal?

This is normal, because with the IDF build system the list of include paths can be different for each source file. Eclipse CDT parses the output of "make" in order to find the list of include paths for each source file in the build, and stores these in a "cache" for the project. If this cache is working correctly, after the first build all source files should have correct include path information, navigation, etc. If the cache is not working correctly, the build will succeed in Eclipse but when you open source files in the Eclipse editor they'll show errors (in the editor pane) about missing headers and missing symbols.

I will test the new CMake system too

Awesome!

@wnoliveira
Copy link
Contributor

I've made a pull-request #1990 with a solution that I find to make indexer works well.

@Bjohnson131
Copy link

Bjohnson131 commented Dec 7, 2018

Alright. For those who are like me, and cannot figure out what to do; here's a quick solution

  1. Save this file as something along the lines of "EclipseIncludeESP32.xml"
  2. Import it via the eclipse importer:
    download 1

enjoy the quick and easy fix

0xFEEDC0DE64 pushed a commit to 0xFEEDC0DE64/esp-idf that referenced this pull request May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants