开发环境:CentOS-7.7-1908,gcc version 4.8.5 20150623
UNIX高级环境编程的源代码下载地址:http://apuebook.com/code3e.html
源代码压缩包:src.3e.tar.gz
在CentOS-7.7下解压源代码文件后进行编译,报错信息为:
gcc -ansi -I../include -Wall -DLINUX -D_GNU_SOURCE barrier.c -o barrier -L../lib -lapue -pthread -lrt -lbsd
/tmp/cc6Z8vzR.o: In function `thr_fn':
barrier.c:(.text+0x80): undefined reference to `heapsort'
collect2: error: ld returned 1 exit status
make[1]: *** [barrier] Error 1
发现heapsort在CentOS-7下没有相关的库,只能下载Fedora的资源进行安装。
- RHEL/CentOS 7:
- # yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
然后执行
[root@localhost threads]# yum install libbsd libbsd-devel
即可编译成功。