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

前端之家收集整理的这篇文章主要介绍了Unix环境高级编程第三版源码编译错误前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

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

1. systype.sh

apue.3e makeforiinlibintrosocketsadviodaemonsdatafilesdbenvironfileiofilediripc1ipc2procptyrelationsignalsstandardsstdiotermiosthreadctl@H_848_301@threadsprinterexercises;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-
  ..........
原文链接:https://www.f2er.com/bash/390512.html

猜你在找的Bash相关文章