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
undefined reference on custom components after updating esp-idf and tools (IDFGH-1472) #3741
Comments
I believe you're looking for idf_build_component(component_dir). |
Could also be that some |
@PerMalmberg Thank you very much for your reply. From the documentation sections Optional Project Variables and Renaming main component I believe using On a side note, adding the snippet below to the top-level CMakeLists.txt resulted in a CMake Error
@renzbagaporo Thank you very much for your reply. I do not believe that is the case, because I was able to build the project before updating esp-idf and ESP-IDF Tools. My code did not change. So I know REQUIRES and PRIV_REQUIRES were set correctly before. However I did notice that Just to be sure, is it allowed to put the REQUIRES and PRIV_REQUIRES on a new line using the new
Also, is there an easy way to keep track of deprecated CMake functions and variables, so I know what to update? Is there a changelog somewhere? Thanks for all the hard work! |
@avanbremen I'm using idf_build_component, see here. It was introduced fairly recently, at least as part of the v4-branch. You need to |
@PerMalmberg As a clarification,
@avanbremen The target, in this case You mentioning
The order of the link libraries didn't matter since all symbols were eventually resolved. Now though we rely on CMake's ordering and repetition of static libraries (https://cmake.org/cmake/help/v3.12/command/target_link_libraries.html#cyclic-dependencies-of-static-libraries) for this. And the ordering is based on what is in each components
This should work.
This is probably a good idea, will work on it. |
May I suggest sticking with a single public-facing API for adding components? Comparing |
@renzbagaporo Thanks for clarifying. I got rid of the initial It is a pretty straightforward dependency of application-level component1 relying on component2. component1 has component2 as I appreciate you looking into creating a CMake changelog, this will definitely help users that adopted the CMake-based build system early on. @PerMalmberg From what I understand |
@avanbremen You mentioned that Are you able to give more information as to the relationship/structure between
@PerMalmberg Making our build system in line with what CMake is doing is one of the goals of refactor. Though the reason for retaining this is that people are more familiar with adding components this way. There is no reason that Like I've mentioned, the variables are for people who do not need to touch the underlying build system APIs, which is most likely the people just using the standard projects. For people with custom projects, using the build system API directly makes more sense. We'll definitely take this comment under advisement, though. |
@renzbagaporo Because of the strong dependency of component1 on component2 I decided to group them together and redesign them as a new single component. This approach resulted in a better overall design and it solved the linker errors. Thank you both for your constructive help. Appreciate it. |
Glad to hear that @avanbremen. Just FYI this design change also exposed some unsavory dependency graph with components delivered in ESP-IDF, which we've had to workaround for now in order for things to build. I think this definitely forces developers to think about their source code structure. |
got exactly the same issue: described it here: https://www.esp32.com/viewtopic.php?f=13&t=14952 |
@su-Koch Have replied on the thread you pointed out. |
Hei Renz, thank you but I think that didn't help. I posted another comment in the forum. Thanks |
I just setup VScode with the ESP IDF plugin and setup things. I started with the Ethernet basic example(which worked) and added code for a web server to the main file and it worked as well. I tried to create a component out of the http_server example but i am getting an error at the linker stage.
Development Kit: ESP32 Ethernet Kit 1.2 Code at https://github.com/ip-v1/esp32_ethernet_http_component Not sure what I am doing wrong. Can anyone help? Thanks |
Hello, I have exactly this problem and there seems to be no solution. |
Environment
Problem Description
After updating esp-idf to the latest version and ESP-IDF Tools from version 1.2 to version 2.0, I am no longer able to compile my project due to
undefined reference to '<function name>'
errors for custom components (my own code).Expected Behavior
Project should build without errors as before.
Actual Behavior
Build fails due to
undefined reference to '<function name>'
errors.Debug Info
Component Grouping
Note that individual components are grouped together based on functionality, like:
The top-level CMakeLists.txt contains:
I have been using the CMake-based ESP-IDF build system since the beginning and even though it has been challenging at times (keeping up with the changes), I am very happy with the transition.
Unfortunately I cannot build my project at the moment so I cannot continue with development. Perhaps something was changed in the way extra components are handled, or the order in which custom components are built?
Build Output
Note: Project, user and function names have been replaced with dummy names.
The text was updated successfully, but these errors were encountered: