Bug 40099 - [EasyHack] don't break incremental builds on removed headers on non-gcc platforms
Summary: [EasyHack] don't break incremental builds on removed headers on non-gcc platf...
Status: CLOSED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: Other Windows (All)
: medium normal
Assignee: Caolán McNamara
URL:
Whiteboard:
Keywords: difficultyBeginner, easyHack, skillScript
Depends on:
Blocks:
 
Reported: 2011-08-15 03:11 UTC by Björn Michaelsen
Modified: 2016-01-26 17:24 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
why not do this ? (2.72 KB, patch)
2011-08-19 17:02 UTC, Caolán McNamara
Details
this seems to do the trick for windows (428 bytes, patch)
2011-08-25 04:23 UTC, Caolán McNamara
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Björn Michaelsen 2011-08-15 03:11:25 UTC
Incremental builds might break on removed header files as for example:
make[1]: *** No rule to make target 
`/home/cono/src/git/libo_core/oox/inc/oox/drawingml/diagram/diagramlayoutatoms.hxx', needed by 
`/home/cono/src/git/libo_core/workdir/unxlngi6.pro/CxxObject/oox/source/drawingml/chart/chartdrawingfragment.o'.  Stop.

The problem is that:
 1) a object was compiled
 2) a dependency file for the object was created naming the used headers
 c) the used header gets removed by an "git pull"
 d) the file should get recompiled, but this breaks make because it depends on an nonexisting file

This EasyHack is about creating a "make depclean" goal, which would in the simplest case delete all dependency files that are older then the cxx-file of the object they where created for. This would work for all direct includes as the cxx-file would need to be changed if it includes the file directly.

However, that would still fail for indirect includes (a header included via another header). To fix that reliably, the "make depclean" target has to check each file in the depfile to be existing and remove any dependency file (and the corresponding object file) naming a nonexisting file.
Comment 1 Caolán McNamara 2011-08-19 17:02:27 UTC
Created attachment 50388 [details]
why not do this ?

 -MP This option instructs CPP to add a phony target for each dependency other than the main file, causing each to depend on nothing.  These dummy rules work around errors make gives if you remove header files without updating the Makefile to match.
Comment 2 Caolán McNamara 2011-08-19 17:02:55 UTC
i.e. http://www.makelinux.net/make3/make3-CHP-8-SECT-3
Comment 3 Caolán McNamara 2011-08-23 06:46:49 UTC
I'll assume that the result of "don't break incremental builds on removed headers" is the goal rather than how we get there.

I'll try -MP, it seems to do what we want. Can revert and return this to the pool if that fails for whatever reason.
Comment 5 Björn Michaelsen 2011-08-23 14:11:28 UTC
@Caolon: Hmmm, that of course works to prevent the incremental build issues, but I wonder if it is kinda dangerous because we _have_ rules for headers that need to fire. E.g. headers in the solver, which are copied over from the sourcetree: a missing or outdated header file would then be silently left untouched, while before it (rightfully) errored out. 

However, I cant come up with a cornercase where this would hit us, as long as we make sure that we source the dep files _after_ our rules (which we currently do).

Reopening, Assigning back to default, adjusting title and platform as this still is an issue on Windows. Hacking makedepend.exe or fixing windows dep generation to do the same as gcc should do the trick.
Comment 6 Caolán McNamara 2011-08-25 04:23:25 UTC
Created attachment 50559 [details]
this seems to do the trick for windows
Comment 7 Caolán McNamara 2011-08-25 04:26:44 UTC
original

> cd sot
> echo \#include \<demo.hxx\> >> source/base/exchange.cxx
> touch source/base/demo.hxx
> make -sr
0

exchange.d has demo.hxx as a depend now

> sed -i "/demo.hxx/d" source/base/exchange.cxx
> rm source/base/demo.hxx
> make -sr
> echo $?
2, unable to rebuild because depends list removed demo.hxx

> make -sr clean
apply patch
> echo \#include \<demo.hxx\> >> source/base/exchange.cxx
> touch source/base/demo.hxx
> make -sr
0
> sed -i "/demo.hxx/d" source/base/exchange.cxx
> rm source/base/demo.hxx
> make -sr
> echo $?
0

kendy: filter-showIncludes.pl is your, how about the attached patch for windows ?
Comment 8 Caolán McNamara 2011-08-26 03:07:24 UTC
http://cgit.freedesktop.org/libreoffice/core/commit/?id=797caeb095848b6b6936c22d5b0409da7810fbba I think will do the right thing
Comment 9 Caolán McNamara 2011-08-30 07:28:55 UTC
closed, been quite a few days and I've removed quite a few files in between without the usual moaning, might have worked.
Comment 10 Robinson Tryon (qubit) 2015-12-16 00:18:10 UTC
Migrating Whiteboard tags to Keywords: (EasyHack DifficultyBeginner SkillScript SkillWindows)
[NinjaEdit]
Comment 11 Björn Michaelsen 2016-01-26 17:24:46 UTC
removing skillWindows keyword. There is no such thing at https://wiki.documentfoundation.org/Development/Easy_Hacks/lists/by_Required_Skill and having a "skill*" keyword makes the easyHack not even appear on that page even in "uncategorized".