websocketpp
websocketpp copied to clipboard
How to compile projects?
I use command as blow:
git clone https://github.com/zaphoyd/websocketpp.git
cd websocketpp/websocketpp
mkdir build
cd build
cmake ..
It show:
-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is GNU 4.8.5
-- 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/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:1 (init_target):
Unknown CMake command "init_target".
Who can tell me why it throw error 'Unknown CMake command "init_target"' ???
Thank you , I am a newbie on cmake.
My compiling environment:
- cmake version 3.13.0-rc2
websocketpp/websocketpp is one subdirectory to deep, please use:
git clone https://github.com/zaphoyd/websocketpp.git
cd websocketpp
mkdir build
cd build
cmake ..
websocketpp/websocketpp is one subdirectory to deep, please use:
git clone https://github.com/zaphoyd/websocketpp.git cd websocketpp mkdir build cd build cmake ..
Thank you for your reply, I use your comment:
android@NSGWD180021:~/websocketpp/build$ cmake ..
-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is GNU 4.8.5
-- 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/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
** websocketpp
=========== Used Build Configuration =============
-- ENABLE_CPP11 = ON
-- BUILD_EXAMPLES = OFF
-- BUILD_TESTS = OFF
-- WEBSOCKETPP_ROOT = /home/android/websocketpp
-- WEBSOCKETPP_BIN = /home/android/websocketpp/build/bin
-- WEBSOCKETPP_LIB = /home/android/websocketpp/build/lib
-- Install prefix = /usr/local
-- WEBSOCKETPP_BOOST_LIBS =
-- WEBSOCKETPP_PLATFORM_LIBS =
-- WEBSOCKETPP_PLATFORM_TLS_LIBS =
-- OPENSSL_FOUND =
-- OPENSSL_INCLUDE_DIR =
-- OPENSSL_LIBRARIES =
-- OPENSSL_VERSION =
-- Configuring done
-- Generating done
-- Build files have been written to: /home/android/websocketpp/build
android@NSGWD180021:~/websocketpp/build$ ls
CMakeCache.txt CMakeFiles Makefile cmake_install.cmake websocketpp
android@NSGWD180021:~/websocketpp/build$ make
and then I run make , There is nothing to be done. like this:
android@NSGWD180021:~/websocketpp/build$ make
android@NSGWD180021:~/websocketpp/build$
Why ?
Do you have the document for complie the websocketpp? Thank you for your help.
My os is ubuntu. And I use the scons to complie is OK... Thank you for your help @c72578
Make is not working! Can you please include the whole compile, build and install procedure into read.me, please?
I looked up through Makefile - so finally to install it you should use this: git clone https://github.com/zaphoyd/websocketpp.git cd websocketpp mkdir build cd build cmake .. make install
So default make is NOT working now
Websocketpp is a header only library. You only need to install the headers via make install as shown by @alexiicon to use them. Then you can include them in your own projects and build with them.
If you want to build the examples and tests for websocketpp, you need to enable those options with cmake before running make will do anything.
From websocketpp/CMakeLists.txt:
# Override from command line "CMake -D<OPTION>=TRUE/FALSE/0/1/ON/OFF"
option (ENABLE_CPP11 "Build websocketpp with CPP11 features enabled." TRUE)
option (BUILD_EXAMPLES "Build websocketpp examples." FALSE)
option (BUILD_TESTS "Build websocketpp tests." FALSE)
So by default, make does not build the examples. You would need to do something like this to build them:
git clone https://github.com/zaphoyd/websocketpp.git
cd websocketpp
mkdir build
cd build
cmake -DBUILD_EXAMPLES=TRUE ..
make
I looked up through Makefile - so finally to install it you should use this: git clone https://github.com/zaphoyd/websocketpp.git cd websocketpp mkdir build cd build cmake .. make install
So default make is NOT working now
Thank you~
my os is ubuntu 16.04.
git clone https://github.com/zaphoyd/websocketpp.git cd websocketpp mkdir build cmake -DENABLE_CPP11=TRUE -DBUILD_EXAMPLES=TRUE -DBUILD_TESTS=TRUE -DBOOST_ROOT=../../boost_1_63_0 make make install
try it~
When I run cmake -DBUILD_EXAMPLES=TRUE ..
, I get the error message
CMake Error at C:/Program Files/CMake/share/cmake-3.13/Modules/FindBoost.cmake:1357 (file):
file STRINGS file
"C:/Program1/GDAL/release-1911-x64-dev/release-1911-x64/include/boost/version.hpp"
cannot be read.
Call Stack (most recent call first):
CMakeLists.txt:214 (find_package)
Why does CMake look in my GDAL installation? To me, this doesn't really seem appropriate as GDAL is not a dependency and since I just happen to have GDAL installed. How can this be considered desired behavior? (I'm aware that this is mainly a CMake characteristic, but still)
Anyway, what do I do about this error?
thanks for this topic, i'm build ok. hope to add to README file tell the newer.
How can i include and compile my .cpp n .hpp file here ?? i am using websocketpp library in my code . i am able to perform procedure mentioned by @alexiicon . but it not including my files for compilation.
MINGW64:/websocketpp/build
I could not finish. the websocketpp.sln is empty.
- [ ]
When I run cmake -DBUILD_EXAMPLES=TRUE .., I get the error message
/data/tmp/websocketpp/examples/print_client_tls/print_client_tls.cpp: In function ‘bool verify_subject_alternative_name(const char*, X509*)’: /data/tmp/websocketpp/examples/print_client_tls/print_client_tls.cpp:64:93: error: ‘ASN1_STRING_get0_data’ was not declared in this scope nst * dns_name = (char const ) ASN1_STRING_get0_data(current_name->d.dNSName); ^ /data/tmp/websocketpp/examples/print_client_tls/print_client_tls.cpp:67:57: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (ASN1_STRING_length(current_name->d.dNSName) != strlen(dns_name)) { ^ /data/tmp/websocketpp/examples/print_client_tls/print_client_tls.cpp: In function ‘bool verify_common_name(const char, X509*)’: /data/tmp/websocketpp/examples/print_client_tls/print_client_tls.cpp:98:89: error: ‘ASN1_STRING_get0_data’ was not declared in this scope nst * common_name_str = (char const *) ASN1_STRING_get0_data(common_name_asn1); ^ /data/tmp/websocketpp/examples/print_client_tls/print_client_tls.cpp:101:46: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (ASN1_STRING_length(common_name_asn1) != strlen(common_name_str)) { ^ examples/print_client_tls/CMakeFiles/print_client_tls.dir/build.make:62: recipe for target 'examples/print_client_tls/CMakeFiles/print_client_tls.dir/print_client_tls.cpp.o' failed make[2]: *** [examples/print_client_tls/CMakeFiles/print_client_tls.dir/print_client_tls.cpp.o] Error 1 CMakeFiles/Makefile2:948: recipe for target 'examples/print_client_tls/CMakeFiles/print_client_tls.dir/all' failed make[1]: *** [examples/print_client_tls/CMakeFiles/print_client_tls.dir/all] Error 2 Makefile:140: recipe for target 'all' failed make: *** [all] Error 2
websocketpp/websocketpp is one subdirectory to deep, please use:
git clone https://github.com/zaphoyd/websocketpp.git cd websocketpp mkdir build cd build cmake ..
execellent job, sir!