Title: [268708] trunk
Revision
268708
Author
lmo...@igalia.com
Date
2020-10-19 19:15:51 -0700 (Mon, 19 Oct 2020)

Log Message

REGRESSION(r268115) [GTK] Build failures with GCC 7 (Ubuntu 18.04) and GCC 8 (Debian Buster)
https://bugs.webkit.org/show_bug.cgi?id=217425

Reviewed by Carlos Alberto Lopez Perez.

.:

The root cause is lack of proper <filesystem> support in gcc7/8 (and
incompatibility with llvm's header that was included). As such, we
need to check whether to use <filesystem>, <experimental/filesystem>,
or fallback to the included header.

Note: In some systems like Ubuntu 20.04, gcc-8 can use gcc-9's
libstdc++ and link successfully, but running will fail as it should
actually link with its libstc++fs to provide the correct symbols. As
this is some corner case (Ubuntu's 20 default gcc is 9), LDFLAGS
can be used to overcome this.

* Source/cmake/OptionsCommon.cmake: Add a HAVE directive to
check whether <experimental/filesystem> is the filesystem impl
available.
* Source/cmake/WebKitCompilerFlags.cmake: Test first whether
<filesystem> can be used, with <experimental/filestystem> as fallback.

Source/WTF:

* wtf/StdFilesystem.h: Add fallback to <experimental/filesystem> if available.

Tools:

* WebKitTestRunner/CMakeLists.txt: Link with stdc++fs if using
<experimental/filesystem>.

Modified Paths

Diff

Modified: trunk/ChangeLog (268707 => 268708)


--- trunk/ChangeLog	2020-10-20 02:08:19 UTC (rev 268707)
+++ trunk/ChangeLog	2020-10-20 02:15:51 UTC (rev 268708)
@@ -1,3 +1,27 @@
+2020-10-19  Lauro Moura  <lmo...@igalia.com>
+
+        REGRESSION(r268115) [GTK] Build failures with GCC 7 (Ubuntu 18.04) and GCC 8 (Debian Buster)
+        https://bugs.webkit.org/show_bug.cgi?id=217425
+
+        Reviewed by Carlos Alberto Lopez Perez.
+
+        The root cause is lack of proper <filesystem> support in gcc7/8 (and
+        incompatibility with llvm's header that was included). As such, we
+        need to check whether to use <filesystem>, <experimental/filesystem>,
+        or fallback to the included header.
+
+        Note: In some systems like Ubuntu 20.04, gcc-8 can use gcc-9's
+        libstdc++ and link successfully, but running will fail as it should
+        actually link with its libstc++fs to provide the correct symbols. As
+        this is some corner case (Ubuntu's 20 default gcc is 9), LDFLAGS
+        can be used to overcome this.
+
+        * Source/cmake/OptionsCommon.cmake: Add a HAVE directive to
+        check whether <experimental/filesystem> is the filesystem impl
+        available.
+        * Source/cmake/WebKitCompilerFlags.cmake: Test first whether
+        <filesystem> can be used, with <experimental/filestystem> as fallback.
+
 2020-10-14  Zan Dobersek  <zdober...@igalia.com>
 
         Remove ACCELERATED_2D_CANVAS build flags and guarded code

Modified: trunk/Source/WTF/ChangeLog (268707 => 268708)


--- trunk/Source/WTF/ChangeLog	2020-10-20 02:08:19 UTC (rev 268707)
+++ trunk/Source/WTF/ChangeLog	2020-10-20 02:15:51 UTC (rev 268708)
@@ -1,3 +1,12 @@
+2020-10-19  Lauro Moura  <lmo...@igalia.com>
+
+        REGRESSION(r268115) [GTK] Build failures with GCC 7 (Ubuntu 18.04) and GCC 8 (Debian Buster)
+        https://bugs.webkit.org/show_bug.cgi?id=217425
+
+        Reviewed by Carlos Alberto Lopez Perez.
+
+        * wtf/StdFilesystem.h: Add fallback to <experimental/filesystem> if available.
+
 2020-10-19  Chris Dumez  <cdu...@apple.com>
 
         [GPU Process] RemoteAudioDestination::render() should not need to dispatch to the main thread to do IPC

Modified: trunk/Source/WTF/wtf/StdFilesystem.h (268707 => 268708)


--- trunk/Source/WTF/wtf/StdFilesystem.h	2020-10-20 02:08:19 UTC (rev 268707)
+++ trunk/Source/WTF/wtf/StdFilesystem.h	2020-10-20 02:15:51 UTC (rev 268708)
@@ -9,6 +9,11 @@
 
 #if __has_include(<filesystem>)
 #include <filesystem>
+#elif HAVE(STD_EXPERIMENTAL_FILESYSTEM)
+#include <experimental/filesystem>
+namespace std {
+namespace filesystem = std::experimental::filesystem;
+}
 #else
 
 /* Imports a copy of <filesystem> from r343838 of the libc++ project. This

Modified: trunk/Source/cmake/OptionsCommon.cmake (268707 => 268708)


--- trunk/Source/cmake/OptionsCommon.cmake	2020-10-20 02:08:19 UTC (rev 268707)
+++ trunk/Source/cmake/OptionsCommon.cmake	2020-10-20 02:15:51 UTC (rev 268708)
@@ -153,3 +153,8 @@
 if (HAVE_INT128_VALUE)
   SET_AND_EXPOSE_TO_BUILD(HAVE_INT128_T INT128_VALUE)
 endif ()
+
+# Check whether experimental/filesystem is the filesystem impl available
+if (STD_EXPERIMENTAL_FILESYSTEM_IS_AVAILABLE)
+  SET_AND_EXPOSE_TO_BUILD(HAVE_STD_EXPERIMENTAL_FILESYSTEM TRUE)
+endif ()

Modified: trunk/Source/cmake/WebKitCompilerFlags.cmake (268707 => 268708)


--- trunk/Source/cmake/WebKitCompilerFlags.cmake	2020-10-20 02:08:19 UTC (rev 268707)
+++ trunk/Source/cmake/WebKitCompilerFlags.cmake	2020-10-20 02:15:51 UTC (rev 268708)
@@ -282,4 +282,25 @@
         check_cxx_source_compiles("${ATOMIC_TEST_SOURCE}" ATOMIC_INT64_REQUIRES_LIBATOMIC)
         unset(CMAKE_REQUIRED_LIBRARIES)
     endif ()
+
+    # <filesystem> vs <experimental/filesystem>
+    set(FILESYSTEM_TEST_SOURCE "
+        #include <filesystem>
+        int main() { std::filesystem::path p1(\"\"); std::filesystem::status(p1); }
+    ")
+    set(CMAKE_REQUIRED_FLAGS "--std=c++17")
+    check_cxx_source_compiles("${FILESYSTEM_TEST_SOURCE}" STD_FILESYSTEM_IS_AVAILABLE)
+    if (NOT STD_FILESYSTEM_IS_AVAILABLE)
+        set(EXPERIMENTAL_FILESYSTEM_TEST_SOURCE "
+            #include <experimental/filesystem>
+            int main() {
+                std::experimental::filesystem::path p1(\"//home\");
+                std::experimental::filesystem::status(p1);
+            }
+        ")
+        set(CMAKE_REQUIRED_LIBRARIES stdc++fs)
+        check_cxx_source_compiles("${EXPERIMENTAL_FILESYSTEM_TEST_SOURCE}" STD_EXPERIMENTAL_FILESYSTEM_IS_AVAILABLE)
+        unset(CMAKE_REQUIRED_LIBRARIES)
+    endif ()
+    unset(CMAKE_REQUIRED_FLAGS)
 endif ()

Modified: trunk/Tools/ChangeLog (268707 => 268708)


--- trunk/Tools/ChangeLog	2020-10-20 02:08:19 UTC (rev 268707)
+++ trunk/Tools/ChangeLog	2020-10-20 02:15:51 UTC (rev 268708)
@@ -1,3 +1,13 @@
+2020-10-19  Lauro Moura  <lmo...@igalia.com>
+
+        REGRESSION(r268115) [GTK] Build failures with GCC 7 (Ubuntu 18.04) and GCC 8 (Debian Buster)
+        https://bugs.webkit.org/show_bug.cgi?id=217425
+
+        Reviewed by Carlos Alberto Lopez Perez.
+
+        * WebKitTestRunner/CMakeLists.txt: Link with stdc++fs if using
+        <experimental/filesystem>.
+
 2020-10-19  Ryan Haddad  <ryanhad...@apple.com>
 
         Unreviewed, reverting r268693.

Modified: trunk/Tools/WebKitTestRunner/CMakeLists.txt (268707 => 268708)


--- trunk/Tools/WebKitTestRunner/CMakeLists.txt	2020-10-20 02:08:19 UTC (rev 268707)
+++ trunk/Tools/WebKitTestRunner/CMakeLists.txt	2020-10-20 02:15:51 UTC (rev 268708)
@@ -26,6 +26,12 @@
     WebKit::WebKit
 )
 
+if (COMPILER_IS_GCC_OR_CLANG)
+    if (HAVE_STD_EXPERIMENTAL_FILESYSTEM)
+        list(APPEND WebKitTestRunner_LIBRARIES stdc++fs)
+    endif ()
+endif ()
+
 set(WebKitTestRunner_INCLUDE_DIRECTORIES
     ${CMAKE_BINARY_DIR}
     ${WebKitTestRunner_SHARED_DIR}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to