GithubHelp home page GithubHelp logo

Comments (4)

galeone avatar galeone commented on August 20, 2024

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.

eidheim avatar eidheim commented on August 20, 2024

pthread linking should be added here: https://github.com/eidheim/Simple-WebSocket-Server/blob/master/CMakeLists.txt#L19 if needed.

from simple-websocket-server.

eidheim avatar eidheim commented on August 20, 2024

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.

galeone avatar galeone commented on August 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.