[fpc-devel] Building trunk of today fails on Windows: Error: Invalid DLL C:\WINDOWS\system32\common.dll, invalid header size

Tomas Hajny XHajT03 at hajny.biz
Mon Aug 23 14:57:17 CEST 2021


On 2021-08-23 14:31, Bart via fpc-devel wrote:
> On Mon, Aug 23, 2021 at 1:36 PM Werner Pamler via fpc-devel
> <fpc-devel at lists.freepascal.org> wrote:
> 
>> > Does anybody have a common.dll in \windows\system32 at all?
>> 
>> I don't have it, neither in system32 nor in SysWOW64.
> 
> OK.
> 
>> Just pulled the current revision of fpc-trunk, and did not observe 
>> this
>> error (Win 10, fpc3.2.2 32-bit bootstrap compiler)
> 
> I expected as much, since nobody else complained about this error.
> AFAIK the syswow64 directory is not in my %PATH%.

The problem is that MS Windows employs a special trickery by which the 
path to c:\windows\system32 (almost surely in your PATH) translates to 
c:\windows\SysWOW64 _for_32-bit_binaries_ (only!). So in reality, that 
directory _is_ in your PATH.


> Unfortunately the "OPT=-vut" does not work (no output whatsoever) when
> this package is built, so no way to determine where it searches (and
> does not find: the errormessage is wrong w.r.t. that) and fails for
> 32-bit, not where it finds and succeeds for 64-bit and arm-wince.

It doesn't need to find it for 64-bit or arm-wince. As far as I know, it 
works like this: If the referenced DLL is found, the compiler builds the 
import library by scanning the found DLL, thus creating a complete and 
validated file guaranteed to work (on your machine). If the DLL is 
found, but it is not correct (either because it is somehow invalid, or 
because it doesn't contain the symbols / functions etc.), the compiler 
tells you about this issue, because it means that an attempt to run the 
compiled binary would fail with possibly obscure errors (compared to an 
error message stating that a required DLL is missing). If the referenced 
DLL is not found during compilation, the compiler tries to build the 
import library "blindly", just based on assumptions formulated in the 
source code.

Tomas


More information about the fpc-devel mailing list