How to Recompile Platform Libraries?


I’m developing for ESP8266 using the Espressif 8266 (Stage) platform (which is the only platform installed) on the latest platformIO version (installed a couple of days ago).

Suspect that there’s a problem with one of the core libraries (lwip to be specific) which is supplied in source format.

I edit the file, but it is not compiled. I know the compiler is going through the header files as it spits out #pragma messages that I inserted, however it completely ignores the .c source files.

The actual file in question is: C:\Users\myname\.platformio\packages\framework-arduinoespressif8266\tools\sdk\lwip\src\core\tcp_in.c

The relevant platformio.ini parts are:

platform = espressif8266_stage
framework = arduino
board = esp12e
build_flags = -DLWIP_OPEN_SRC -Wl,-Tesp8266.flash.4m.ld

How can I force a recompile?


pio run -t clean or “Clean” button in PIO IDE

Thanks for your quick response!

Unfortunately, neither works, nor does even deleting the .pioenvs directory entirely. :angry:

Digging a bit further, seems that compilation of the source is avoided entirely, and PIO is directly using a precompiled lib during linking (C:\Users\myname\.platformio\packages\framework-arduinoespressif8266\tools\sdk\lib\liblwip_gcc.a).

Any hints on what controls that? :confused:

I got you, yes, build script uses already pre-compiled libraries. See

You can slightly modify that build script and replace a static library with a dynamic building. Or better, build this static library outside the PIO and replace it later.

Sounds exactly like what I need, thanks! Unfortunately very much the n00b here. How do I tell it to do a dynamic build instead of using the static lib?

Using espressif8266_stage - tried removing the “lwip_gcc” from Libs=[… but that just resulted in the linker spewing… how do I get the actual compilation part to work?

Any/all hints or pointers to n00b documentation much appreciated!!

So, after some great help from igrr and d-a-v, I’ve managed to create another static binary to link against (installed mingw, modified lwipopts.h, and ran make install).

This process created (in Windows) /c/Users/<yourname>/.platformio/packages/framework-arduinoespressif8266/tools/sdk/lib/liblwip_src.a.

I then modified C:\Users\<yourname>\.platformio\platforms\espressif8266_stage\builder\frameworks\ to change lwip_gcc to lwip_src so that the linker would use this new file instead.

…and it worked - Yay.

This doesn’t, however, seem like a ‘good’ way to do it.

Is there a way I can use one of the a variants in Boards.txt to override this - Source (gcc)



Sure, see Redirecting...

This is so frustrating…

Nothing particularly… obvious… in build flags documentation to allow me to choose a board variant.

The closest I could come is setting -llwip_src in build_flags, but this had no effect until I again modified the file to remove "lwip_gcc" from Libs=[ section.

Tried using lib_ignore = lwip_gcc but this had no effect.

Is that a bug, or am I misunderstanding again?

Bump… sorry… soooo… lib_ignore flag not working properly?

You are right, this is the right solution in this situation. Also, you can clone existing development platform and modify it. Then use pio platform install path/to/custom/dev/platform.

Finally, you can use custom build script which overwrites PIO’s built in file. See Redirecting...

you can try use deep flag in platformio.ini
lib_ldf_mode = deep
it works quite well for me.