msvc-wine icon indicating copy to clipboard operation
msvc-wine copied to clipboard

Error when trying to build: invalid or corrupt file: cannot read at 0x2F8

Open Maxwell175 opened this issue 4 years ago • 1 comments

Hello,

After running the container, I attempted to compile a simple test hello world program, however I seem to get an error during the build:

# /opt/msvc/bin/x64/cl test.c
Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30133 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

test.c
Microsoft (R) Incremental Linker Version 14.29.30133.0
Copyright (C) Microsoft Corporation.  All rights reserved.

\opt\msvc\vc\tools\msvc\14.29.30133\bin\Hostx64\x64\link.exe 
/out:test.exe 
test.obj 
\opt\msvc\vc\tools\msvc\14.29.30133\bin\Hostx64\x64\link.exe : fatal error LNK1107: invalid or corrupt file: cannot read at 0x2F8

The issue seems to be in the linker, as if I try to complete the link on a windows VM, it succeeds and I get a working exe, so the compiled obj file seems to be fine.

Maxwell175 avatar Sep 26 '21 03:09 Maxwell175

Hmm, that's strange... Have you tried building the examples with Dockerfile.hello? These two commands should be reproducible and deterministic:

$ docker build -f Dockerfile -t msvc-wine .
$ docker build -f Dockerfile.hello .

And that successfully builds the test executable for all 4 architectures.

mstorsjo avatar Sep 27 '21 06:09 mstorsjo