Hi,
I finally reproduced an unjust "`somfile.gpi' must be recompiled" message with a minimal example.
This is the tree:
\ywin.pas \testy.pas \contrib\gpc.o \contrib\gpc.gpi
gpc.* are compiled from gps.pas as supplied with the compiler. ywin.pas and testy.pas are as follows
============== ywin.pas START ===================
MODULE ywin;
EXPORT ywin = (dummy);
IMPORT gpc only (PCStrings, CParamCount, CParameters);
procedure dummy; end;
procedure dummy; begin end; { dummy }
end.
============= ywin.pas END =====================
============= testy.pas START ====================
program testy;
import ywin;
begin end.
============= testy.pas END ======================
============ Compile log START ================
gpc -c -g --unit-path=contrib ywin.pas
gpc testy.pas
testy4.pas:3: `ywin.gpi' must be recompiled
============= Compile log END ===================
If ywin.pas and testy.pas live in the same directory you can get around this problem by making testy.pas with --automake, but if they live in different directories that does not work. The problem goes away if gpc.* are put together with ywin.pas.
I have not tested whether this is a particular problem of gpc.pas or whether it happens with any unit interface.
Best regards, Bastiaan.
The following was intended to go to the group, but I originally sent it only to Bastiaan.
Bastiaan Veelo wrote:
I finally reproduced an unjust "`somfile.gpi' must be recompiled" message with a minimal example.
This is the tree:
\ywin.pas \testy.pas \contrib\gpc.o \contrib\gpc.gpi
gpc.* are compiled from gps.pas as supplied with the compiler. ywin.pas and testy.pas are as follows
============== ywin.pas START ===================
MODULE ywin;
EXPORT ywin = (dummy);
IMPORT gpc only (PCStrings, CParamCount, CParameters);
procedure dummy; end;
procedure dummy; begin end; { dummy }
end.
============= ywin.pas END =====================
============= testy.pas START ====================
program testy;
import ywin;
begin end.
============= testy.pas END ======================
============ Compile log START ================
gpc -c -g --unit-path=contrib ywin.pas
gpc testy.pas
testy4.pas:3: `ywin.gpi' must be recompiled
The message is "justified" by the method used to check if files are up to date: namely, in the process gpc has to check that all gpi file used by the interface of ywin.pas are up to date. However, gpc only uses filenames to find out the files, so it can not find gpc.gpi and thinks that ywin.pas must be recompiled.
Simple workaround is to give `--unit-path=contrib:.' option to both compilations.
gpc could probably give better error message (or remember full patchname to source/gpi files), but OTOH changing unit path value during build is likely to produce other errors.