[libcxx-commits] [PATCH] D157602: [libc++] Work around dynamic linking of stringstream::str() on Windows

Hans Wennborg via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Aug 16 07:21:35 PDT 2023


hans added a comment.

In D157602#4580154 <https://reviews.llvm.org/D157602#4580154>, @thakis wrote:

> @hans Hmm, I wonder if it's related to /Zc:dllexportInlines- (ref https://blog.llvm.org/2018/11/30-faster-windows-builds-with-clang-cl_14.html).

I don't think that's a factor here.

> I can't reproduce it on my machine with

Is your libcxx configured with `-DLIBCXX_ABI_UNSTABLE=ON`? The explicit instantiations are gated by `_LIBCPP_ABI_ENABLE_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1`

On my machine, the source code and revision you used reproduces the problem like this:

  cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_PROJECTS='clang;lld' -DLLVM_ENABLE_RUNTIMES='libcxx' -DLLVM_TARGETS_TO_BUILD=X86 -DLIBCXX_ABI_UNSTABLE=ON ..\llvm
  ninja cxx
  bin\clang-cl /std:c++17 \src\temp\strwin.cpp -Iinclude\c++\v1 lib\c++.lib
  strwin-b8a36d.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class std::__2::basic_string<char,struct std::__2::char_traits<char>,class std::__2::allocator<char> > __cdecl std::__2::basic_stringstream<char,struct std::__2::char_traits<char>,class std::__2::allocator<char> >::str(void)const " (__imp_?str@?$basic_stringstream at DU?$char_traits at D@__2 at std@@V?$allocator at D@23@@__2 at std@@QEBA?AV?$basic_string at DU?$char_traits at D@__2 at std@@V?$allocator at D@23@@23 at XZ) referenced in function main
  strwin.exe : fatal error LNK1120: 1 unresolved externals
  clang-cl: error: linker command failed with exit code 1120 (use -v to see invocation)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157602/new/

https://reviews.llvm.org/D157602



More information about the libcxx-commits mailing list