Я пытаюсь использовать Boost::Beast для WebSocket в своем проекте CMake. Но у меня возникли проблемы с CMake, чтобы найти пакет Boost. Я попробовал как Boost_USE_STATIC_LIBS=OFF, так и ON.
Release build.
-- Found Boost 1.86.0 at /opt/homebrew/lib/cmake/Boost-1.86.0
-- Requested configuration: REQUIRED COMPONENTS system
-- BoostConfig: find_package(boost_headers 1.86.0 EXACT CONFIG REQUIRED HINTS /opt/homebrew/lib/cmake)
-- Found boost_headers 1.86.0 at /opt/homebrew/lib/cmake/boost_headers-1.86.0
-- BoostConfig: find_package(boost_system 1.86.0 EXACT CONFIG REQUIRED HINTS /opt/homebrew/lib/cmake)
-- Found boost_system 1.86.0 at /opt/homebrew/lib/cmake/boost_system-1.86.0
CMake Error at /opt/homebrew/lib/cmake/BoostDetectToolset-1.86.0.cmake:5 (string):
string sub-command REGEX, mode MATCHALL needs at least 5 arguments total to
command.
Call Stack (most recent call first):
/opt/homebrew/lib/cmake/boost_system-1.86.0/boost_system-config.cmake:29 (include)
/opt/homebrew/lib/cmake/Boost-1.86.0/BoostConfig.cmake:141 (find_package)
/opt/homebrew/lib/cmake/Boost-1.86.0/BoostConfig.cmake:262 (boost_find_component)
CMakeLists.txt:26 (find_package)
-- Boost toolset is unknown (compiler )
-- Scanning /opt/homebrew/lib/cmake/boost_system-1.86.0/libboost_system-variant*.cmake
-- Including /opt/homebrew/lib/cmake/boost_system-1.86.0/libboost_system-variant-mt-shared.cmake
-- [x] libboost_system-mt.dylib
CMake Warning (dev) at /opt/homebrew/lib/cmake/boost_system-1.86.0/libboost_system-variant-mt-shared.cmake:63 (add_library):
ADD_LIBRARY called with SHARED option but the target platform does not
support dynamic linking. Building a STATIC library instead. This may lead
to problems.
Call Stack (most recent call first):
/opt/homebrew/lib/cmake/boost_system-1.86.0/boost_system-config.cmake:53 (include)
/opt/homebrew/lib/cmake/Boost-1.86.0/BoostConfig.cmake:141 (find_package)
/opt/homebrew/lib/cmake/Boost-1.86.0/BoostConfig.cmake:262 (boost_find_component)
CMakeLists.txt:26 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Including /opt/homebrew/lib/cmake/boost_system-1.86.0/libboost_system-variant-mt-static.cmake
-- [ ] libboost_system-mt.a
-- Including /opt/homebrew/lib/cmake/boost_system-1.86.0/libboost_system-variant-shared.cmake
-- [ ] libboost_system.dylib
-- Including /opt/homebrew/lib/cmake/boost_system-1.86.0/libboost_system-variant-static.cmake
-- [ ] libboost_system.a
-- Adding boost_system dependencies: headers
-- The C compiler identification is AppleClang 15.0.0.15000309
-- The CXX compiler identification is AppleClang 15.0.0.15000309
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Boost system found: 1
Я пытаюсь использовать Boost::Beast для WebSocket в своем проекте CMake. Но у меня возникли проблемы с CMake, чтобы найти пакет Boost. Я попробовал как Boost_USE_STATIC_LIBS=OFF, так и ON. [code]cmake_minimum_required (VERSION 3.20)
# set the build type if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release) endif(NOT CMAKE_BUILD_TYPE)
[/code] Вывод: [code]Release build. -- Found Boost 1.86.0 at /opt/homebrew/lib/cmake/Boost-1.86.0 -- Requested configuration: REQUIRED COMPONENTS system -- BoostConfig: find_package(boost_headers 1.86.0 EXACT CONFIG REQUIRED HINTS /opt/homebrew/lib/cmake) -- Found boost_headers 1.86.0 at /opt/homebrew/lib/cmake/boost_headers-1.86.0 -- BoostConfig: find_package(boost_system 1.86.0 EXACT CONFIG REQUIRED HINTS /opt/homebrew/lib/cmake) -- Found boost_system 1.86.0 at /opt/homebrew/lib/cmake/boost_system-1.86.0 CMake Error at /opt/homebrew/lib/cmake/BoostDetectToolset-1.86.0.cmake:5 (string): string sub-command REGEX, mode MATCHALL needs at least 5 arguments total to command. Call Stack (most recent call first): /opt/homebrew/lib/cmake/boost_system-1.86.0/boost_system-config.cmake:29 (include) /opt/homebrew/lib/cmake/Boost-1.86.0/BoostConfig.cmake:141 (find_package) /opt/homebrew/lib/cmake/Boost-1.86.0/BoostConfig.cmake:262 (boost_find_component) CMakeLists.txt:26 (find_package)
-- Boost toolset is unknown (compiler ) -- Scanning /opt/homebrew/lib/cmake/boost_system-1.86.0/libboost_system-variant*.cmake -- Including /opt/homebrew/lib/cmake/boost_system-1.86.0/libboost_system-variant-mt-shared.cmake -- [x] libboost_system-mt.dylib CMake Warning (dev) at /opt/homebrew/lib/cmake/boost_system-1.86.0/libboost_system-variant-mt-shared.cmake:63 (add_library): ADD_LIBRARY called with SHARED option but the target platform does not support dynamic linking. Building a STATIC library instead. This may lead to problems. Call Stack (most recent call first): /opt/homebrew/lib/cmake/boost_system-1.86.0/boost_system-config.cmake:53 (include) /opt/homebrew/lib/cmake/Boost-1.86.0/BoostConfig.cmake:141 (find_package) /opt/homebrew/lib/cmake/Boost-1.86.0/BoostConfig.cmake:262 (boost_find_component) CMakeLists.txt:26 (find_package) This warning is for project developers. Use -Wno-dev to suppress it.
-- Including /opt/homebrew/lib/cmake/boost_system-1.86.0/libboost_system-variant-mt-static.cmake -- [ ] libboost_system-mt.a -- Including /opt/homebrew/lib/cmake/boost_system-1.86.0/libboost_system-variant-shared.cmake -- [ ] libboost_system.dylib -- Including /opt/homebrew/lib/cmake/boost_system-1.86.0/libboost_system-variant-static.cmake -- [ ] libboost_system.a -- Adding boost_system dependencies: headers -- The C compiler identification is AppleClang 15.0.0.15000309 -- The CXX compiler identification is AppleClang 15.0.0.15000309 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Boost system found: 1 [/code] Окружающая среда: [list] [*][code]cmake version 3.31.1[/code] [*][code]macOS Sequoia 15.0[/code] [/list]
Я пытаюсь использовать Boost::Beast для WebSocket в своем проекте CMake. Но у меня возникли проблемы с CMake, чтобы найти пакет Boost. Я попробовал как Boost_USE_STATIC_LIBS=OFF, так и ON.
cmake_minimum_required (VERSION 3.20)
Может быть, кто-нибудь может предоставить простой пример (или ссылки) о том, как настроить клиент и сервер с помощью веб-сокета из библиотеки boost/beast? Мне нужен пример того, как обрабатывать входное сообщение на сервере и отвечать/не реагировать...
Может быть, кто-нибудь может предоставить простой пример (или ссылки) о том, как настроить клиент и сервер с помощью веб-сокета из библиотеки boost/beast? Мне нужен пример того, как обрабатывать входное сообщение на сервере и отвечать/не реагировать...
Я создаю сервер WebSocket, используя Boost.Asio и Boost.Beast с SSL. Сервер принимает соединения, но я столкнулся с проблемой, когда клиент отключается вскоре после подключения. Я получаю сообщение об ошибке:
Read error: The I/O operation has been...
Я создаю сервер WebSocket, используя Boost.Asio и Boost.Beast с SSL. Сервер принимает соединения, но я столкнулся с проблемой, когда клиент отключается вскоре после подключения. Я получаю сообщение об ошибке:
Read error: The I/O operation has been...