libwebsockets编译
#安装 libwebsocket
git clone https://github.com/warmcat/libwebsockets && \
mkdir libwebsockets/build && cd libwebsockets/build && \
cmake -DMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_C_FLAGS="-fpic" .. && \
make && make install
make错误:
In file included from /opt/projects/open/libwebsockets/lib/plat/unix/unix-sockets.c:31:
/usr/include/linux/ipv6.h:19:8: 错误:‘struct in6_pktinfo’重定义19 | struct in6_pktinfo {| ^~~~~~~~~~~
In file included from /opt/projects/open/libwebsockets/lib/plat/unix/./private-lib-plat-unix.h:31,from /opt/projects/open/libwebsockets/lib/core/./private-lib-core.h:138,from /opt/projects/open/libwebsockets/lib/plat/unix/unix-sockets.c:28:
/usr/include/netinet/in.h:538:8: 附注:原先在这里定义538 | struct in6_pktinfo| ^~~~~~~~~~~
In file included from /opt/projects/open/libwebsockets/lib/plat/unix/unix-sockets.c:31:
/usr/include/linux/ipv6.h:24:8: 错误:‘struct ip6_mtuinfo’重定义24 | struct ip6_mtuinfo {| ^~~~~~~~~~~
In file included from /opt/projects/open/libwebsockets/lib/plat/unix/./private-lib-plat-unix.h:31,from /opt/projects/open/libwebsockets/lib/core/./private-lib-core.h:138,from /opt/projects/open/libwebsockets/lib/plat/unix/unix-sockets.c:28:
/usr/include/netinet/in.h:545:8: 附注:原先在这里定义545 | struct ip6_mtuinfo
修改
vi /opt/projects/open/libwebsockets/lib/plat/unix/unix-sockets.c
注释掉//#include <linux/ipv6.h>
cmake要修改为
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_C_FLAGS="-fPIC -Wno-error=sign-conversion -Wno-error" -DLWS_WITH_WERROR=OFF