Suddenly getting error on linking

Working on my project all evening and then I received this error… I have deleted my .pioenvs folder as suggested by another user on a different thread. I have rebooted with no success… Why am I receiving this linking error all of a sudden? and what can I do to troubleshoot this?

.pioenvs\d1_mini\libESP8266WiFi.a(ESP8266WiFiGeneric.o):(.text._ZN23ESP8266WiFiGenericClass14_eventCallbackEPv+0x4): undefined reference to `std::__detail::_List_node_base
.pioenvs\d1_mini\libESP8266WiFi.a(ESP8266WiFiGeneric.o): In function `ESP8266WiFiGenericClass::_eventCallback(void*)':
ESP8266WiFiGeneric.cpp:(.text._ZN23ESP8266WiFiGenericClass14_eventCallbackEPv+0x64): undefined reference to `std::__detail::_List_node_base::_M_unhook()'
collect2.exe: error: ld returned 1 exit status
scons: *** [.pioenvs\d1_mini\firmware.elf] Error 1

I have successfully uploaded my code to my D1 mini numerous times and had made only some simple changes to the code (ie. no new includes or object references).

I have just started using PlatformIO and I really like it since it has allowed me to break my code out into proper class definitions. Not sure I can go back to Arduino IDE now… :wink:

Home screen reads, IDE 1.3.3 | CLI 2.11.1 Atom is 1.8.0 ;
Apparently everything is up to date so a real head scratcher at this end.

Any help greatly appreciated!

Hi @gizmobin!
Could you please provide full build log?

I couldn’t figure out how to copy the build log within Atom. It seems I can only select the visible text which at best is only 40 or 50 lines. (For reference, I am on Windows 10)

In an effort to get all the build commands, I opened a terminal from the PlatformIO menu. I ran the command “platformio run” as I see that is the command to start the build process.

Doing that worked and it was able to build everything without any errors.

Here is the log from the terminal…

After the successful terminal build I went back to Atom and tried to upload. It attempted a new build and failed with the same message as before. I shut down Atom and re-opened it then tried Upload again and to my surprise it built the application without any issues and successfully uploaded.

Keep in mind that I did a full reboot last night and that didn’t help anything.

So does the problem still persist?

At this point I can do the build and upload so I will say that it is working.

Having changed nothing I have to wonder what triggered the error and the resolution. As a hobbyist, I use the system in the evenings. If I encounter a similar problem in the future I will post a follow up message.

I posted my original message only because I saw that others had similar issues, and felt that perhaps there is some randomness to this based on settings etc.


Do you have all packages updated? Settings (gear) icon > Updates.

Yes, when I first experienced the issue I checked everything was up to date and also restarted the machine to make sure that there was no caching etc. in play. I also removed the .pioenvs folder in an attempt to flush everything.

I wonder if there are any issues related to other versions of (other) software installed on my machine. My home machine is a catch-all for all sorts of development tools and web platforms. Is there any chance that something in my environment could be causing issues?

I know that I had a hardware folder installed (for use with Arduino IDE) on my machine for the ESP2866 - D1 WeMos when I first started working with the device.

Tell me please the actual “create” date of this folder ~/.platformio/packages/framework-arduinoespressif. It seems to me that you had obsolete ESP8266 for Arduino package and the latest PlatformIO. PlatformIO should update all packages when is upgraded. However, if you had a problem with Internet connection or etc, the packages were not updated.

PlatformIO 3.0 has new architecture and package manager. We will not have these issues.

Not sure that one influences the other. Looking at .gcc-flags.json all directories point to the .platformio folder with the exception of my project directory.

The ‘hardware’ folder for Arduino IDE was under my Arduino projects (higher level) directory, so somewhat hidden from platformio As to the .platformio folder in my Users folder (I am on Windows), the creation date is July 18 @ 21:26 EST
The versions.txt file (in that folder) is dated June 28 @ 5:17 am and the boards.txt is June 21 @ 4:06 am

I did previously rebuild a lot of my tools as I tried to resolve the error that I was receiving. I have just tried a build now and it is still working fine.

I look forward to the next version, the tool is very good.


Same problem again this evening… all of a sudden the build doesn’t work. I have made no changes to my system, I turned off virus protection as I wondered if that was the issue.

When I run/press the compile button I get the error, same for both compile and upload. However, if I go to the Terminal window and enter the command “platformio run --target upload” everything compiles and uploads without any issue.

I’ve attached a screen shot, the top terminal is my manual compile and upload. Right after I hit the Upload (arrow) and get the output listed; I also tried clean and full build. I also deleted the .pioenvs folder and restarted Atom, with no difference.

I am fine manually building at least I can still build and upload. :grinning: Just seems really odd that this behaviour has returned after everything was fine for most of the evening (and I made no OS software changes, I was only playing with the hardware and changed a bit of my code)

Could you share here the value of Path and PATH environment variables?

Please upgrade to PlatfromIO 1.3.4. Do you still have this issue?

I have upgraded, and so far all is well. If anything changes I will post my PATH

Thanks again!

I am getting the similar issue. All has been working well until I reinstalled PlatformIO and now am unable to compile the code. I get the following error:

collect2.exe: error: ld returned 1 exit status
*** [.pioenvs\d1_mini\firmware.elf] Error 1
========================= [ERROR] Took 9.73 seconds =========================
The terminal process terminated with exit code: 1

However, if I compile using the terminal command platformio run it compiles and similarly upload okay. The problem seems to happen only when using Small Tick Icon or using the menu options.

My path variables are:
User path : C:\user\AM\Appdata\Local\Microsoft.WandowsApps
System path : C:\ProgramData\Oracle\Java/javapath and other systemroot folders.

Any ideas what might be causing this?

Could you provide test project to reproduce this issue?

I do not think it is project specific. The same project sometimes complies sometimes not so it has to be something environment specific. It started happening when I updated PlatformIO from the last version. Any ideas what might be causing this?


Problem only seems to happen only when additional options are defined in the platformio.ini. E.g.

; Serial Monitor options
monitor_baud = 9600
upload_port = COM5

if I remove these serial monitor options then all works fine. Strange!

Takes ages to upload projects to NodeMCU.

Could you provide pio run --verbose output?

Here it is. verbose_output -

I don’t see any errors in that log. Build succeeded.