[CentOS] How to compile APUE code on centos 6.X

Thu Jul 31 12:16:35 UTC 2014
Theodore Si <sjyzhxw at gmail.com>

It's so weird... It works now, either with #include <bsd/stdlib.h> or 
not.

于2014年7月31日 8:40:05,Jonathan Billings写到:
> On Thu, Jul 31, 2014 at 08:09:52AM +0800, Theodore Si wrote:
>> I build it myself, not using rpm since it doesn't work. My OS is 32bit.
>
> It works for me with libbsd and libbsd-devel installed:
>
> $ cd /tmp
> $ wget http://www.apuebook.com/src.3e.tar.gz
> $ tar zxvf src.3e.tar.gz
> $ cd apue.3e
> $ make
> [multiple lines building]
> $ cd threads
> $ make
> gcc -ansi -I../include -Wall -DLINUX -D_GNU_SOURCE  barrier.c -o
> barrier  -L../lib -lapue -pthread -lrt -lbsd
> /tmp/ccmCvcBh.o: In function `thr_fn':
> barrier.c:(.text+0x80): undefined reference to `heapsort'
> collect2: ld returned 1 exit status
> make: *** [barrier] Error 1
> $ sudo yum -y -q install libbsd libbsd-devel
> $ make
> gcc -ansi -I../include -Wall -DLINUX -D_GNU_SOURCE  barrier.c -o
> barrier  -L../lib -lapue -pthread -lrt -lbsd
> $
>
> I'll admit that my OS is 64-bit, but I don't see anything in the code
> that would break with 32-bit.
>
>