esp32 microros Component Linker Error
Hi,
I think this is a ROS related build issue, but it may also be cmake / idf.py related. Not sure where to jump in to diagnose this.
I am attempting to break my microros project into components, so that I can build various implementations using common code. It all compiles well but when linking, one of my components, "microros_app", the linker throws errors saying it can't find any of the RCL or RCLC functions. My initial thought was this is a C++ name mangling thing but I also noticed that my microros_app could not find references to my I2Cdev component either.
Another clue / problem, in this project if I do a fullclean/clean, then build the project, as it tries to reconfigure the project, it will fail. The failure is that if can't find the ros library functions. I determined the source of the problem is that the reconfigure script is trying to reconfigure my components before it downloads the micro_ros_src directory then copies the root include directory from the ROS source. Any component that depends on the ros include directory fail because the include directory does not exist yet.
I work around this problem by moving my microros_app component to another directory, perform a build which will fail because the component is missing. After that I copy my microros_app component back, re-run reconfigure, this time it will succeed because the microros include directory has been copied.
My primary problem is the linker error
Here is a link to my microros app. https://github.com/gentijo/MaqueenBat...
- the maqueen-esp32-obn1 directory is my microros app I am trying to build.
- the common_component directory is where I am establishing my components.
- the maqueen-esp32 is an older C based project that works and what I am using as a stating point for maqueen-esp32-obn1
Here is a link to the gist of the output where it fails on linking and can't find the rcl functions. https://gist.github.com/gentijo/e0793...
Here is a link to the gist where compile fails after a clean when a component depends on rcl functions defined in the root include directory. https://gist.github.com/gentijo/1de46...
Any suggestions on where to dive in would be helpful Thank you -John
I created a new GIST that has the output of the linker command where I put each library on its own line to make it easier to read. I also dumped the symbols from the I2Cdev.a and the libmicroros_ws.a to show that the missing symbols are there.
https://gist.github.com/gentijo/81ec7...
In the gist https://gist.github.com/gentijo/81ec7... the 3 libs in question are included in the linker statement /opt/microros_ws/libmicroros.a esp-idf/I2Cdev/libI2Cdev.a esp-idf/microros_app/libmicroros_app.a
but they also seem to be on the other side of a break in the command line options, does that make a difference ?
I also see /opt/microros_ws/libmicroros.a and esp-idf/microros_ws/libmicroros_ws.a included, what's the difference. The second lib does not have an rcl_ functions.
If I move all the component source files to the main project directory, it compiles and links.