From 9fd172f496ddf3794dda45e8b7c3f713418be970 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Wed, 26 May 2021 02:44:29 +0300 Subject: android: Fix file system library usage on gcc 7 and 8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On gcc versions older than 9, the file system library, used by the Android camera HAL configuration file parser, is implemented in a separate static library. Furthermore, on gcc 7, it's provided in the std::experimental namespace. This breaks compilation of the HAL on gcc 7, and linking on gcc 8. Fix the compilation issue by conditionally including and creating a namespace alias in std, and the link issue by linking to libstdc++fs on gcc versions older than 9. The inclusion of is a bit of a hack, and when we'll start using the file system library in another compilation unit, we should then move all this to an internal helper to abstract the compiler version. Signed-off-by: Laurent Pinchart Reviewed-by: Hirokazu Honda Reviewed-by: Jacopo Mondi Reviewed-by: Niklas Söderlund --- src/android/camera_hal_config.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/android/camera_hal_config.cpp b/src/android/camera_hal_config.cpp index d15df2e3..f33ba269 100644 --- a/src/android/camera_hal_config.cpp +++ b/src/android/camera_hal_config.cpp @@ -6,7 +6,14 @@ */ #include "camera_hal_config.h" +#if defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE < 8 +#include +namespace std { +namespace filesystem = std::experimental::filesystem; +} +#else #include +#endif #include #include #include -- cgit v1.2.1