【Unix网络编程】

参考链接:

  • http://blog.sina.com.cn/s/blog_8e48f19a010141lr.html
  • https://blog.csdn.net/Harlod/article/details/85765574
  • https://titanwolf.org/Network/Articles/Article?AID=5236f4ce-c705-47aa-aff2-fc65c3da38fa#gsc.tab=0
  • https://blog.csdn.net/a649518776/article/details/6724121

一、Mac如何执行UnixNetworkProgram的configure文件

1. 代码下载链接:http://www.unpbook.com/
2. 查询资料:使用unp.h前,要执行configure文件(即./configure)。但是出现下面这个错误:

(http://blog.sina.com.cn/s/blog_8e48f19a010141lr.html)

-bash: ./configure: /bin/sh: bad interpreter: Operation not permitted
3. 查找相关资料:Mac OS X运行程序出现bad interpreter: operation not permitted的解决方案

(https://www.cnblogs.com/plwang1990/p/3254518.html)
要添加语句:

xattr -rd com.apple.quarantine configure

再次执行./configure

checking build system type... i386-apple-darwin19.6.0
checking host system type... i386-apple-darwin19.6.0
checking for gcc... gcc
checking for C compiler default output... configure: error: C compiler cannot create executables
See `config.log' for more details.
4. 查阅相关资料:configure编译时,出现 configure: error: C compiler cannot create executables错误解决 .

(https://www.cnblogs.com/Oman/p/4077462.html)
添加语句:清空CFLAGS和LIBS的值

export LIBS=
export CFLAGS=
5.再次执行即可

二、make libfree出现问题

gcc -I../lib  -D_REENTRANT -Wall   -c -o in_cksum.o in_cksum.c
gcc -I../lib  -D_REENTRANT -Wall   -c -o inet_ntop.o inet_ntop.c
inet_ntop.c:56:1: error: conflicting types for 'inet_ntop'
inet_ntop(af, src, dst, size)
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/arpa/inet.h:77:13: note: 
      previous declaration is here
const char      *inet_ntop(int, const void *, char *, socklen_t);
                 ^
1 error generated.
make: *** [inet_ntop.o] Error 1

错误原因:
书中源码中 inet_ntop 函数的 size 参数是 size_t 类型,而头文件里参数类型是 socklen_t。
解决办法:size_t 改成 socklen_t。

  • 找到libfree/inet_ntop .c。将所有的size_t size换成socklen_t size。

三、解决Mac OS X 11中出现的/usr/bin 的“Operation not permitted”问题

sudo cp libunp.a /usr/lib

  • 出现问题:
    cp: /usr/lib/libunp.a: Operation not permitted
    
  • 解决办法:(https://blog.csdn.net/haoaiqian/article/details/79572030)
    在这里插入图片描述
  • 如何进入恢复模式,打开Terminal?(https://jingyan.baidu.com/article/9c69d48ff88b3813c9024e9d.html)

四、解决ar rv …/libunp.a , ar: no archive members specified

cd ../libgai
make
  • 解决办法:
    (https://www.jianshu.com/p/a7e7bbcb913d)

    sudo mount -uw /
    sudo chown -R xxx /data/logs/java/
    
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值