2

I have just added the ESP32 toolchain to the Arduino IDE (v1.8.0) on Windows 10. To get the IDE to allow me to select ESP32 chips I had to place the Espressif folder in "D:\Program Files(x86)\Arduino\hardware" (Yes my C drive is called D, its a long story)

I managed to compile and run Blink and after several minutes of celebration I tried the ESP32 Example Wifi->WifiScan. It failed to compile because

WARNING: Category '' in library OneWire is not valid. Setting to 'Uncategorized'
In file included from D:\Program Files (x86)\Arduino\libraries\WiFi\src\utility\spi_drv.cpp:21:0:

D:\Program Files (x86)\Arduino\libraries\SPI/SPI.h:16:26: fatal error: avr/pgmspace.h: No such file or directory

compilation terminated.

Multiple libraries were found for "WiFi.h"
 Used: D:\Program Files (x86)\Arduino\libraries\WiFi
 Not used: D:\Program Files (x86)\Arduino\hardware\espressif\ESP32\libraries\WiFi
Multiple libraries were found for "SPI.h"
 Used: D:\Program Files (x86)\Arduino\libraries\SPI
 Not used: D:\Program Files (x86)\Arduino\hardware\espressif\ESP32\libraries\SPI
exit status 1
Error compiling for board ESP32 Dev Module.

If I am reading this correctly, there are a couple of duplicate libraries, Arduino versions and ESP32 versions and the IDE picked the Arduino versions.

Is there a way of telling the IDE to prefer the ESP32 libraries rather than Arduino ones? I suspect all I need to do is change the order of the -I and -L commands, but I don't have a clue how, or if that's the right thing to do.

  • Why do you have WiFi and SPI libraries in your contributed libraries folder...?!?! – Majenko Aug 4 '17 at 20:22
  • In an attempt to rename the directory I found that the espresiif\ESP32 directory is locked by a system process PID:4 which is holding handles on 10 of the files within those directories. I uninstalled the drivers for the esp32, no joy, logged on as admin and ran as admin, but no joy. I had to alter the security permissions so that System couldn't access that directory reboot and then delete espressif\esp32. At this point I also unistalled Arduino IDE and re-installed a fresh copy of 1.8.3. [continued] – Code Gorilla Aug 5 '17 at 13:31
  • I followed the installation instructions (without using GIT) and 'installed' the esp32 pack to D:\Users\***\Documents\Arduino\hardware\espressif\esp32 and again, the same result the IDE does not pick up the ESP32 boards, but does pick up the esp8266 boards. If I move the libraries to D:\Program Files (x86)\Arduino\hardware then the IDE detects the boards and when I compile the example I get a duplicate WIFI.h BUT it now picks the esp32 version. I think the problem is why doesn't it work when the esp32 folder is in My document? – Code Gorilla Aug 5 '17 at 13:42
  • "I think the problem is why doesn't it work when the esp32 folder is in My document". Probably because you have a different sketchbook folder configured (see File > Preferences > Sketchbook location). – per1234 Aug 5 '17 at 19:33
  • 2
    Please don't delete your question after someone has taken the trouble to answer it. I have undeleted it. – Nick Gammon Aug 16 '17 at 2:10
1

#include "filename.h" will look in the sketch folder

#include <filename.h> will look in the path, defined in File | Preferences, edit preferences.txt, search for sketchbook.path

  • 1
    So the system library path (-L) is defined in perferances.txt, thanks for that. – Code Gorilla Aug 5 '17 at 12:24
  • #include <filename.h> will only look in the path, defined in File | Preferences, edit preferences.txt, search for sketchbook.path this is wrong. The libraries subfolder of the sketchbook is only one of 6 folders in the include path in a standard hardware package, none of which are configured in preferences.txt. There is no need to edit preferences.txt, you can just do File > Preferences > Sketchbook location. Also, take a second to actually view your answer before submitting it to see how the markdown is being rendered. – per1234 Aug 5 '17 at 19:31
0

The problem is that you have incorrectly installed the ESP32 hardware package. If you look at the official installation instructions:

https://github.com/espressif/arduino-esp32/blob/master/README.md#installation-instructions

you'll see that the architecture folder should be named esp32, not ESP32 as you have named your folder.

When multiple libraries contain a header file of the same name, one of the factors the Arduino IDE uses to decide which gets precedence is architecture matching. The architecture of the selected board is determined by the name of the architecture folder of the hardware package of that board. So because you named your architecture folder ESP32, that's the architecture value of the selected board. The architecture of the library is determined by the architectures property value found in the library.properties file of the library. In this case that value is set to esp32:

architectures=esp32

So because the architecture value of the library in the ESP32 hardware package doesn't match the architecture of the selected board, the SPI library found in the Arduino IDE installation folder is used instead.

If you rename the architecture folder to esp32 the correct library will be used.

A few other notes:

For some reason you have put a copy of the SPI library at D:\Program Files (x86)\Arduino\libraries\SPI. This makes no sense because that library is architecture specific. Each hardware package has its own version of the SPI library bundled.

In addition to using the incorrect architecture folder name in your installation of the ESP32 hardware package, you installed it to the Arduino IDE installation folder instead of the sketchbook folder, as recommended in the instructions.

You seem to have a bad habit of messing with your Arduino IDE installation folder. You should never modify or add files to the Arduino IDE installation folder. The reason is that all changes you make to that location will be lost anytime you upgrade to a new version of the Arduino IDE and it also makes troubleshooting more difficult since you are working with a non-standard installation. Instead you should always install libraries and hardware packages to the sketchbook folder where they will persist through IDE updates. I recommend you to move any customized files out of the Arduino IDE installation folder and then reinstall the IDE to make sure you are working with a stock installation.

  • per1234, I'm sorry but you are wrong. I have never altered anything in the Arduino install folder. Everything that is in there was installed in there by the installer or the board manager. – Code Gorilla Aug 5 '17 at 13:21
  • To get the IDE to allow me to select ESP32 chips I had to place the Espressif folder in "D:\Program Files(x86)\Arduino\hardware" "D:\Program Files(x86)\Arduino\hardware" is your Arduino IDE installation folder, correct? – per1234 Aug 5 '17 at 19:24
  • Then where do you have the Arduino IDE installed? – per1234 Aug 16 '17 at 19:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.