[Solved] Problem using Husarnet in ESP32-Cam with Platformio

I’m trying to use husarnet for my AI Thinker ESP32-Cam project in VSCode using platformio. I tried to follow this example: https://github.com/husarnet/husarnet-esp32/tree/master/examples/simple-webcam

But, it always gave these error:
c:\users\xxx\.platformio\packages\toolchain-xtensa-esp32\xtensa-esp32-elf\include\c++\8.4.0\xtensa-esp32-elf\esp32-psram\no-rtti\bits\gthr-default.h:781:12: error: ‘pthread_mutex_timedlock’ was not declared in this scope
Cannot find “C:\Users\xxx\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\nimble”.
Cannot find “C:\Users\xxx\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\husarnet”.

I also try to manually use Arduino IDE but i got either library error such as:
cannot found lwip_connect_r (and anything in lwip with _r)
or error with the compiler

I want to use ESP32-cam to stream image (video), but can also be accessed using different wifi without using another device (like raspy) beside esp32-cam. And after some search i found that it is possible using husarnet, but because i’m still learning in this programming topic so i can only rely to the example first.

Any help will be very much appreciated, Thanks!



I am also experiencing the same, using the Firebeetle ESP32-E. Interestingly enough - I tested the functionality on the same board on 27 March 2022, and it all worked perfectly. Now I’m experiencing the exact same issue - you described.

What I have found is that when I comment out the platform_packages (see below) in the platformio.ini file - the pthread_mutex_timedlock error goes away - only to end up with one error > src/main.cpp:3:10: fatal error: Husarnet.h: No such file or directory


platform_packages = framework-arduinoespressif32 @ https://github.com/husarnet/arduino-esp32/releases/download/1.0.4-1/arduino-husarnet-esp32.zip

To test - I’m using the below example:

Can the tech team from Husarnet please advise?

1 Like

Just to add to my update - I also tried the suggestion in https://community.platformio.org/t/platformio-is-broken-for-any-esp32/26580/8, but didn’t solve the problem.

Just a gut feeling, after doing some more investigation - I think that the issue came in when the toolchain xtensa version was upgraded. When I started off with VS Platormio on 27 March 2022, the toolchain xtensa version was 2.50200.9 and the Husarnet functionality with the ESP32 worked.

I see that the toolchain xtensa was upgraded to 8.4.0+2021r2-patch3 on 26 April 2022.

Could this be the reason for the below errors?

c:\users\xxx.platformio\packages\toolchain-xtensa-esp32\xtensa-esp32-elf\include\c++\8.4.0\xtensa-esp32-elf\esp32-psram\no-rtti\bits\gthr-default.h:781:12: error: ‘pthread_mutex_timedlock’ was not declared in this scope?

Just to add, I am experiencing the same problem with husarnet and nimble errors quoted above with the simple basic example at the bottom of https://husarnet.com/docs on the ESP32 tab.

If any have solved the error I’d appreciate if you can drop a hint.


To add on, I am also facing the same errors when attempting to build Husarnet’s simple-webserver example.

Hoping for some guidance on any viable solutions.

Hi guys,

Problem solved! (at least on my end :slight_smile: )

Platformio automatically uses the latest release of https://github.com/platformio/platform-espressif32/releases, and between releases there seems to be a breaking change for previous versions of Arduino Core for ESP32 (used in Husarnet package).

To use older releases, you need to specify the version in platformio.ini:

platform = espressif32@2.1.0

Here’s a full example with ESP32-Cam and GitHub Action workflow that is a proof that the project is building fine:

I have not tested on Mac and Windows so far.

Please let me know whether it works also on your end guys.


1 Like

Thanks Dominik! Your suggestion works perfectly for me too.

1 Like

I’m using Windows and your suggestion works for me too, thanks Dominik!

Hi Fajar, since you mentioned Windows…Are you using Windows 10?
I have not been able to get a Windows 10 client to join my Husarnet network as yet. A couple things…

  1. The husarnet-gui short cut points to nowhere.
  2. The husarnet command in an Admin command prompt indicates it has an IPV6 assigned but when I take the “husarnet websetup” URL provided to join the network, after giving it a name the browser returns the error re: Unable to join the network.

I have disabled all firewalls/real time protections.

Thanks if you have any suggestions.

Platform Manager: Installing espressif32 @ 2.0.1
Error: Could not find the package with ‘espressif32 @ 2.0.1’ requirements for your system ‘windows_amd64’

using windows 8.1 ?

DUH @2.1.0 WORKS

1 Like

@PapaLanc thank you figuring out

Platform Manager: Installing espressif32 @ 2.0.1

I found the 2 things that looked to be the problem for me.
A. use: platform = espressif32@2.1.0
B. Make sure the C++ extension is NOT on prerelease.