加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Unix环境高级编程第三版源码编译错误

发布时间:2020-12-15 16:17:28 所属栏目:安全 来源:网络整理
导读:编译书本上的源代码遇到如下问题: 1. systype.sh apue.3e m a k e f o r i i n l i b i n t r o s o c k e t s a d v i o d a e m o n s d a t a f i l e s d b e n v i r o n f i l e i o f i l e d i r i p c 1 i p c 2 p r o c p t y r e l a t i o n s

编译书本上的源代码遇到如下问题:

1. systype.sh

apue.3e makeforiinlibintrosocketsadviodaemonsdatafilesdbenvironfileiofilediripc1ipc2procptyrelationsignalsstandardsstdiotermiosthreadctlthreadsprinterexercises;do(cd i && echo "making $i” && make ) || exit 1;
done
making lib
make[1]: Entering directory ‘/home/jack/samba_share/apue/apue.3e/lib’
make[1]: execvp: ../systype.sh: Permission denied
Makefile:6: ../Make.defines.: No such file or directory
make[1]: * No rule to make target ‘../Make.defines.’. Stop.
make[1]: Leaving directory ‘/home/jack/samba_share/apue/apue.3e/lib’
Makefile:6: recipe for target ‘all’ failed
make: * [all] Error 1
解决方法:

apue.3e$ ll systype.sh 
-rw-r--r-- 1 jack jack 467 75  2012 systype.sh
apue.3e$ chmod +x systype.sh 
apue.3e$ ll systype.sh 
-rwxr-xr-x 1 jack jack 467 75  2012 systype.sh*

2. fixup.awk

making advio
make[1]: Entering directory '/home/jack/samba_share/apue/apue.3e/advio'
gcc -ansi -I../include -Wall -DLINUX -D_GNU_SOURCE  deadlock.c -o deadlock  -L../lib -lapue -lrt
gcc -ansi -I../include -Wall -DLINUX -D_GNU_SOURCE  mandatory.c -o mandatory  -L../lib -lapue -lrt
gcc -ansi -I../include -Wall -DLINUX -D_GNU_SOURCE  mcopy2.c -o mcopy2  -L../lib -lapue -lrt
gcc -ansi -I../include -Wall -DLINUX -D_GNU_SOURCE  nonblockw.c -o nonblockw  -L../lib -lapue -lrt
gcc -ansi -I../include -Wall -DLINUX -D_GNU_SOURCE  rot13a.c -o rot13a  -L../lib -lapue -lrt
./fixup.awk rot13a.c >xlate
/bin/sh: 1: ./fixup.awk: Permission denied
Makefile:18: recipe for target 'rot13c2.c' failed
make[1]: *** [rot13c2.c] Error 126
make[1]: Leaving directory '/home/jack/samba_share/apue/apue.3e/advio'
Makefile:6: recipe for target 'all' failed
make: *** [all] Error 1

解决方法:

apue.3e$ ll advio/fixup.awk 
-rw-r--r-- 1 jack jack 172 75  2012 advio/fixup.awk
apue.3e$ chmod +x advio/fixup.awk 
apue.3e$ ll advio/fixup.awk 
-rwxr-xr-x 1 jack jack 172 75  2012 advio/fixup.awk*

3. libbsd-dev

make[1]: Leaving directory '/home/jack/samba_share/apue/apue.3e/threadctl'
making threads
make[1]: Entering directory '/home/jack/samba_share/apue/apue.3e/threads'
gcc -ansi -I../include -Wall -DLINUX -D_GNU_SOURCE  badexit2.c -o badexit2  -L../lib -lapue -pthread -lrt -lbsd
/usr/bin/ld: cannot find -lbsd
collect2: error: ld returned 1 exit status
Makefile:31: recipe for target 'badexit2' failed
make[1]: *** [badexit2] Error 1
make[1]: Leaving directory '/home/jack/samba_share/apue/apue.3e/threads'
Makefile:6: recipe for target 'all' failed
make: *** [all] Error 1

解决方法:

apue.3e$ sudo apt-get install libbsd-dev 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-4.10.0-27 linux-
  ..........

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读