-
Notifications
You must be signed in to change notification settings - Fork 36
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
Allow using esp-idf-svc with the CMake build #34
Comments
@maelp With the changes to the To get you a head-start, I've (temporarily) forked this repo here and I've basically enhanced it with all of the demo code that is available in the rust-esp32-std-hello crate. So just
Flash as per the build instructions and you should be good to go. Oh: you need the Let me know if you face issues. |
Thanks @ivmarkov that's awesome, I'm going to try it right now and let you know if it works as expected! |
For now I have a linking error with
(although I installed libiconv) Perhaps I have to add something to the CMake file or add a LD_LIBRARY_PATH ? |
Can you provide some extra context:
|
Hey @ivmarkov, the original rust example used to compile on my machine, but it seems that the most recent commit fails with the same error, I'll try to build a few commits or git bisect to try to find which commit introduced the error, as a reference, I had built the example successfully on commit ad2066c |
@ivmarkov I reinstalled the latest Any idea how I could debug why it requires this library? |
I'm not sure whether libiconv is really needed for the compilation though, when I grep the
and then mostly in the Doxyfile for documentation
|
This is the build command that fails
|
As a reference, this is how I install the toolchain
|
The error seems to happen at that step:
|
OK got it. So where it is failing, is at a compilation stage which is NOT really building the Background: since So what I am trying to say is that installing Now why it did not work for you even though you said you installed |
Ha interesting, indeed if I do a |
I tried with brew and with nix, and in both cases the libiconv is not detected, I tried adding the path to LD_LIBRARY_PATH before building, or to CFLAGS and LDFLAGS, but it does not seem to work |
This stackoverflow thread might be relevant. Unfortunately no solution there. Do you happen to run an M1 Mac as well??? |
I'm on a regular intel mac :) are there some cargo flags that I can use to tell the build about other library paths? |
If I copy paste the line of the code which does not compile, and simply remove the |
And if I install
in front of the
|
But if I include the flags "-L/usr/local/opt/libiconv/lib -I/usr/local/opt/libiconv/include" directly in front of the "-liconv" on the build command, it compiles, so I guess the issue is that for some reason the build does not take into account the LDFLAGS and CCFLAGS For now perhaps I will use the Docker build, do you know if there's an easy way to do a build in docker and retrieve the built binary, so that I can flash it from my laptop on the ESP (since it's complicated to bind the USB ports to Docker containers on a mac)? |
The fact that Now, instead of
There is no "script" that tries to build the Now, the fact, that removing Hence why I pointed you at the stackoverflow thread above where they try to compile a supersimple "Hello, world" app on Mac, and it still does not work.
Not really, @georgik might be able to help. |
Compiling the hello-world: with with with |
The error seems to be a Nix thing, I can make the hello-world example compile using |
I guess the easiest for now is to build using a Docker container :) |
OK since the error is really somehow with your Rust installation (basic hello-world fails to build too), please report if after flashing the thing works, and if it does, I think we can close this one. :) P.S. |
Well, when building the code in the docker container it seems to work but it stalls when doing this
and then nothing is displayed and it seems to hang, does it do the same for you? |
It does not stall. It just takes a lot of time (not sure why). |
Weird, it seems to be perhaps 1h that I left it like that, do you know how long it takes on your laptop? |
The build completed (after perhaps one hour or so), and I could successfully flash and run it :) although I will need to have a way to build faster for this to be useable haha |
On my laptop it takes a couple of minutes at most. If not less than a minute. |
I suggest you open a separate issue, so that Espressif & myself can look into what is causing the slowness later. |
Perfect :) |
I've added #40 and I'm closing this issue |
Hi,
Thanks for this really nice repository! We're a French company using ESP32 for our products, and we are really looking forward to being able to use embedded Rust.
We saw both
rust-esp32-example
(this repo, CMake-based build) and https://github.com/ivmarkov/rust-esp32-std-hello (a nice "cargo-first" build from @ivmarkov which also allows to use the nice https://github.com/esp-rs/esp-idf-svc which gives access to nice Rust wrappers for most of ESP-IDF libraries).For now, because our codebase is C/C++, we'd be happy to use this CMake-based build rather than the "cargo-first" build (as we want to incrementally modify modules of our code by replacing them with Rust code), but it seems we can't use
esp-idf-svc
with it out-of-the-box.Would it be possible to update this code, or add an example of how to do a CMake-based build that also allows to use
esp-idf-svc
?The text was updated successfully, but these errors were encountered: