Page 1 of 1

ESP-IDF Compiling on Win10 with a twist

Posted: Tue Apr 03, 2018 8:10 pm
by mikemoy
!!! Warning, Long in the tooth description, Warning !!!

For those of use not willing to let go of our Win10 boxes, and go full Linux I think I have found an alternate method to compile on a PC.
So far, I know of 3 such methods,
#1) Install a cross compiler on your PC, and other changes.
#2) Install a VM running a Linux Distro.
#3) This possibly new idea that I will try to explain.

Let me fist state that I am learning Linux, and far, far from being useful at it. Thus I hope to see if I can get some help from you smarter guys to see if I can pull this off, because I feel this is would be a good method for PC users. Disclaimer warning: I know one method is not considered good for everyone.

I have been using a VM on my PC which runs Ubuntu to compile for the ESP32. I then Eclipse in there to code for it. As those who have tried this way know this is not the greatest approach. For those that may not know, you can install Ubuntu bash command line in Win10. Its very handy and I use it often to try things I learn for Linux. You can read more about here about that: https://www.microsoft.com/en-us/store/p ... blggh4msv6.
I have been able to do everything in the command window as I can in the real Ubuntu's Terminal window.
Last night I though why dont I try installing the Toolchain for Linux there and see if it works. Quick recap here:
https://espressif-docs.readthedocs-host ... setup.html

It worked just fine, I can run make menuconfig and compile just fine. Now here is the twist/ed part.
On the PC side you can access those Linux files. I.E. root, home and so on. You can read more about that here:
https://www.howtogeek.com/261383/how-to ... e-in-bash/
For example, that location on my box its here:
C:\Users\Mike\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\home\Mike\esp-idf

I will install eclipse on my PC instead of using it through the VM (so it runs far faster and GUI looks normal) and point Eclipse to that folder location instead. I am so close to accomplishing this with the hello_wold example. I don't have any warnings in eclipse, yet when I build I run into a issue where I hit a Permission denied issue. I tried mucking with permissions and gain and loose success at it, but my limited knowledge even with googles help is keeping me from moving forward.

Should anyone else find that this might be another useful way to do this, and might be willing to throw some suggestions to try let me know and thanks for the time. Below is the last clip of the output from Eclipse when building hello_world example.

Code: Select all

Assembler messages:
Fatal error: can't create src/bootloader_random.o: Permission denied
make[2]: *** [/c/Users/Mike/AppData/Local/Packages/CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc/LocalState/rootfs/home/Mike/esp/esp-idf/make/component_wrapper.mk:274: src/bootloader_random.o] Error 1
make[2]: Leaving directory '/c/Users/Mike/AppData/Local/Packages/CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc/LocalState/rootfs/home/Mike/esp/hello_world/build/bootloader/bootloader_support'
make[1]: *** [/c/Users/Mike/AppData/Local/Packages/CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc/LocalState/rootfs/home/Mike/esp/esp-idf/make/project.mk:453: component-bootloader_support-build] Error 2
make[1]: Leaving directory '/c/Users/Mike/AppData/Local/Packages/CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc/LocalState/rootfs/home/Mike/esp/esp-idf/components/bootloader/subproject'
make: *** [/c/Users/Mike/AppData/Local/Packages/CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc/LocalState/rootfs/home/Mike/esp/esp-idf/components/bootloader/Makefile.projbuild:40: /c/Users/Mike/AppData/Local/Packages/CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc/LocalState/rootfs/home/Mike/esp/hello_world/build/bootloader/bootloader.bin] Error 2

14:53:41 Build Finished (took 7s.411ms)

Re: ESP-IDF Compiling on Win10 with a twist

Posted: Tue Apr 03, 2018 8:18 pm
by kolban
Howdy,
I think you are describing the Windows Subsystem for Linux (WSL)?... see also:

viewtopic.php?t=3394

For the majority of work, this will be just fine ... however some reports are coming in of problems / unknown recipes required ... for working with JTAG in this environment.

Re: ESP-IDF Compiling on Win10 with a twist

Posted: Tue Apr 03, 2018 8:22 pm
by fly135
I develop and compile using Windows with the MSYS32 and toolchain downloaded from links provided here...

https://esp-idf.readthedocs.io/en/lates ... index.html

I have used Windows 7, 8.1, and 10. When you do a make also add a -j8, which allows multiple cores to work at once and significantly speeds up the build. Also tell windows defender to exclude your development directories.

I have configured and compiled under Eclipse, but haven't bothered to get fully involved in that env. I use Notepad++ and build in MSYS.

I've used Linux VM's with Oracle VirtualBox but prefer the windows env when I can use it.

Re: ESP-IDF Compiling on Win10 with a twist

Posted: Tue Apr 03, 2018 8:28 pm
by mikemoy
Neil,

I sure feel like a idiot now! I read that thread a few weeks ago, and forgot all about it!
Just goes to show how awesome of speaker you are. Took me that huge post, where you did it in a couple paragraphs. ;)

Re: ESP-IDF Compiling on Win10 with a twist

Posted: Wed Apr 04, 2018 5:57 am
by Vader_Mester
fly135 wrote:I develop and compile using Windows with the MSYS32 and toolchain downloaded from links provided here...

https://esp-idf.readthedocs.io/en/lates ... index.html

I have used Windows 7, 8.1, and 10. When you do a make also add a -j8, which allows multiple cores to work at once and significantly speeds up the build. Also tell windows defender to exclude your development directories.

I have configured and compiled under Eclipse, but haven't bothered to get fully involved in that env. I use Notepad++ and build in MSYS.

I've used Linux VM's with Oracle VirtualBox but prefer the windows env when I can use it.
Maaaaaaaan, this is such a useful tip thank you! Gonna try it today!