官方網(wǎng)站 : http://www.apuebook.com/
- 下載官網(wǎng)提供源碼包
wget http://www.apuebook.com/src.3e.tar.gz
- 解壓
tar -zxvf src.3e.tar.gz
- 編譯
cd src.3e
make
- 發(fā)現(xiàn)錯(cuò)誤
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/sun/Desktop/apue.3e/threads'
Makefile:6: recipe for target 'all' failed
make: *** [all] Error 1
- 解決方案
sudo apt-get install libbsd-dev
- 復(fù)制庫(kù)到系統(tǒng)lib目錄中
sudo cp ./include/apue.h /usr/include/
sudo cp ./lib/libapue.a /usr/local/lib/
參考資料 :