mincore.lib symbols in the link - how to avoid?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

mincore.lib symbols in the link - how to avoid?

Sumner, Brian via cfe-dev
I'm trying to compile a program that is intended to use Clang as a library, and getting an error where it tries to link in some symbols that are not actually available.

Windows 7
Visual Studio 2017
LLVM 4.0.1
Everything 64-bit, and I built LLVM myself

// minimal test program
#include <clang/Frontend/CompilerInstance.h>
int main(int argc, char **argv) {
  clang::CompilerInstance ci;
  return 0;
}

cl /I\llvm\build\include /I\llvm\build\tools\clang\include /I\llvm\include /I\llvm\tools\clang\include /J /MTd /Zi test.cpp \llvm\build\Debug\lib\*.lib

clangDriver.lib(MSVCToolChain.obj) : error LNK2019: unresolved external symbol GetFileVersionInfoSizeW referenced in function "private: class clang::VersionTuple __cdecl clang::driver::toolchains::MSVCToolChain::getMSVCVersionFromExe(void)const " (?getMSVCVersionFromExe@MSVCToolChain@toolchains@driver@clang@@AEBA?AVVersionTuple@4@XZ)
clangDriver.lib(MSVCToolChain.obj) : error LNK2019: unresolved external symbol GetFileVersionInfoW referenced in function "private: class clang::VersionTuple __cdecl clang::driver::toolchains::MSVCToolChain::getMSVCVersionFromExe(void)const " (?getMSVCVersionFromExe@MSVCToolChain@toolchains@driver@clang@@AEBA?AVVersionTuple@4@XZ)
clangDriver.lib(MSVCToolChain.obj) : error LNK2019: unresolved external symbol VerQueryValueW referenced in function "private: class clang::VersionTuple __cdecl clang::driver::toolchains::MSVCToolChain::getMSVCVersionFromExe(void)const " (?getMSVCVersionFromExe@MSVCToolChain@toolchains@driver@clang@@AEBA?AVVersionTuple@4@XZ)

These symbols are nominally available in mincore.lib, but not really; adding that to the link, produces an executable that won't run without an obscure DLL that is not present on many Windows machines, so it's necessary to avoid bringing them in, in the first place.

clang.exe itself runs fine, which is presumably an existence proof that this is possible.

Same problem arises with release build, and with a minimal library set instead of *.lib.

What is the recommended way to solve this problem?

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: mincore.lib symbols in the link - how to avoid?

Sumner, Brian via cfe-dev
Link with version.lib instead?

- Kim 

Den 7 aug. 2017 5:52 em skrev "Russell Wallace via cfe-dev" <[hidden email]>:
I'm trying to compile a program that is intended to use Clang as a library, and getting an error where it tries to link in some symbols that are not actually available.

Windows 7
Visual Studio 2017
LLVM 4.0.1
Everything 64-bit, and I built LLVM myself

// minimal test program
#include <clang/Frontend/CompilerInstance.h>
int main(int argc, char **argv) {
  clang::CompilerInstance ci;
  return 0;
}

cl /I\llvm\build\include /I\llvm\build\tools\clang\include /I\llvm\include /I\llvm\tools\clang\include /J /MTd /Zi test.cpp \llvm\build\Debug\lib\*.lib

clangDriver.lib(MSVCToolChain.obj) : error LNK2019: unresolved external symbol GetFileVersionInfoSizeW referenced in function "private: class clang::VersionTuple __cdecl clang::driver::toolchains::MSVCToolChain::getMSVCVersionFromExe(void)const " (?getMSVCVersionFromExe@MSVCToolChain@toolchains@driver@clang@@AEBA?AVVersionTuple@4@XZ)
clangDriver.lib(MSVCToolChain.obj) : error LNK2019: unresolved external symbol GetFileVersionInfoW referenced in function "private: class clang::VersionTuple __cdecl clang::driver::toolchains::MSVCToolChain::getMSVCVersionFromExe(void)const " (?getMSVCVersionFromExe@MSVCToolChain@toolchains@driver@clang@@AEBA?AVVersionTuple@4@XZ)
clangDriver.lib(MSVCToolChain.obj) : error LNK2019: unresolved external symbol VerQueryValueW referenced in function "private: class clang::VersionTuple __cdecl clang::driver::toolchains::MSVCToolChain::getMSVCVersionFromExe(void)const " (?getMSVCVersionFromExe@MSVCToolChain@toolchains@driver@clang@@AEBA?AVVersionTuple@4@XZ)

These symbols are nominally available in mincore.lib, but not really; adding that to the link, produces an executable that won't run without an obscure DLL that is not present on many Windows machines, so it's necessary to avoid bringing them in, in the first place.

clang.exe itself runs fine, which is presumably an existence proof that this is possible.

Same problem arises with release build, and with a minimal library set instead of *.lib.

What is the recommended way to solve this problem?

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: mincore.lib symbols in the link - how to avoid?

Sumner, Brian via cfe-dev
In reply to this post by Sumner, Brian via cfe-dev
Here's someone else who ran into the same problem:
https://github.com/poizan42/soswow64/commit/2f9e368c28476caff1ce2966f87e9122c422c804

This is a really shitty move by Micros~1, documenting mincore.lib as
the supplier of GetFileVersionInfo* functions, as if Windows 2000, XP,
Vista, 7 never existed, even though
https://msdn.microsoft.com/en-us/library/windows/desktop/ms647464(v=vs.85).aspx
admits that the minimum supported OS is Windows 2000.


On Mon, Aug 7, 2017 at 5:52 PM, Russell Wallace via cfe-dev
<[hidden email]> wrote:

> I'm trying to compile a program that is intended to use Clang as a library,
> and getting an error where it tries to link in some symbols that are not
> actually available.
>
> Windows 7
> Visual Studio 2017
> LLVM 4.0.1
> Everything 64-bit, and I built LLVM myself
>
> // minimal test program
> #include <clang/Frontend/CompilerInstance.h>
> int main(int argc, char **argv) {
>   clang::CompilerInstance ci;
>   return 0;
> }
>
> cl /I\llvm\build\include /I\llvm\build\tools\clang\include /I\llvm\include
> /I\llvm\tools\clang\include /J /MTd /Zi test.cpp \llvm\build\Debug\lib\*.lib
>
> clangDriver.lib(MSVCToolChain.obj) : error LNK2019: unresolved external
> symbol GetFileVersionInfoSizeW referenced in function "private: class
> clang::VersionTuple __cdecl
> clang::driver::toolchains::MSVCToolChain::getMSVCVersionFromExe(void)const "
> (?getMSVCVersionFromExe@MSVCToolChain@toolchains@driver@clang@@AEBA?AVVersionTuple@4@XZ)
> clangDriver.lib(MSVCToolChain.obj) : error LNK2019: unresolved external
> symbol GetFileVersionInfoW referenced in function "private: class
> clang::VersionTuple __cdecl
> clang::driver::toolchains::MSVCToolChain::getMSVCVersionFromExe(void)const "
> (?getMSVCVersionFromExe@MSVCToolChain@toolchains@driver@clang@@AEBA?AVVersionTuple@4@XZ)
> clangDriver.lib(MSVCToolChain.obj) : error LNK2019: unresolved external
> symbol VerQueryValueW referenced in function "private: class
> clang::VersionTuple __cdecl
> clang::driver::toolchains::MSVCToolChain::getMSVCVersionFromExe(void)const "
> (?getMSVCVersionFromExe@MSVCToolChain@toolchains@driver@clang@@AEBA?AVVersionTuple@4@XZ)
>
> These symbols are nominally available in mincore.lib, but not really; adding
> that to the link, produces an executable that won't run without an obscure
> DLL that is not present on many Windows machines, so it's necessary to avoid
> bringing them in, in the first place.
>
> clang.exe itself runs fine, which is presumably an existence proof that this
> is possible.
>
> Same problem arises with release build, and with a minimal library set
> instead of *.lib.
>
> What is the recommended way to solve this problem?
>
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>



--
GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
The Tao of math: The numbers you can count are not the real numbers.
Life is complex, with real and imaginary parts.
"Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds
"People disagree with me. I just ignore them." -- Linus Torvalds
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: mincore.lib symbols in the link - how to avoid?

Sumner, Brian via cfe-dev
In reply to this post by Sumner, Brian via cfe-dev
That works, thanks!

On Tue, Aug 8, 2017 at 9:41 AM, Kim Gräsman <[hidden email]> wrote:
Link with version.lib instead?

- Kim 

Den 7 aug. 2017 5:52 em skrev "Russell Wallace via cfe-dev" <[hidden email]>:
I'm trying to compile a program that is intended to use Clang as a library, and getting an error where it tries to link in some symbols that are not actually available.

Windows 7
Visual Studio 2017
LLVM 4.0.1
Everything 64-bit, and I built LLVM myself

// minimal test program
#include <clang/Frontend/CompilerInstance.h>
int main(int argc, char **argv) {
  clang::CompilerInstance ci;
  return 0;
}

cl /I\llvm\build\include /I\llvm\build\tools\clang\include /I\llvm\include /I\llvm\tools\clang\include /J /MTd /Zi test.cpp \llvm\build\Debug\lib\*.lib

clangDriver.lib(MSVCToolChain.obj) : error LNK2019: unresolved external symbol GetFileVersionInfoSizeW referenced in function "private: class clang::VersionTuple __cdecl clang::driver::toolchains::MSVCToolChain::getMSVCVersionFromExe(void)const " (?getMSVCVersionFromExe@MSVCToolChain@toolchains@driver@clang@@AEBA?AVVersionTuple@4@XZ)
clangDriver.lib(MSVCToolChain.obj) : error LNK2019: unresolved external symbol GetFileVersionInfoW referenced in function "private: class clang::VersionTuple __cdecl clang::driver::toolchains::MSVCToolChain::getMSVCVersionFromExe(void)const " (?getMSVCVersionFromExe@MSVCToolChain@toolchains@driver@clang@@AEBA?AVVersionTuple@4@XZ)
clangDriver.lib(MSVCToolChain.obj) : error LNK2019: unresolved external symbol VerQueryValueW referenced in function "private: class clang::VersionTuple __cdecl clang::driver::toolchains::MSVCToolChain::getMSVCVersionFromExe(void)const " (?getMSVCVersionFromExe@MSVCToolChain@toolchains@driver@clang@@AEBA?AVVersionTuple@4@XZ)

These symbols are nominally available in mincore.lib, but not really; adding that to the link, produces an executable that won't run without an obscure DLL that is not present on many Windows machines, so it's necessary to avoid bringing them in, in the first place.

clang.exe itself runs fine, which is presumably an existence proof that this is possible.

Same problem arises with release build, and with a minimal library set instead of *.lib.

What is the recommended way to solve this problem?

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Loading...