ClickHouse / libhdfs3

HDFS file read access for ClickHouse
Apache License 2.0
36 stars 56 forks source link

error: 'unique_lock' is not a member of `std` #56

Closed Felix-neko closed 9 months ago

Felix-neko commented 9 months ago

Hi! I'm trying to build this library under Ubuntu 22.04

I call ../bootstrap and make and get the following errors:

/home/felix/Projects/alfabank/libhdfs3/src/client/SystemECPolicies.cpp: In member function ‘void Hdfs::Internal::SystemECPolicies::addEcPolicy(int8_t, std::shared_ptr<Hdfs::Internal::ECPolicy>)’:
/home/felix/Projects/alfabank/libhdfs3/src/client/SystemECPolicies.cpp:62:10: error: ‘unique_lock’ is not a member of ‘std’
   62 |     std::unique_lock<std::shared_mutex> lock(mutex);
      |          ^~~~~~~~~~~
/home/felix/Projects/alfabank/libhdfs3/src/client/SystemECPolicies.cpp:25:1: note: ‘std::unique_lock’ is defined in header ‘<mutex>’; did you forget to ‘#include <mutex>’?
   24 | #include "SystemECPolicies.h"
  +++ |+#include <mutex>
   25 | 
/home/felix/Projects/alfabank/libhdfs3/src/client/SystemECPolicies.cpp:62:39: error: expected primary-expression before ‘>’ token
   62 |     std::unique_lock<std::shared_mutex> lock(mutex);
      |                                       ^
/home/felix/Projects/alfabank/libhdfs3/src/client/SystemECPolicies.cpp:62:41: error: ‘lock’ was not declared in this scope; did you mean ‘lockf’?
   62 |     std::unique_lock<std::shared_mutex> lock(mutex);
      |                                         ^~~~
      |                                         lockf
make[2]: *** [src/CMakeFiles/libhdfs3-static.dir/build.make:731: src/CMakeFiles/libhdfs3-static.dir/client/SystemECPolicies.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[  5%] Building CXX object src/CMakeFiles/libhdfs3-shared.dir/network/TcpSocket.cpp.o
cd /home/felix/Projects/alfabank/libhdfs3/build/src && /usr/bin/g++ -DTEST_HDFS_PREFIX=\"./\" -D_GNU_SOURCE -D__STDC_FORMAT_MACROS -Dlibhdfs3_shared_EXPORTS -I/home/felix/Projects/alfabank/libhdfs3/src -I/home/felix/Projects/alfabank/libhdfs3/src/common -I/home/felix/Projects/alfabank/libhdfs3/build/src -I/usr/include/libxml2 -I/home/felix/Projects/alfabank/libhdfs3/mock -fno-strict-aliasing -fno-omit-frame-pointer -msse4.2 -Wl,--export-dynamic -std=c++0x -D_GLIBCXX_USE_NANOSLEEP -Wall -O2 -g -DNDEBUG -fPIC -std=gnu++20 -MD -MT src/CMakeFiles/libhdfs3-shared.dir/network/TcpSocket.cpp.o -MF CMakeFiles/libhdfs3-shared.dir/network/TcpSocket.cpp.o.d -o CMakeFiles/libhdfs3-shared.dir/network/TcpSocket.cpp.o -c /home/felix/Projects/alfabank/libhdfs3/src/network/TcpSocket.cpp
/home/felix/Projects/alfabank/libhdfs3/src/client/SystemECPolicies.cpp: In member function ‘void Hdfs::Internal::SystemECPolicies::addEcPolicy(int8_t, std::shared_ptr<Hdfs::Internal::ECPolicy>)’:
/home/felix/Projects/alfabank/libhdfs3/src/client/SystemECPolicies.cpp:62:10: error: ‘unique_lock’ is not a member of ‘std’
   62 |     std::unique_lock<std::shared_mutex> lock(mutex);
      |          ^~~~~~~~~~~
/home/felix/Projects/alfabank/libhdfs3/src/client/SystemECPolicies.cpp:25:1: note: ‘std::unique_lock’ is defined in header ‘<mutex>’; did you forget to ‘#include <mutex>’?
   24 | #include "SystemECPolicies.h"
  +++ |+#include <mutex>
   25 | 
/home/felix/Projects/alfabank/libhdfs3/src/client/SystemECPolicies.cpp:62:39: error: expected primary-expression before ‘>’ token
   62 |     std::unique_lock<std::shared_mutex> lock(mutex);
      |                                       ^
/home/felix/Projects/alfabank/libhdfs3/src/client/SystemECPolicies.cpp:62:41: error: ‘lock’ was not declared in this scope; did you mean ‘lockf’?
   62 |     std::unique_lock<std::shared_mutex> lock(mutex);

How can I cope with it?

P.S.

g++ --version g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0

gcc --version gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0

tavplubix commented 9 months ago

Use clang-17, see https://clickhouse.com/docs/en/development/build