参考链接:
- 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/