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错误:

cpp 复制代码
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

修改

cpp 复制代码
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

相关推荐
zoulingzhi_yjs21 分钟前
haproxy配置详解
linux·云原生
bingbingyihao22 分钟前
Node.js 模拟 Linux 环境
linux·node.js
大神的风范27 分钟前
从0开始学linux韦东山教程Linux驱动入门实验班(5)
linux
小码过河.1 小时前
CentOS 搭建 Docker 私有镜像仓库
linux·docker·centos
贾斯汀玛尔斯2 小时前
ubuntu/centos系统ping 不通域名的解决方案
linux·ubuntu·centos
呆瑜nuage3 小时前
Linux的工具
linux
唐青枫4 小时前
Linux vimgrep 详解
linux·vim
麦子邪4 小时前
C语言中奇技淫巧04-仅对指定函数启用编译优化
linux·c语言·开发语言
半梦半醒*5 小时前
Linux网络管理
linux·运维·网络·centos·运维开发
破刺不会编程5 小时前
linux线程概念和控制
linux·运维·服务器·开发语言·c++