Skip to content

Unable to compile arduino as idf component in eclipse #5317

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

Closed
tsctrl opened this issue Jun 22, 2021 · 13 comments
Closed

Unable to compile arduino as idf component in eclipse #5317

tsctrl opened this issue Jun 22, 2021 · 13 comments

Comments

@tsctrl
Copy link

tsctrl commented Jun 22, 2021

Hardware:

Board: ESP32 Dev Module
Core Installation version: ESP-IDF v4.4-dev-1594-g1d7068e4b-dirty
IDE name: IDF component
Flash Frequency: 40Mhz?
PSRAM enabled: no
Upload Speed: 115200
Computer OS: Windows 10

Description:

Unable to compile arduino as idf component.

I doing library update to the current master for idf and arduino but having issue with the arduino esp32 lib to compile with error as below:
Failed to resolve component 'ethernet'.

I have follow exactly from the guide provided here:
https://github.com/espressif/arduino-esp32/blob/master/docs/esp-idf_component.md

Step i did:

  1. create new blink project
  2. create components folder
  3. download the arduino-esp32 as arduino
  4. copy the sdkconfig from tools folder (not in the guide)
  5. add component include in makefile (not in the guide)
  6. build the project with error as below:

Debug Messages:

Building in: C:\Users\tsctrl\eclipse-workspace\blink\build
Configuring in: C:\Users\tsctrl\eclipse-workspace\blink\build
cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=C:\Development\esp-idf\tools\cmake\toolchain-esp32.cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCCACHE_ENABLE=1 -DIDF_TARGET=esp32 C:\Users\tsctrl\eclipse-workspace\blink
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.30.0.windows.2") 
-- ccache will be used for faster recompilation
-- The C compiler identification is GNU 8.4.0
-- The CXX compiler identification is GNU 8.4.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/Users/tsctrl/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe
-- Check for working C compiler: C:/Users/tsctrl/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe
-- Check for working C compiler: C:/Users/tsctrl/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Users/tsctrl/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++.exe
-- Check for working CXX compiler: C:/Users/tsctrl/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- 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 esp32
-- Checking Python dependencies...
Python requirements from C:/Development/esp-idf/requirements.txt are satisfied.
CMake Error at C:/Development/esp-idf/tools/cmake/build.cmake:194 (message):
  Failed to resolve component 'ethernet'.
Call Stack (most recent call first):
  C:/Development/esp-idf/tools/cmake/build.cmake:220 (__build_resolve_and_add_req)
  C:/Development/esp-idf/tools/cmake/build.cmake:508 (__build_expand_requirements)
  C:/Development/esp-idf/tools/cmake/project.cmake:361 (idf_build_process)
  CMakeLists.txt:8 (project)

the ethernet is a part of arduino idf sdk, i am guessing that this sdk folder need to be copy to idf folder somewhere. not really sure where to put this folder, how to register it and why this is not included by default. i dont want to simply copy stuff and override files. suggesting to have updated setup guide for arduino as components in eclipse.

thank you so much for your reply and thanks in advanced.

@chegewara
Copy link
Contributor

@tsctrl
Copy link
Author

tsctrl commented Jun 22, 2021

hi @chegewara yes i copied over the sdkconfig.

edit:
basically i did full reinstall and update from idf 4.2 to 4.4. idf project are done. but stuck with the arduino setup.

@lbernstone
Copy link
Contributor

The component is called esp-eth in idf 4. You cannot compile any version of arduino with any version of idf. I recommend you use lib-builder to ensure you get a match between known good versions.

@tsctrl
Copy link
Author

tsctrl commented Jun 22, 2021

i remember i try to use that before @lbernstone but cant proceed somehow, probably because i am using windows

@lbernstone
Copy link
Contributor

You can see here which commit of arduino is matched with a commit of esp-idf. If you can't get both those aligned, there is a very low chance you will get this to compile.

@tsctrl
Copy link
Author

tsctrl commented Jun 22, 2021

Hi @lbernstone

i did try the lib builder and is working fine.

  1. however it keep looping and run bootloader build. is that the expected behavior? can stop at any time?
  2. i guess lib builder automatically download the last match arduino with idf version based on my current idf version installed on my machine?
  3. what can i do with the build result from lib builder? take the arduino part and integrate to my existing project? what is the next step?

sorry for the long question
thanks!

edit: it finally stop building.

@tsctrl
Copy link
Author

tsctrl commented Jun 23, 2021

Hi @chegewara , @lbernstone ,

the component registration now are not working as before. the linker not be able to find the header class after build:

edit:
the component has link setup to arduino library as below:
SET(COMPONENT_REQUIRES arduino)
idf_component_register(
SRCS "${COMPONENT_SRCS}"
REQUIRES "${COMPONENT_REQUIRES}"
)

Undefined reference error after the build completed:

undefined reference to `WebServer::send(int, char const*, String const&)'
undefined reference to `WiFiSTAClass::setAutoConnect(bool)'
undefined reference to `WiFiSTAClass::waitForConnectResult()'
undefined reference to `configTime'
undefined reference to `EspClass::getEfuseMac()'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

this is call from idf component to the arduino library

thanks

@tsctrl
Copy link
Author

tsctrl commented Jun 23, 2021

Do you guys have example project run on c++ as components and calling arduino library?

@chegewara
Copy link
Contributor

Maybe the problem is with eclipse config?
I am not using eclipse because its not that easy to config and to use as VS code, at least from my experience, but few years ago this file was a guide to me how to make it works (just esp-idf):
https://github.com/nkolban/esp32-snippets/blob/master/eclipse/c_includes.xml

As you can see there is a lot files that has to be included manually. Maybe there is better way to do it, but i dont know it.
If you are just looking for arduino as component, there is few repositories in my profile which you can use as starting point. Some are with arduino v4.2 branch, but nothing most recent with v2.0.0.

@tsctrl
Copy link
Author

tsctrl commented Jun 23, 2021

i believe this is not ide eclipse related, i try to build both command line and ide with the same result. code are build properly and the linkage are fine with idf 4.2. but having issue with the 4.4. basically the linker are not able to find the compiled code once the compile finish building.

i have this issue previously on my own component and able to resolve it. but now it happens on the arduino library it self. the compiler not able to link the arduino library. wondering how you guys call the arduino lib classes and function on idf components what updates that was done on the arduino-esp, i guess some linkage in the makefile was removed.

cc: @lbernstone , @igrr

@tsctrl
Copy link
Author

tsctrl commented Jun 23, 2021

Hi

this is the error

[146/148] cmd.exe /C "cd . && C:\Users\user1\.espressif\tools\xtensa-esp32-elf\esp-2020r3-8.4.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-g++.exe  -mlongcalls -Wno-frame-address   @CMakeFiles\project1_1.2.3.elf.rsp  -o project1_1.2.3.elf  && cd ."
FAILED: project1_1.2.3.elf 
cmd.exe /C "cd . && C:\Users\user1\.espressif\tools\xtensa-esp32-elf\esp-2020r3-8.4.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-g++.exe  -mlongcalls -Wno-frame-address   @CMakeFiles\project1_1.2.3.elf.rsp  -o project1_1.2.3.elf  && cd ."
c:/users/user1/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/project1/libproject1.a(webservice.cpp.obj):(.literal._ZN10WebService9wiFiEventE18arduino_event_id_t+0x10): undefined reference to `WiFi'

look like the elf files was not generated.
thanks

@tsctrl
Copy link
Author

tsctrl commented Jun 23, 2021

i close this and open another one here to be more specific:
#5319

thanks!

@tsctrl tsctrl closed this as completed Jun 23, 2021
@tsctrl
Copy link
Author

tsctrl commented Jun 23, 2021

@lbernstone from the docker file, idf 4,2 previously is using arduino release4.2 branch here
RUN shallow_clone https://github.com/espressif/arduino-esp32 idf-release/v4.2 $LIB_BUILDER_PATH/components/arduino

there is no more arduino release/4.2 branch. so now 4.2 is build against master arduino branch? try to revert back to version 4.2.2 but cant get the build to success.

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

No branches or pull requests

3 participants