fmtlib / fmt

A modern formatting library
https://fmt.dev
Other
20.88k stars 2.52k forks source link

Linker error on Visual Studio 2019 #2533

Closed acgetchell closed 3 years ago

acgetchell commented 3 years ago

Recent builds on Windows with Visual Studio 2019 surfaced the following error:

cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=src\CMakeFiles\initialize.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x64\mt.exe --manifests  -- C:\PROGRA~1\LLVM\bin\lld-link.exe /nologo src\CMakeFiles\initialize.dir\initialize.cpp.obj  /out:src\initialize.exe /implib:src\initialize.lib /pdb:src\initialize.pdb /version:0.0 /machine:x64 /INCREMENTAL:NO /subsystem:console  ..\vcpkg_installed\x64-windows\lib\docopt.lib  ..\vcpkg_installed\x64-windows\lib\date-tz.lib  ..\vcpkg_installed\x64-windows\lib\tbb.lib  ..\vcpkg_installed\x64-windows\lib\fmt.lib  ..\vcpkg_installed\x64-windows\lib\mpfr.lib  ..\vcpkg_installed\x64-windows\lib\gmp.lib  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cmd.exe /C "cd /D C:\projects\cdt-plusplus\build\src && "C:\Program Files\PowerShell\7\pwsh.exe" -noprofile -executionpolicy Bypass -file C:/Tools/vcpkg/scripts/buildsystems/msbuild/applocal.ps1 -targetBinary C:/projects/cdt-plusplus/build/src/initialize.exe -installedDir C:/projects/cdt-plusplus/vcpkg_installed/x64-windows/bin -OutVariable out""
2392LINK: command "C:\PROGRA~1\LLVM\bin\lld-link.exe /nologo src\CMakeFiles\initialize.dir\initialize.cpp.obj /out:src\initialize.exe /implib:src\initialize.lib /pdb:src\initialize.pdb /version:0.0 /machine:x64 /INCREMENTAL:NO /subsystem:console ..\vcpkg_installed\x64-windows\lib\docopt.lib ..\vcpkg_installed\x64-windows\lib\date-tz.lib ..\vcpkg_installed\x64-windows\lib\tbb.lib ..\vcpkg_installed\x64-windows\lib\fmt.lib ..\vcpkg_installed\x64-windows\lib\mpfr.lib ..\vcpkg_installed\x64-windows\lib\gmp.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:src\initialize.exe.manifest" failed (exit code 1) with the following output:
2393lld-link: error: undefined symbol: public: static char const (*const fmt::v8::detail::basic_data<void>::digits)[2]
2394>>> referenced by src\CMakeFiles\initialize.dir\initialize.cpp.obj:(class fmt::v8::appender __cdecl fmt::v8::detail::write<char, class fmt::v8::appender, int, 0>(class fmt::v8::appender, int))
2395>>> referenced by src\CMakeFiles\initialize.dir\initialize.cpp.obj:(class fmt::v8::appender __cdecl fmt::v8::detail::write<char, class fmt::v8::appender, int, 0>(class fmt::v8::appender, int))
2396>>> referenced by src\CMakeFiles\initialize.dir\initialize.cpp.obj:(class fmt::v8::appender __cdecl fmt::v8::detail::write<char, class fmt::v8::appender, int, 0>(class fmt::v8::appender, int))
2397>>> referenced 110 more times
2398
2399

https://ci.appveyor.com/project/acgetchell/cdt-plusplus#L2391

This was not the case a month ago:

https://ci.appveyor.com/project/acgetchell/cdt-plusplus/builds/40509390

I do not get this error on macOS or Linux, and I reported this issue almost a month ago, but it was closed without resolution.

https://github.com/fmtlib/fmt/issues/2496

The version of fmt is 8.0.1.

mwinterb commented 3 years ago

When vcpkg is building fmt, does it also use clang-cl? And are C++ language versions consistent?

vitaut commented 3 years ago

As commented in #2496 the symbol in question is no longer used. Please comment on the original issue instead of opening a duplicate.

acgetchell commented 3 years ago

Why would I comment on the original issue if it has been closed and yet it is still unresolved?

vitaut commented 3 years ago

Why do you think it's unresolved? Have you actually tested on master?

acgetchell commented 3 years ago

Because I have a nice causal chain of continuous integration tests showing that it was working a month ago, stopped working, and has not worked since?

Like many, I use a package management system, in this instance vcpkg, because it is absolutely unsupportable to attempt to cobble together special combinations of particular versions of libraries that all play nicely together for 100+ libraries.

The version of fmt in vcpkg a month ago, as mentioned, worked. That the current version (8.0.1) does not now indicates some sort of issue. If there is indeed a new version released as a package, I'd be happy to test it.

vitaut commented 3 years ago

We don't maintain vcpkg packages. If you cannot use the master branch then wait for the next release or revert to a release that worked in your environment.

acgetchell commented 3 years ago

Understood. To recap, release 8.0.1 evinces the linker error reported here and elsewhere, release 7.1.3 (+ spdlog 1.8.5) does not. When there is a new release I will test it.