<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/96430>96430</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[libcxx] it should pass -Xlinker when user uses clang instead of clang-cl for build libcxx
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang,
libc++
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
trcrsired
</td>
</tr>
</table>
<pre>
```
[cqwrteur@DESKTOP-9B705LH llvm_build]$ /home/cqwrteur/toolchains/llvm/x86_64-unknown-linux-gnu/llvm/bin/clang++ --target=x86_64-windows-msvc -nostartfiles -nostdlib -fuse-ld=lld --sysroot=/home/cqwrteur/toolchains/windows-msvc-sysroot -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -O0 -D_DEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrtd -g -Xclang -gcodeview /MANIFEST:NO -fuse-ld=lld-link -shared -o lib/c++.dll -Xlinker /MANIFEST:EMBED -Xlinker /implib:lib/c++.lib -Xlinker /pdb:lib/c++.pdb -Xlinker /version:1.0 libcxx/src/CMakeFiles/cxx_shared.dir/algorithm.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/any.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/bind.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/call_once.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/charconv.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/chrono.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/error_category.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/exception.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/expected.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/filesystem/filesystem_clock.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/filesystem/filesystem_error.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/filesystem/path.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/functional.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/hash.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/legacy_pointer_safety.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/memory.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/memory_resource.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/new_handler.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/new_helpers.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/optional.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/print.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/random_shuffle.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/ryu/d2fixed.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/ryu/d2s.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/ryu/f2s.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/stdexcept.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/string.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/system_error.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/typeinfo.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/valarray.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/variant.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/vector.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/verbose_abort.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/atomic.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/barrier.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/condition_variable_destructor.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/condition_variable.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/future.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/mutex_destructor.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/mutex.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/shared_mutex.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/thread.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/random.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/fstream.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/ios.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/ios.instantiations.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/iostream.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/locale.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/ostream.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/regex.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/strstream.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/support/win32/locale_win32.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/support/win32/support.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/support/win32/thread_win32.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/filesystem/directory_entry.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/filesystem/directory_iterator.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/filesystem/operations.cpp.obj libcxx/src/CMakeFiles/cxx_shared.dir/filesystem/int128_builtins.cpp.obj -nostdlib++ --unwindlib=none -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -loldnames
clang++: error: no such file or directory: '/MANIFEST:NO'
```
```
diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt
index 9e6c70335a79..c19041dd9da6 100644
--- a/libcxx/src/CMakeLists.txt
+++ b/libcxx/src/CMakeLists.txt
@@ -275,8 +275,14 @@ if (LIBCXX_ENABLE_SHARED)
# Since we most likely do not have a mt.exe replacement, disable the
# manifest bundling. This allows a normal cmake invocation to pass which
# will attempt to use the manifest tool to generate the bundled manifest
- set_target_properties(cxx_shared PROPERTIES
+ if (${CMAKE_CXX_COMPILER_FRONTEND_VARIANT} STREQUAL "MSVC")
+ set_target_properties(cxx_shared PROPERTIES
APPEND_STRING PROPERTY LINK_FLAGS " /MANIFEST:NO")
+ else()
+ set_target_properties(cxx_shared PROPERTIES
+ APPEND_STRING PROPERTY LINK_FLAGS " -Xlinker /MANIFEST:NO")
+ endif()
+
endif()
endif()
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysWVtz27gO_jXMC4YehfL1wQ92bHczze0k2W3Pk4YSYYkbitSSlC_n15-h5LpN2p3uMu10YonE9wEEAYiCuHOy1IhzMlqS0eqCt74ydu5tYZ20KC5yI45zMk5O_5MVSRZktCz-2luPrSXDZLV--vh8_0Bny0kyuvkNlNrVWd5KJchoRdgQCNtUpkbCNmcU23hjVFFxqR1hmwAhbHOYjrPxkLb6RZu9pkrq9kBL3X6VyKUONIrrkrAlYUug1HNboifp6gTfSy3M3tHa7Qqg2jjPrd9Kha6_E0rmQLetQ6oESVdKCaDUHZ01JtD83NxvNXwBAv2E1hpL0pXgHqmXNX4z1uqy5VagoHzHpeK5VNIfqcY90E9cqSB68JYD_aQNbXXrUNCGW16jRwv0095Kj9R5K3XpgH4quPP0r5YHZC2dk7qkW4lKUKmll1zJ_6ENgrJulCykp1uulK-sacsq4M0OLQrq9tIXFRW45a3yvXpt8FBg46k_NtgNabqT1rdcUeFNMEegQo_0BzOuLUt0ngZ-K0XA91bTwugdWieN7m1WyEUYl1qg9tz3E4Xngtb8mCNttWubxliPAuh9AnSVrdbL3z90Fzc34ef2GejnLh6AUoENdlxUyZykq7A_1gug5VehsjACdxL3ISxvF3fXm_XTM0kXd_fwJihC_L0AdRW3Qb-B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