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

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

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-
  ..........

你可能感兴趣的:(Linux系统编程)