Comments (4)
The problem is in pthread linking, it looks like your CMake file (when using CHECK_INCLUDE_FILE_CXX(asio.hpp)
) does not link against pthread
Determining if the include file asio.hpp exists failed with the following output:
Change Dir: /tmp/Simple-WebSocket-Server/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_1b98a/fast"
/usr/bin/make -f CMakeFiles/cmTC_1b98a.dir/build.make CMakeFiles/cmTC_1b98a.dir/build
make[1]: Entering directory '/tmp/Simple-WebSocket-Server/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_1b98a.dir/CheckIncludeFile.cxx.o
/usr/bin/c++ -o CMakeFiles/cmTC_1b98a.dir/CheckIncludeFile.cxx.o -c /tmp/Simple-WebSocket-Server/build/CMakeFiles/CMakeTmp/CheckIncludeFile.cxx
Linking CXX executable cmTC_1b98a
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_1b98a.dir/link.txt --verbose=1
/usr/bin/c++ -rdynamic CMakeFiles/cmTC_1b98a.dir/CheckIncludeFile.cxx.o -o cmTC_1b98a
CMakeFiles/cmTC_1b98a.dir/CheckIncludeFile.cxx.o: In function `asio::detail::posix_thread::~posix_thread()':
CheckIncludeFile.cxx:(.text._ZN4asio6detail12posix_threadD2Ev[_ZN4asio6detail12posix_threadD5Ev]+0x26): undefined reference to `pthread_detach'
CMakeFiles/cmTC_1b98a.dir/CheckIncludeFile.cxx.o: In function `asio::detail::posix_thread::join()':
CheckIncludeFile.cxx:(.text._ZN4asio6detail12posix_thread4joinEv[_ZN4asio6detail12posix_thread4joinEv]+0x2b): undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_1b98a.dir/build.make:98: cmTC_1b98a] Error 1
make[1]: Leaving directory '/tmp/Simple-WebSocket-Server/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:126: cmTC_1b98a/fast] Error 2
from simple-websocket-server.
pthread linking should be added here: https://github.com/eidheim/Simple-WebSocket-Server/blob/master/CMakeLists.txt#L19 if needed.
from simple-websocket-server.
This seems to be a problem with cmake's CheckIncludeFileCXX though. I just confirmed this issue on Antergos. Temporary workaround:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2b0ea16..8f31cb5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,11 +22,6 @@ target_link_libraries(simple-websocket-server INTERFACE ${CMAKE_THREAD_LIBS_INIT
# Remove Boost system, thread, regex components; use Boost::<component> aliases; remove Boost target_include_directories
if(USE_STANDALONE_ASIO)
target_compile_definitions(simple-websocket-server INTERFACE USE_STANDALONE_ASIO)
- include(CheckIncludeFileCXX)
- CHECK_INCLUDE_FILE_CXX(asio.hpp HAVE_ASIO)
- if(NOT HAVE_ASIO)
- message(FATAL_ERROR "Standalone Asio not found")
- endif()
else()
find_package(Boost 1.54.0 COMPONENTS system thread coroutine context REQUIRED)
target_link_libraries(simple-websocket-server INTERFACE ${Boost_LIBRARIES})
from simple-websocket-server.
Yeah, I ended up with the same workaround (although it should be temporary for sure since we're not checking if asio.hpp is present hence the compilation can start and fail if the library is not present for real).
from simple-websocket-server.
Related Issues (20)
- [suggest] Send/Broadcast and Text/BinaryMode HOT 1
- re again WssClient::start causes on_error HOT 10
- When I use Google Chrome it happend a error. HOT 3
- exception thrown in server start (boost related) HOT 4
- Connection Timeout HOT 2
- Create example on how to stream data to a client HOT 1
- Unable to compile against standalone asio HOT 1
- How to stop the server? HOT 3
- Installed but ws_examples throws an error HOT 1
- Support for the Sec-WebSocket-Protocol field HOT 3
- fatal error C1083: Cannot open include file : 'pthread.h': No such file or directory HOT 1
- Messages split among frames aren't reasembled HOT 25
- Openssl wants void* instead of char* in 0x1000115fL HOT 1
- how to initiate send message from client HOT 3
- Client request error: End of file
- Access violation exeption HOT 3
- gdiplus
- Can't use wss client HOT 5
- Integration with Simple-Web-Server HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from simple-websocket-server.