I read this story in French around 1998 (no later than 2003) as a kid (I remember a big book.) The sun becomes a red giant (something to do with nuclear waste/bomb I think) and no way is found to stop it from destroying the Earth.
Scientists find a way to install a time dilation field around earth to make its proper time much faster, allowing civilisation to continue for thousands (millions?) of year. (1 year on earth is a small number of seconds outside.)
The second half of the book is about a small team of Mars scientists (pioneers?) that are stranded on Mars and experience the sun growing in real time. They have to manage their small facility that has issues (don't remember what.)
They communicate with earth but due to the immense time speed difference it is fruitless.
I think that just before the Earth is eaten by the sun, super advanced spaceships leave it.
At the end of the book, just before the Mars survivor(s) are/is going to die, they are saved by an unmanned rescue probe from the now far advanced human civilisation. The survivors realized that they have not been forgotten.
I believe that the book's French title contains "soleil" (sun in French.)
The book came from my local French library, if that is of any help.