<div dir="ltr"><div dir="ltr">.Hi Laurent, thank you for the patch</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, May 26, 2021 at 9:09 AM Laurent Pinchart <<a href="mailto:laurent.pinchart@ideasonboard.com">laurent.pinchart@ideasonboard.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On gcc versions older than 9, the file system library, used by the<br>
Android camera HAL configuration file parser, is implemented in a<br>
separate static library. Furthermore, on gcc 7, it's provided in the<br>
std::experimental namespace. This breaks compilation of the HAL on gcc<br>
7, and linking on gcc 8.<br>
<br>
Fix the compilation issue by conditionally including<br>
<experimental/filesystem> and creating a namespace alias in std, and the<br>
link issue by linking to libstdc++fs on gcc versions older than 9.<br>
<br>
The inclusion of <experimental/filesystem> is a bit of a hack, and when<br>
we'll start using the file system library in another compilation unit,<br>
we should then move all this to an internal helper to abstract the<br>
compiler version.<br>
<br>
Signed-off-by: Laurent Pinchart <<a href="mailto:laurent.pinchart@ideasonboard.com" target="_blank">laurent.pinchart@ideasonboard.com</a>><br></blockquote><div><br></div><div>Reviewed-by: Hirokazu Honda <<a href="mailto:hiroh@chromium.org">hiroh@chromium.org</a>> </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
---<br>
meson.build | 8 ++++++++<br>
src/android/camera_hal_config.cpp | 7 +++++++<br>
2 files changed, 15 insertions(+)<br>
<br>
diff --git a/meson.build b/meson.build<br>
index 6626fa7ed154..2e7dffb70acc 100644<br>
--- a/meson.build<br>
+++ b/meson.build<br>
@@ -76,6 +76,14 @@ if cc.get_id() == 'gcc'<br>
error('gcc version is too old, libcamera requires 7.0 or newer')<br>
endif<br>
<br>
+ # On gcc 7 and 8, the file system library is provided in a separate static<br>
+ # library.<br>
+ if cc.version().version_compare('<9')<br>
+ cpp_arguments += [<br>
+ '-lstdc++fs',<br>
+ ]<br>
+ endif<br>
+<br>
# gcc 7.1 introduced processor-specific ABI breakages related to parameter<br>
# passing on ARM platforms. This generates a large number of messages<br>
# during compilation with gcc >=7.1. Silence them.<br>
diff --git a/src/android/camera_hal_config.cpp b/src/android/camera_hal_config.cpp<br>
index d15df2e30c2c..f33ba26935da 100644<br>
--- a/src/android/camera_hal_config.cpp<br>
+++ b/src/android/camera_hal_config.cpp<br>
@@ -6,7 +6,14 @@<br>
*/<br>
#include "camera_hal_config.h"<br>
<br>
+#if defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE < 8<br>
+#include <experimental/filesystem><br>
+namespace std {<br>
+namespace filesystem = std::experimental::filesystem;<br>
+}<br>
+#else<br>
#include <filesystem><br>
+#endif<br>
#include <stdio.h><br>
#include <stdlib.h><br>
#include <string><br>
-- <br>
Regards,<br>
<br>
Laurent Pinchart<br>
<br>
</blockquote></div></div>