Hi all,
I want to compile the source code of Advanced Programming in the Unix
Environment(APUE) 3rd edition, and I encountered some difficulties.
After executing "make", I got this message:
gcc -ansi -I../include -Wall -DLINUX -D_GNU_SOURCE barrier.c -o barrier
-L../lib -lapue -pthread -lrt -lbsd
/tmp/cc0gG99O.o: In function `thr_fn':
barrier.c:(.text+0x6e): undefined reference to `heapsort'
collect2: ld returned 1 exit status
make[1]: *** [barrier] Error 1
make[1]: Leaving directory `/home/drizzlex/apue.3e/threads'
make: *** [all] Error 1
In barrier.c, I found this
#ifdef SOLARIS
#define heapsort qsort
#else
extern int heapsort(void *, size_t, size_t,
int (*)(const void *, const void *));
#endif
If I change these code to
How to install libbsd to solve this problem on CentOS (this works on
Ubuntu)?