how to rebuild 3rd party library

I've searched the forum and saw other people asking about the same thing but never saw a working answer - and most of the questions were pretty old.

I have latest 1.8.5 installed on linux and have added a 3rd party library but need to modify the library source to change its behavior for my app.

However, the IDE will not rebuild the library after changing the source code. Even with errors in the source code to force it to fail, it happily builds and creates my sketch. I found the cache and build directory under /tmp and if I delete the .o file for the particular cpp file, it recreates the .o file, without errors even though the cpp source file has intentionally placed errors in it!

So, I tried to just copy the source into my sketch directory but had duplicate errors, so tried deleting all the Arduino directories I could find and then reinstalled it, but this time did not install the 3rd party library but instead just copied the source into my sketch folder. The first time it did build the copied source - I know because my embedded source errors stopped it. After correcting the errors and successfully building everything, once again I cannot get it to rebuild the 3rd party source after making changes. Even when I add source errors trying to break the compile, it ignores them too and happily builds, just like before.

Its like once it has a successfully built .o file it continues using it regardless of the source. maybe my "uninstall" by deleting directories didn't work and its still treating it like a library. In any case it should be re-compiling the source files, but does not.

How can I force rebuilds? This should be a simple thing and its making me crazy. The hiding of too much of the build process details "behind the scenes" to make it easy for people is now making it impossible for me.

Thanks in advance!

This is definitely not the intended behavior. If the timestamp of the library's files are newer than the cache then it should be rebuilt.

I just did a test with Arduino IDE 1.8.5 and I can't reproduce this issue.

Sometimes I want a rebuild even though I haven't modified the library (because compiler warnings for the library are not shown for compilations after it has been cached). I've found the easy way to do this is to change the Tools > Board selection, which causes the cache to be cleared.

I haven't been able to get back to it, but I'll try the board change to see. One problem I had was changing code inside an #if - #endif that was not being used -- explains why the forced coding error didn't cause a compile fail. I'll go back and re-try in the right section of code.