rebuild when build failed with new options; generate compile commands include linker commands (cherry picked from commit 90e3afbd7bd184d50e3cc6c8389632c8c22b2879)