Trying to link a huge project compiled with DMD v2.094.2 for Win64 yields:
extra.lib(mutation_bb3e_d85.obj) : fatal error LNK1377: '_D8kaleidic3sil3std5extra5chart6ggplot4Plot4saveMFAyaiiZv' symbol not found in object. The containing library is corrupt.
Note that this isn't the usual LNK2019 ('unresolved external symbol ... referenced in function ...'). Googling 'LNK1377' only yields 28 (unrelated) results. Compiling with LDC v1.24.0 works fine.
Additionally, the symbol *is* defined in that extra.lib. `dumpbin /symbols extra.lib`:
017 00000000 UNDEF notype () External | _D8kaleidic3sil3std5extra5chart6ggplot4Plot4saveMFAyaiiZv
...
017 00000000 UNDEF notype () External | _D8kaleidic3sil3std5extra5chart6ggplot4Plot4saveMFAyaiiZv
...
085 00000000 SECTB notype () External | _D8kaleidic3sil3std5extra5chart6ggplot4Plot4saveMFAyaiiZv
086 00000000 SECTC notype Static | $unwind$_D8kaleidic3sil3std5extra5chart6ggplot4Plot4saveMFAyaiiZv
087 00000000 SECTD notype Static | $pdata$_D8kaleidic3sil3std5extra5chart6ggplot4Plot4saveMFAyaiiZv
To me, 'symbol not found in object' sounds like the linker expects the symbol to be defined in the same object file.
Unfortunately I can't really provide a testcase, not even binary artifacts - the lib is huge (~288 MB), the dumpbin output >3M lines...
Comment #1 by bugzilla — 2020-12-12T00:53:09Z
> The containing library is corrupt.
Instead of using dmd to build the library, try building it with Microsoft's lib tool.
Comment #2 by per.nordlow — 2020-12-14T23:04:05Z
(In reply to Walter Bright from comment #1)
> > The containing library is corrupt.
>
> Instead of using dmd to build the library, try building it with Microsoft's
> lib tool.
I would greatly appreciate if you could explain
- how the call to dub changes and
- what command line call I should use to link the resulting binary using "lib tool". "lib tool" doesn't seem to be an official linker name on Windows. Which other linker are you referring to?
Comment #3 by bugzilla — 2020-12-19T00:18:23Z
Here's the Microsoft lib tool that comes with Visual Studio:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>lib
Microsoft (R) Library Manager Version 10.00.40219.01
Copyright (C) Microsoft Corporation. All rights reserved.
usage: LIB [options] [files]
options:
/DEF[:filename]
/ERRORREPORT:{NONE|PROMPT|QUEUE|SEND}
/EXPORT:symbol
/EXTRACT:membername
/INCLUDE:symbol
/LIBPATH:dir
/LIST[:filename]
/LTCG
/MACHINE:{ARM|EBC|IA64|MIPS|MIPS16|MIPSFPU|MIPSFPU16|
SH4|THUMB|X64|X86}
/NAME:filename
/NODEFAULTLIB[:library]
/NOLOGO
/OUT:filename
/REMOVE:membername
/SUBSYSTEM:{BOOT_APPLICATION|CONSOLE|EFI_APPLICATION|
EFI_BOOT_SERVICE_DRIVER|EFI_ROM|EFI_RUNTIME_DRIVER|
NATIVE|POSIX|WINDOWS|WINDOWSCE}[,#[.##]]
/VERBOSE
/WX[:NO]
And a link to what it does and how to use it:
https://docs.microsoft.com/en-us/cpp/build/reference/lib-reference?view=msvc-160
I don't know how your project is creating libraries, but when the message says "the containing library is corrupt" that's where to start.
Comment #4 by robert.schadek — 2024-12-13T19:13:10Z