Fail to compile for Arduino Nano ESP32

Hardware: Arduino Nano ESP32
Laptop: MacBook Pro Apple M3 Max, Sonoma 14.4
Using Arduino IDE 2.3.2, [macOSApple Silicon, 11: “Big Sur” or newer, 64 bit]
installed esp32 version 3.0.0 by Espressif Systems

Very simple code:

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
}
void loop() {
  // put your main code here, to run repeatedly:
  Serial.println('Hello World!');
  delay(500);
}

However, I don't know why I get this error message:

/Users/jrchang612/Library/Arduino15/packages/esp32/tools/xtensa-esp32s3-elf-gcc/esp-12.2.0_20230208/bin/../lib/gcc/xtensa-esp32s3-elf/12.2.0/../../../../xtensa-esp32s3-elf/bin/ld: /private/var/folders/h9/_mcts4xx04ndc1qlvzjstmvw0000gn/T/arduino/sketches/962B416AED5EFE3EE50C09509348BC66/core/dfu_callbacks.cpp.o:(.literal._ZN12_GLOBAL__N_110MD5Builder8getCharsEPc+0x0): undefined reference to `_ZN12_GLOBAL__N_110HEXBuilder9bytes2hexEPcjPKhj'
/Users/jrchang612/Library/Arduino15/packages/esp32/tools/xtensa-esp32s3-elf-gcc/esp-12.2.0_20230208/bin/../lib/gcc/xtensa-esp32s3-elf/12.2.0/../../../../xtensa-esp32s3-elf/bin/ld: /private/var/folders/h9/_mcts4xx04ndc1qlvzjstmvw0000gn/T/arduino/sketches/962B416AED5EFE3EE50C09509348BC66/core/dfu_callbacks.cpp.o:(.literal._ZN12_GLOBAL__N_110MD5Builder12addHexStringEPKc+0x0): undefined reference to `_ZN12_GLOBAL__N_110HEXBuilder9hex2bytesEPhjPKc'
/Users/jrchang612/Library/Arduino15/packages/esp32/tools/xtensa-esp32s3-elf-gcc/esp-12.2.0_20230208/bin/../lib/gcc/xtensa-esp32s3-elf/12.2.0/../../../../xtensa-esp32s3-elf/bin/ld: /private/var/folders/h9/_mcts4xx04ndc1qlvzjstmvw0000gn/T/arduino/sketches/962B416AED5EFE3EE50C09509348BC66/core/dfu_callbacks.cpp.o: in function `_ZN12_GLOBAL__N_110MD5Builder8getCharsEPc':
/Users/jrchang612/Library/Arduino15/packages/esp32/hardware/esp32/3.0.0/variants/arduino_nano_nora/../../cores/esp32/MD5Builder.cpp:92: undefined reference to `_ZN12_GLOBAL__N_110HEXBuilder9bytes2hexEPcjPKhj'
/Users/jrchang612/Library/Arduino15/packages/esp32/tools/xtensa-esp32s3-elf-gcc/esp-12.2.0_20230208/bin/../lib/gcc/xtensa-esp32s3-elf/12.2.0/../../../../xtensa-esp32s3-elf/bin/ld: /private/var/folders/h9/_mcts4xx04ndc1qlvzjstmvw0000gn/T/arduino/sketches/962B416AED5EFE3EE50C09509348BC66/core/dfu_callbacks.cpp.o: in function `_ZN12_GLOBAL__N_110MD5Builder12addHexStringEPKc':
/Users/jrchang612/Library/Arduino15/packages/esp32/hardware/esp32/3.0.0/variants/arduino_nano_nora/../../cores/esp32/MD5Builder.cpp:39: undefined reference to `_ZN12_GLOBAL__N_110HEXBuilder9hex2bytesEPhjPKc'
collect2: error: ld returned 1 exit status

exit status 1

Compilation error: exit status 1

I have repeatedly reinstall the program but in vain. Any suggestion would be deeply appreciated. Many thanks.


No, it's -- Serial.println("Hello World!");
double quotes, there, not single

Thank you for pointing that out! However, it still gives me the same error message even after the correction.

2 Likes

Hi @raychang. As a workaround, please use the official "Arduino ESP32 Boards" platform for now. I'll provide instructions you can follow to install it if you haven't already:

  1. Select Tools > Board > Boards Manager... from the Arduino IDE menus to open the "Boards Manager" view in the left side panel.
  2. Scroll down through the list of boards platforms until you see the "Arduino ESP32 Boards" entry.
  3. Click the "INSTALL" button at the bottom of the entry.
  4. Wait for the installation process to finish, as indicated by a notification at the bottom right corner of the Arduino IDE window:

    Successfully installed platform ...

Now select Tools > Board > Arduino ESP32 Boards > Arduino Nano ESP32 from the Arduino IDE menus. After that, try compiling your sketch again. This time it will compile without those "undefined reference" errors.

Although the 3rd party "esp32" boards platform does intend to also provide support for the Nano ESP32 board, Arduino generally recommends using the officially maintained "Arduino ESP32 Boards" platform, which is a fork of the "esp32" boards platform targeted specifically at the Nano ESP32 board, trimmed of some components of the "esp32" platform which are required to support other boards of that general purpose platform, but are completely irrelevant to the Nano ESP32. Arduino performs validation of the "Arduino ESP32 Boards" platform's support for the Nano ESP32 board, which is not done by the 3rd parties who maintain the "esp32" platform, so you are less likely to encounter bugs like this when using your Nano ESP32 with the "Arduino ESP32 Boards" platform.

For certain advanced use cases, it might be necessary to use the "esp32" platform in order to get access to features or fixes that were made in that platform and have not yet propagated into the more conservatively released "Arduino ESP32 Boards" fork. If you do need to use the "esp32" platform, we can provide instructions for working around the bug you encountered in the 3.0.0 release.

1 Like

that worked! thank you so much!

You are welcome. I'm glad it is working now.

Thanks to the fix submitted by @Juraj, the bug you encountered that caused the compilation to fail has now been resolved. Although it will not be possible to use version 3.0.0 of the platform with the Nano ESP32 board, this does mean that the next release of the "esp32" platform should properly support the Nano ESP32 board.

Regards,
Per

the esp32 team plans to release frequent versions with fixes so 3.0.1 maybe here next week.

1 Like
1 Like