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

相关推荐
aFakeProgramer22 分钟前
S-CORE Docker 环境
linux
江华森38 分钟前
Linux 运维新手入门课
linux·运维·服务器
载数而行5201 小时前
Linux 9 服务管理(进程的一种)
linux
追梦的小菜1 小时前
linux 下磁盘挂载
linux
izcll1 小时前
ubuntu系统安装软件的方法
linux·运维·ubuntu
暮云星影12 小时前
全志linux开发屏幕适配(一)屏幕参数设置说明
linux·arm开发
swordbob14 小时前
NIO 的 Channel 里有多个 BIO 吗?
linux·网络·nio
Fcy64814 小时前
Linux下 信号的保存与捕捉
linux·中断·信号的捕捉·信号的保存
A_humble_scholar15 小时前
Linux(九) 进程管理完全指南:从入门到实战
linux·运维·chrome
江华森15 小时前
Linux 操作命令完全指南
linux·运维