meltwater / served

A C++11 RESTful web server library
MIT License
710 stars 173 forks source link

Example segfaults after returning "hello world" #63

Open theIDinside opened 5 years ago

theIDinside commented 5 years ago

As I was just looking for web server libraries, and found this one, I got the example working, but it immediately segfaults after returning the first request. I am not sure whether this has to do with your library, or the fact I am using later boost, so I'll pass along what CMake spits out.

Here's the messages I get when running CMAKE (accordingly to example)

-- The C compiler identification is GNU 7.4.0
-- The CXX compiler identification is Clang 8.0.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/local/bin/clang++
-- Check for working CXX compiler: /usr/local/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning at /usr/share/cmake-3.10/Modules/FindBoost.cmake:801 (message):
  New Boost version may have incorrect or missing dependencies and imported
  targets
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/FindBoost.cmake:907 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/share/cmake-3.10/Modules/FindBoost.cmake:1558 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:71 (FIND_PACKAGE)

-- Boost version: 1.67.0
-- Found the following Boost libraries:
--   system
-- Could NOT find RAGEL (missing: RAGEL_EXECUTABLE) 
-- Could NOT find RAGEL (missing: RAGEL_EXECUTABLE) 
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Performing Test COMPILER_SUPPORTS_CXX11
-- Performing Test COMPILER_SUPPORTS_CXX11 - Success
-- Performing Test COMPILER_SUPPORTS_CXX0X
-- Performing Test COMPILER_SUPPORTS_CXX0X - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /home/cx/dev/workspace/cpp/nhlanalys/dependencies/servedbuild

It can't be a major error, as it is able to actually return 1 request, using curl. But maybe it is because I am using the wrong Boost version, later clang, or what could it be?

theIDinside commented 5 years ago

Hm. Seems as though I "forgot" to add pthread as a library in cmake (in the target_link_libraries). When I added that, it no longer segfaults.