[libcxx-commits] [PATCH] D99178: [libcxx] Disable c++experimental by default in DLL builds
Martin Storsjö via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Mar 23 05:06:53 PDT 2021
mstorsjo created this revision.
Herald added a subscriber: mgorny.
mstorsjo requested review of this revision.
Herald added a project: libc++.
Herald added a reviewer: libc++.
c++experimental is always created as a static library, but if the
libcxx headers indicate DLL linkage, linking against c++experimental
fails (with unresolved symbols).
Set LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY to OFF by default in such
configurations. If enabled anyway, mark the tests under std/experimental
as unsupported.
Remove the explicit LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF from the
examples for how to build the library.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D99178
Files:
libcxx/CMakeLists.txt
libcxx/docs/BuildingLibcxx.rst
libcxx/test/std/experimental/lit.local.cfg
Index: libcxx/test/std/experimental/lit.local.cfg
===================================================================
--- libcxx/test/std/experimental/lit.local.cfg
+++ libcxx/test/std/experimental/lit.local.cfg
@@ -1,3 +1,7 @@
# Disable all of the experimental tests if the correct feature is not available.
if 'c++experimental' not in config.available_features:
config.unsupported = True
+# If built as a DLL on Windows, headers indicate DLL linkage, which breaks
+# linking against the static-only libc++experimental.
+if config.enable_shared and 'windows' in config.available_features:
+ config.unsupported = True
Index: libcxx/docs/BuildingLibcxx.rst
===================================================================
--- libcxx/docs/BuildingLibcxx.rst
+++ libcxx/docs/BuildingLibcxx.rst
@@ -90,7 +90,6 @@
-T "ClangCL" ^
-DLIBCXX_ENABLE_SHARED=YES ^
-DLIBCXX_ENABLE_STATIC=NO ^
- -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=NO ^
\path\to\libcxx
> cmake --build .
@@ -120,7 +119,6 @@
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_C_COMPILER=clang-cl ^
-DCMAKE_CXX_COMPILER=clang-cl ^
- -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=NO ^
path/to/libcxx
> ninja cxx
> ninja check-cxx
Index: libcxx/CMakeLists.txt
===================================================================
--- libcxx/CMakeLists.txt
+++ libcxx/CMakeLists.txt
@@ -88,7 +88,13 @@
option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." OFF)
option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
option(LIBCXX_ENABLE_STATIC "Build libc++ as a static library." ON)
-option(LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY "Build libc++experimental.a" ON)
+set(ENABLE_EXPERIMENTAL_DEFAULT ON)
+if (WIN32 AND LIBCXX_ENABLE_SHARED)
+ # When libc++ is built as a DLL, all headers indicate DLL linkage, while
+ # libc++experimental always is linked statically.
+ set(ENABLE_EXPERIMENTAL_DEFAULT OFF)
+endif()
+option(LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY "Build libc++experimental.a" ${ENABLE_EXPERIMENTAL_DEFAULT})
set(ENABLE_FILESYSTEM_DEFAULT ON)
if (WIN32 AND NOT MINGW)
# Filesystem is buildable for windows, but it requires __int128 helper
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99178.332629.patch
Type: text/x-patch
Size: 2476 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210323/734953b6/attachment.bin>
More information about the libcxx-commits
mailing list