Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Maxwell175 opened this issue Sep 26, 2021 · 1 comment

Comments

@Maxwell175
Copy link

Maxwell175 commented Sep 26, 2021

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.

@mstorsjo
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants