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

相关推荐
数据智能老司机14 分钟前
Linux内核编程——字符设备驱动程序
linux·架构·操作系统
lyx 弈心40 分钟前
I/O 进程 7.2
linux·算法·io
舒克起飞了1 小时前
linux系统编程——Makefile、GDB调试
linux·运维·服务器
背影疾风1 小时前
C++之路:类基础、构造析构、拷贝构造函数
linux·开发语言·c++
m0_694845572 小时前
服务器如何配置防火墙规则开放/关闭端口?
linux·服务器·安全·云计算
阿巴~阿巴~3 小时前
Linux基本命令篇 —— alias命令
linux·服务器·bash
好名字更能让你们记住我4 小时前
Linux多线程(十二)之【生产者消费者模型】
linux·运维·服务器·jvm·windows·centos
学习编程的gas4 小时前
Linux开发工具——gcc/g++
linux·运维·服务器
嵌入式成长家4 小时前
ubuntu rules 使用规则
linux·ubuntu·rules 使用规则
_可乐无糖4 小时前
AWS WebRTC: 判断viewer端拉流是否稳定的算法
linux·服务器·webrtc·aws