1.libwebsockets官网:
2.github下载地址:
https://github.com/warmcat/libwebsockets
3.ubuntu 18.04下编译:
解压之后放在桌面上
/home/Desktop/libwebsockets-main
cd /home/Desktop/libwebsockets-main
mkdir build
cd build
cmake ..
make -j8
sudo make install
在cmake的时候如果电脑出现报错,需要配置cmake,gcc,g++
yige@yige-ThinkPad-T490:~/Desktop/libwebsockets-main/libwebsockets-main/build$ cmake .. -- The CXX compiler identification is unknown CMake Error at CMakeLists.txt:66 (project): No CMAKE_CXX_COMPILER could be found. Tell CMake where to find the compiler by setting either the environment variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path to the compiler, or to the compiler name if it is in the PATH. -- Configuring incomplete, errors occurred! See also "/home/yige/Desktop/libwebsockets-main/libwebsockets-main/build/CMakeFiles/CMakeOutput.log". See also "/home/yige/Desktop/libwebsockets-main/libwebsockets-main/build/CMakeFiles/CMakeError.log".
默认的Ubuntu存储库包含一个名为build-essential的元包,它包含GCC编译器以及编译软件所需的许多库和其他实用程序。
以下命令安装build-essential软件包:
sudo apt install build-essential
安装好之后的测试:
yige@yige-ThinkPad-T490:~/Desktop/libwebsockets-main$ gcc --version
gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.yige@yige-ThinkPad-T490:~/Desktop/libwebsockets-main$ g++ --version
g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.