linux环境编程apue和unp,UNIX高级环境编程:源码(apue)下载 编译和运行
整體上和unpv差不多,參見我的另一篇博文unpv13e
1.源碼下載
最簡(jiǎn)單的方式:(wget工具實(shí)在太好用)
wget http://www.apuebook.com/src.3e.tar.gz
2.解壓查看目錄結(jié)構(gòu)
sunxiaowu@sunxiaowu:~/Downloads/apue/apue.3e$ dir
advio figlinks lib printer standards
daemons filedir Make.defines.freebsd proc stdio
datafiles fileio Make.defines.linux pty systype.sh
db include Make.defines.macos README termios
DISCLAIMER intro Make.defines.solaris relation threadctl
environ ipc1 Makefile signals threads
exercises ipc2 Make.libapue.inc socketsvim README
Read the file called DISCLAIMER.
On Freebsd, type "gmake".
On other platforms, type "make" (as long as this is gnu make).
For FAQs, updated source code, and the lost chapter, see http://www.apuebook.com.
Please direct questions, suggestions, and bug reports to sar@apuebook.com.
Steve Rago
January 2013
3.編譯
make
timeout.c:119:5: warning: ‘condition’ may be used uninitialized in this function [-Wmaybe-uninitialized]
if (condition) {
^
timeout.c:125:34: warning: ‘a(chǎn)rg’ may be used uninitialized in this function [-Wmaybe-uninitialized]
timeout(&when, retry, (void *)((unsigned long)arg));
^
make[1]: Leaving directory `/home/sunxiaowu/Downloads/apue/apue.3e/threadctl'
making threads
make[1]: Entering directory `/home/sunxiaowu/Downloads/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
make[1]: *** [badexit2] Error 1
make[1]: Leaving directory `/home/sunxiaowu/Downloads/apue/apue.3e/threads'
make: *** [all] Error 1
大部分編譯通過,但最后出現(xiàn)以上錯(cuò)誤,可以看出threads模塊下的badexit2.c文件編譯失敗。原因是操作系統(tǒng)的限制,我的使用ubunu14.04,要想編譯這個(gè)文件,需要在bsd下(還有些模塊編譯不通過,大部分都是這個(gè)原因,有興趣的讀者可以在其他操作系統(tǒng)下試試)
4.運(yùn)行
sunxiaowu@sunxiaowu:~/Downloads/apue/apue.3e$ cd intro/
sunxiaowu@sunxiaowu:~/Downloads/apue/apue.3e/intro$ dir
getcputc hello.c Makefile shell1 shell2.c uidgid
getcputc.c ls1 mycat shell1.c testerror uidgid.c
hello ls1.c mycat.c shell2 testerror.c
sunxiaowu@sunxiaowu:~/Downloads/apue/apue.3e/intro$ ./hello
hello world from process ID 9793
sunxiaowu@sunxiaowu:~/Downloads/apue/apue.3e/intro$
總結(jié)
以上是生活随笔為你收集整理的linux环境编程apue和unp,UNIX高级环境编程:源码(apue)下载 编译和运行的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 有关计算机的英语名言,100句超级简洁但
- 下一篇: Linux BT下载(2)-B编码和种子