preface

Crow is a high performance and easy to use c++ web framework. This paper records the use of docker to build available crow framework mirror

The project address

github.com/ipkn/crow

The mirroring address is completed

docker pull likecooper/crow_env:v1

The source image

Build the available crow environment based on the official GCC image

docker pull gcc
Copy the code

Install dependency libraries

A native build on a MAC requires the installation of Google-PerfTools

  • Mac

brew install boost google-perftools

The library needs to be installed on Linux or a Linux image

  • Linux

sudo apt-get install build-essential libtcmalloc-minimal4 && sudo ln -s /usr/lib/libtcmalloc_minimal.so.4 /usr/lib/libtcmalloc_minimal.so

Install frame source code

cd /usr/local  or cd  /opt

git clone  https://github.com/ipkn/crow.git
cd  crow 
mkdir build
cd build
cmake ..
make
ctest 
Copy the code

Have a problem

  • Brew install boost package is 1.75 by default, and some package changes after Boost 1.7 are reported
socket_.get_io_service()
Copy the code

Solution: Refer to github.com/ipkn/crow/p…

# modify this file sudo vim/usr/local/crow/include/crow socket_adaptors. HCopy the code
  • Sudo make: Error: Openssl not found
ld: library not found for -lOPENSSL_SSL_LIBRARY-NOTFOUND
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [examples/example_websocket] Error 1
make[1]: *** [examples/CMakeFiles/example_websocket.dir/all] Error 2
make: *** [all] Error 2
Copy the code

Solution: re-cmake with the option to specify the openSSL directory file (.. If it is the current directory, then one.

 sudo cmake .. -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include -DOPENSSL_SSL_LIBRARY=/usr/local/opt/openssl/lib
Copy the code
  • A compiler error
root@ad111334e526:/usr/local/crow/build# g++ -o helloword helloword.cpp /usr/bin/ld: /tmp/ccz3EKk0.o: in function `boost::asio::detail::posix_event::posix_event()': helloword.cpp:(.text._ZN5boost4asio6detail11posix_eventC2Ev[_ZN5boost4asio6detail11posix_eventC5Ev]+0x3e): undefined reference to `pthread_condattr_setclock' /usr/bin/ld: /tmp/ccz3EKk0.o: in function `boost::asio::detail::posix_thread::~posix_thread()': helloword.cpp:(.text._ZN5boost4asio6detail12posix_threadD2Ev[_ZN5boost4asio6detail12posix_threadD5Ev]+0x26): undefined reference to `pthread_detach' ..... .Copy the code

Reference the Boost library and finally compile the command:

g++ -o helloword helloworld.cpp -lboost_system -lpthread
Copy the code