From 1b66e418d9e8b1245e9332340f7e51393c39c90b Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 3 Apr 2024 11:55:53 +0800 Subject: [PATCH 1/2] tls: include used header of this should address the build failure with modules enabled: ``` FAILED: src/CMakeFiles/seastar-module.dir/net/tls.cc.o /home/kefu/.local/bin/clang++ -DFMT_SHARED -DSEASTAR_API_LEVEL=7 -DSEASTAR_COROUTINES_ENABLED -DSEASTAR_MODULE -DSEASTAR_SCHEDULING_GROUPS_COUNT=16 -DSEASTAR_SSTRING -Dseastar_module_EXPORTS -I/home/kefu/dev/seastar/include -I/home/kefu/d ev/seastar/build/debug/gen/include -I/home/kefu/dev/seastar/src -g -std=c++23 -fPIC -U_FORTIFY_SOURCE -Wno-include-angled-in-module-purview -MD -MT src/CMakeFiles/seastar-module.dir/net/tls.cc.o -MF src/CMakeFiles/seastar-module.dir/net/t ls.cc.o.d @src/CMakeFiles/seastar-module.dir/net/tls.cc.o.modmap -o src/CMakeFiles/seastar-module.dir/net/tls.cc.o -c /home/kefu/dev/seastar/src/net/tls.cc /home/kefu/dev/seastar/src/net/tls.cc:930:14: error: missing '#include '; 'unordered_set' must be declared before it is used 930 | std::unordered_set _all_files; | ^ /usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/unordered_set.h:104:11: note: declaration here is not visible 104 | class unordered_set | ^ /home/kefu/dev/seastar/src/net/tls.cc:892:44: error: missing '#include '; 'unordered_set' must be declared before it is used 892 | _cb(boost::copy_range>(_files | boost::adaptors::map_keys), std::move(ep)); | ^ /usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/unordered_set.h:104:11: note: declaration here is not visible 104 | class unordered_set | ^ /home/kefu/dev/seastar/src/net/tls.cc:1574:73: error: missing '#include '; 'unordered_set' must be declared before it is used 1574 | future> get_alt_name_information(std::unordered_set types) { | ^ /usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/unordered_set.h:104:11: note: declaration here is not visible 104 | class unordered_set | ^ /home/kefu/dev/seastar/src/net/tls.cc:1793:73: error: missing '#include '; 'unordered_set' must be declared before it is used 1793 | future> get_alt_name_information(std::unordered_set types) { | ^ /usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/unordered_set.h:104:11: note: declaration here is not visible 104 | class unordered_set | ^ /home/kefu/dev/seastar/src/net/tls.cc:1977:105: error: missing '#include '; 'unordered_set' must be declared before it is used 1977 | future> tls::get_alt_name_information(connected_socket& socket, std::unordered_set types) { | ^ /usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/unordered_set.h:104:11: note: declaration here is not visible 104 | class unordered_set | ^ ``` Signed-off-by: Kefu Chai --- src/net/tls.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/net/tls.cc b/src/net/tls.cc index b2914355ca0..00db206e1de 100644 --- a/src/net/tls.cc +++ b/src/net/tls.cc @@ -28,6 +28,7 @@ module; #include #include #include +#include #include #include From da774093b0f868c7f8edff4a2a0b569e749945e7 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 3 Apr 2024 11:59:55 +0800 Subject: [PATCH 2/2] seastar.cc: include used header this allows all module implementation units to use a single definition without worrying about using different definitions in different units. without this change, clang-18 and libstdc++ shipped by GCC-13 fails to build the tree like: ``` FAILED: src/CMakeFiles/seastar-module.dir/core/memory.cc.o /home/kefu/.local/bin/clang++ -DFMT_SHARED -DSEASTAR_API_LEVEL=7 -DSEASTAR_COROUTINES_ENABLED -DSEASTAR_MODULE -DSEASTAR_SCHEDULING_GROUPS_COUNT=16 -DSEASTAR_SSTRING -Dseastar_module_EXPORTS -I/home/kefu/dev/seastar/include -I/home/kefu/d ev/seastar/build/debug/gen/include -I/home/kefu/dev/seastar/src -g -std=c++23 -fPIC -U_FORTIFY_SOURCE -Wno-include-angled-in-module-purview -MD -MT src/CMakeFiles/seastar-module.dir/core/memory.cc.o -MF src/CMakeFiles/seastar-module.dir/c ore/memory.cc.o.d @src/CMakeFiles/seastar-module.dir/core/memory.cc.o.modmap -o src/CMakeFiles/seastar-module.dir/core/memory.cc.o -c /home/kefu/dev/seastar/src/core/memory.cc In module 'seastar' imported from /home/kefu/dev/seastar/src/core/memory.cc:111: /usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/unordered_set.h:1827:5: error: 'std::operator==' has different definitions in different modules; definition in module 'seastar' first difference is function body 1826 | inline bool | ~~~~~~~~~~~ 1827 | operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1828 | const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1829 | { return __x._M_h._M_equal(__y._M_h); } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/unordered_set.h:1827:5: note: but in '' found a different body 1826 | inline bool | ~~~~~~~~~~~ 1827 | operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1828 | const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1829 | { return __x._M_h._M_equal(__y._M_h); } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In module 'seastar' imported from /home/kefu/dev/seastar/src/core/memory.cc:111: /usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/unordered_set.h:1813:5: error: 'std::operator==' has different definitions in different modules; definition in module 'seastar' first difference is function body 1812 | inline bool | ~~~~~~~~~~~ 1813 | operator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1814 | const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1815 | { return __x._M_h._M_equal(__y._M_h); } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` Signed-off-by: Kefu Chai --- src/seastar.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/seastar.cc b/src/seastar.cc index 88f111d4bde..416faa97c75 100644 --- a/src/seastar.cc +++ b/src/seastar.cc @@ -88,6 +88,7 @@ module; #include #include #include +#include #include #include #include