microsoft/vcpkg

[cpp-redis] ‘sleep_for’ is not a member of ‘std::this_thread’

ParticleG opened this issue · 4 comments

Host Environment

  • OS: Kali-linux (WSL2)
  • Compiler: gcc version 11.2.0 (Debian 11.2.0-13)

To Reproduce
Steps to reproduce the behavior:
./vcpkg install cpp-redis:x64-linux

Failure logs

MY_PATH/cpp_redis-src/sources/core/client.cpp: In member function ‘void cpp_redis::client::sleep_before_next_reconnect_attempt()’:
MY_PATH/cpp_redis-src/sources/core/client.cpp:347:21: error: ‘sleep_for’ is not a member of ‘std::this_thread’
  347 |   std::this_thread::sleep_for(std::chrono::milliseconds(m_reconnect_interval_msecs));

Additional context
This issue is fixed in original repo by PR#80. However this still exists on vcpkg (cpp-redis:v4.3.1#4)
I created a pull request try fixing this.

@ParticleG ,Thanks for posting this issue, I install cpp-redis:x64-linux on my local machine but I can install this port successfully:

-- Building x64-linux-dbg
-- Building x64-linux-rel
-- Installing: /home/vzhli17/vcpkg/packages/cpp-redis_x64-linux/share/cpp-redis/copyright
-- Fixing pkgconfig file: /home/vzhli17/vcpkg/packages/cpp-redis_x64-linux/lib/pkgconfig/cpp_redis.pc
-- Fixing pkgconfig file: /home/vzhli17/vcpkg/packages/cpp-redis_x64-linux/debug/lib/pkgconfig/cpp_redis.pc
-- Performing post-build validation
-- Performing post-build validation done
Installing package cpp-redis[core]:x64-linux...
Elapsed time for package cpp-redis:x64-linux: 38.95 s

Total elapsed time: 50.67 s

Did I miss something?

@ParticleG ,Thanks for posting this issue, I install cpp-redis:x64-linux on my local machine but I can install this port successfully:

-- Building x64-linux-dbg
-- Building x64-linux-rel
-- Installing: /home/vzhli17/vcpkg/packages/cpp-redis_x64-linux/share/cpp-redis/copyright
-- Fixing pkgconfig file: /home/vzhli17/vcpkg/packages/cpp-redis_x64-linux/lib/pkgconfig/cpp_redis.pc
-- Fixing pkgconfig file: /home/vzhli17/vcpkg/packages/cpp-redis_x64-linux/debug/lib/pkgconfig/cpp_redis.pc
-- Performing post-build validation
-- Performing post-build validation done
Installing package cpp-redis[core]:x64-linux...
Elapsed time for package cpp-redis:x64-linux: 38.95 s

Total elapsed time: 50.67 s

Did I miss something?

Hi there, thanks for reply. This issue only occurs on some linux distributions, in my situation is gcc-11 on kali-linux. The original pull request is on Arch linux cpp-redis/cpp_redis#80. If I downgrade my gcc version to 10, the error disappears. However add an #include<thread> would ensure std::sleep_for usable at most times.

I've just cloned a clean vcpkg and run install again, my kali on wsl2 gives the same error:

./vcpkg install cpp-redis
Computing installation plan...
A suitable version of cmake was not found (required v3.22.2). Downloading portable cmake v3.22.2...
Downloading cmake...
  https://github.com/Kitware/CMake/releases/download/v3.22.2/cmake-3.22.2-linux-x86_64.tar.gz -> /home/particleg/vcpkg/downloads/cmake-3.22.2linux-x86_64.tar.gz
Extracting cmake...
The following packages will be built and installed:
    cpp-redis[core]:x64-linux -> 4.3.1#4
  * tacopie[core]:x64-linux -> 3.2.0#3
Additional packages (*) will be modified to complete this operation.
Detecting compiler hash for triplet x64-linux...
A suitable version of ninja was not found (required v1.10.2). Downloading portable ninja v1.10.2...
Downloading ninja...
  https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-linux.zip -> /home/particleg/vcpkg/downloads/ninja-linux-1.10.2.zip
Extracting ninja...
Restored 1 packages from /home/particleg/.cache/vcpkg/archives in 28.63 ms. Use --debug to see more details.
Starting package 1/2: tacopie:x64-linux
Installing package tacopie[core]:x64-linux...
Elapsed time for package tacopie:x64-linux: 4.013 ms
Starting package 2/2: cpp-redis:x64-linux
Building package cpp-redis[core]:x64-linux...
-- Downloading https://github.com/cpp-redis/cpp_redis/archive/4.3.1.tar.gz -> cpp-redis-cpp_redis-4.3.1.tar.gz...
-- Extracting source /home/particleg/vcpkg/downloads/cpp-redis-cpp_redis-4.3.1.tar.gz
-- Using source at /home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean
-- Configuring x64-linux-dbg
-- Configuring x64-linux-rel
CMake Warning at scripts/cmake/vcpkg_configure_cmake.cmake:410 (message):
  The following variables are not used in CMakeLists.txt:

      MSVC_RUNTIME_LIBRARY_CONFIG

  Please recheck them and remove the unnecessary options from the
  `vcpkg_configure_cmake` call.

  If these options should still be passed for whatever reason, please use the
  `MAYBE_UNUSED_VARIABLES` argument.
Call Stack (most recent call first):
  ports/cpp-redis/portfile.cmake:25 (vcpkg_configure_cmake)
  scripts/ports.cmake:145 (include)


-- Building x64-linux-dbg
CMake Error at scripts/cmake/vcpkg_execute_build_process.cmake:158 (message):
    Command failed: /home/particleg/vcpkg/downloads/tools/cmake-3.22.2-linux/cmake-3.22.2-linux-x86_64/bin/cmake --build . --config Debug --target install -- -v -j17
    Working Directory: /home/particleg/vcpkg/buildtrees/cpp-redis/x64-linux-dbg
    See logs for more information:
      /home/particleg/vcpkg/buildtrees/cpp-redis/install-x64-linux-dbg-out.log

Call Stack (most recent call first):
  scripts/cmake/vcpkg_build_cmake.cmake:106 (vcpkg_execute_build_process)
  scripts/cmake/vcpkg_install_cmake.cmake:44 (vcpkg_build_cmake)
  ports/cpp-redis/portfile.cmake:32 (vcpkg_install_cmake)
  scripts/ports.cmake:145 (include)


Error: Building package cpp-redis:x64-linux failed with: BUILD_FAILED
Please ensure you're using the latest portfiles with `git pull` and `./vcpkg update`.
Then check for known issues at:
  https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+cpp-redis
You can submit a new issue at:
  https://github.com/microsoft/vcpkg/issues/new?template=report-package-build-failure.md&title=[cpp-redis]+Build+error
including:
  package: cpp-redis[core]:x64-linux -> 4.3.1#4
    vcpkg-tool version: 2022-03-09-1affd32f93b299d5a907816c328ca3ededb73a7e
    vcpkg-scripts version: a76eb002a 2022-03-24 (9 hours ago)

Additionally, attach any relevant sections from the log files above.

The content in /home/particleg/vcpkg/buildtrees/cpp-redis/install-x64-linux-dbg-out.log:

[1/16] /usr/bin/c++  -I/home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/includes -I/home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/deps/include -I/home/particleg/vcpkg/installed/x64-linux/include -fPIC -std=c++11 -W -Wall -Wextra -O3 -g -fPIC -MD -MT CMakeFiles/cpp_redis.dir/sources/misc/logger.cpp.o -MF CMakeFiles/cpp_redis.dir/sources/misc/logger.cpp.o.d -o CMakeFiles/cpp_redis.dir/sources/misc/logger.cpp.o -c /home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/sources/misc/logger.cpp
[2/16] /usr/bin/c++  -I/home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/includes -I/home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/deps/include -I/home/particleg/vcpkg/installed/x64-linux/include -fPIC -std=c++11 -W -Wall -Wextra -O3 -g -fPIC -MD -MT CMakeFiles/cpp_redis.dir/sources/builders/builders_factory.cpp.o -MF CMakeFiles/cpp_redis.dir/sources/builders/builders_factory.cpp.o.d -o CMakeFiles/cpp_redis.dir/sources/builders/builders_factory.cpp.o -c /home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/sources/builders/builders_factory.cpp
[3/16] /usr/bin/c++  -I/home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/includes -I/home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/deps/include -I/home/particleg/vcpkg/installed/x64-linux/include -fPIC -std=c++11 -W -Wall -Wextra -O3 -g -fPIC -MD -MT CMakeFiles/cpp_redis.dir/sources/builders/error_builder.cpp.o -MF CMakeFiles/cpp_redis.dir/sources/builders/error_builder.cpp.o.d -o CMakeFiles/cpp_redis.dir/sources/builders/error_builder.cpp.o -c /home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/sources/builders/error_builder.cpp
[4/16] /usr/bin/c++  -I/home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/includes -I/home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/deps/include -I/home/particleg/vcpkg/installed/x64-linux/include -fPIC -std=c++11 -W -Wall -Wextra -O3 -g -fPIC -MD -MT CMakeFiles/cpp_redis.dir/sources/builders/integer_builder.cpp.o -MF CMakeFiles/cpp_redis.dir/sources/builders/integer_builder.cpp.o.d -o CMakeFiles/cpp_redis.dir/sources/builders/integer_builder.cpp.o -c /home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/sources/builders/integer_builder.cpp
[5/16] /usr/bin/c++  -I/home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/includes -I/home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/deps/include -I/home/particleg/vcpkg/installed/x64-linux/include -fPIC -std=c++11 -W -Wall -Wextra -O3 -g -fPIC -MD -MT CMakeFiles/cpp_redis.dir/sources/builders/simple_string_builder.cpp.o -MF CMakeFiles/cpp_redis.dir/sources/builders/simple_string_builder.cpp.o.d -o CMakeFiles/cpp_redis.dir/sources/builders/simple_string_builder.cpp.o -c /home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/sources/builders/simple_string_builder.cpp
[6/16] /usr/bin/c++  -I/home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/includes -I/home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/deps/include -I/home/particleg/vcpkg/installed/x64-linux/include -fPIC -std=c++11 -W -Wall -Wextra -O3 -g -fPIC -MD -MT CMakeFiles/cpp_redis.dir/sources/builders/bulk_string_builder.cpp.o -MF CMakeFiles/cpp_redis.dir/sources/builders/bulk_string_builder.cpp.o.d -o CMakeFiles/cpp_redis.dir/sources/builders/bulk_string_builder.cpp.o -c /home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/sources/builders/bulk_string_builder.cpp
[7/16] /usr/bin/c++  -I/home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/includes -I/home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/deps/include -I/home/particleg/vcpkg/installed/x64-linux/include -fPIC -std=c++11 -W -Wall -Wextra -O3 -g -fPIC -MD -MT CMakeFiles/cpp_redis.dir/sources/builders/array_builder.cpp.o -MF CMakeFiles/cpp_redis.dir/sources/builders/array_builder.cpp.o.d -o CMakeFiles/cpp_redis.dir/sources/builders/array_builder.cpp.o -c /home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/sources/builders/array_builder.cpp
[8/16] /usr/bin/c++  -I/home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/includes -I/home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/deps/include -I/home/particleg/vcpkg/installed/x64-linux/include -fPIC -std=c++11 -W -Wall -Wextra -O3 -g -fPIC -MD -MT CMakeFiles/cpp_redis.dir/sources/network/tcp_client.cpp.o -MF CMakeFiles/cpp_redis.dir/sources/network/tcp_client.cpp.o.d -o CMakeFiles/cpp_redis.dir/sources/network/tcp_client.cpp.o -c /home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/sources/network/tcp_client.cpp
[9/16] /usr/bin/c++  -I/home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/includes -I/home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/deps/include -I/home/particleg/vcpkg/installed/x64-linux/include -fPIC -std=c++11 -W -Wall -Wextra -O3 -g -fPIC -MD -MT CMakeFiles/cpp_redis.dir/sources/builders/reply_builder.cpp.o -MF CMakeFiles/cpp_redis.dir/sources/builders/reply_builder.cpp.o.d -o CMakeFiles/cpp_redis.dir/sources/builders/reply_builder.cpp.o -c /home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/sources/builders/reply_builder.cpp
[10/16] /usr/bin/c++  -I/home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/includes -I/home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/deps/include -I/home/particleg/vcpkg/installed/x64-linux/include -fPIC -std=c++11 -W -Wall -Wextra -O3 -g -fPIC -MD -MT CMakeFiles/cpp_redis.dir/sources/core/reply.cpp.o -MF CMakeFiles/cpp_redis.dir/sources/core/reply.cpp.o.d -o CMakeFiles/cpp_redis.dir/sources/core/reply.cpp.o -c /home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/sources/core/reply.cpp
[11/16] /usr/bin/c++  -I/home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/includes -I/home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/deps/include -I/home/particleg/vcpkg/installed/x64-linux/include -fPIC -std=c++11 -W -Wall -Wextra -O3 -g -fPIC -MD -MT CMakeFiles/cpp_redis.dir/sources/network/redis_connection.cpp.o -MF CMakeFiles/cpp_redis.dir/sources/network/redis_connection.cpp.o.d -o CMakeFiles/cpp_redis.dir/sources/network/redis_connection.cpp.o -c /home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/sources/network/redis_connection.cpp
[12/16] /usr/bin/c++  -I/home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/includes -I/home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/deps/include -I/home/particleg/vcpkg/installed/x64-linux/include -fPIC -std=c++11 -W -Wall -Wextra -O3 -g -fPIC -MD -MT CMakeFiles/cpp_redis.dir/sources/core/subscriber.cpp.o -MF CMakeFiles/cpp_redis.dir/sources/core/subscriber.cpp.o.d -o CMakeFiles/cpp_redis.dir/sources/core/subscriber.cpp.o -c /home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/sources/core/subscriber.cpp
[13/16] /usr/bin/c++  -I/home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/includes -I/home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/deps/include -I/home/particleg/vcpkg/installed/x64-linux/include -fPIC -std=c++11 -W -Wall -Wextra -O3 -g -fPIC -MD -MT CMakeFiles/cpp_redis.dir/sources/core/sentinel.cpp.o -MF CMakeFiles/cpp_redis.dir/sources/core/sentinel.cpp.o.d -o CMakeFiles/cpp_redis.dir/sources/core/sentinel.cpp.o -c /home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/sources/core/sentinel.cpp
[14/16] /usr/bin/c++  -I/home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/includes -I/home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/deps/include -I/home/particleg/vcpkg/installed/x64-linux/include -fPIC -std=c++11 -W -Wall -Wextra -O3 -g -fPIC -MD -MT CMakeFiles/cpp_redis.dir/sources/core/client.cpp.o -MF CMakeFiles/cpp_redis.dir/sources/core/client.cpp.o.d -o CMakeFiles/cpp_redis.dir/sources/core/client.cpp.o -c /home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/sources/core/client.cpp
FAILED: CMakeFiles/cpp_redis.dir/sources/core/client.cpp.o 
/usr/bin/c++  -I/home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/includes -I/home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/deps/include -I/home/particleg/vcpkg/installed/x64-linux/include -fPIC -std=c++11 -W -Wall -Wextra -O3 -g -fPIC -MD -MT CMakeFiles/cpp_redis.dir/sources/core/client.cpp.o -MF CMakeFiles/cpp_redis.dir/sources/core/client.cpp.o.d -o CMakeFiles/cpp_redis.dir/sources/core/client.cpp.o -c /home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/sources/core/client.cpp
/home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/sources/core/client.cpp: In member function ‘void cpp_redis::client::sleep_before_next_reconnect_attempt()’:
/home/particleg/vcpkg/buildtrees/cpp-redis/src/4.3.1-dddd39f2e4.clean/sources/core/client.cpp:347:21: error: ‘sleep_for’ is not a member of ‘std::this_thread’
  347 |   std::this_thread::sleep_for(std::chrono::milliseconds(m_reconnect_interval_msecs));
      |                     ^~~~~~~~~
ninja: build stopped: subcommand failed.