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)?
On Tue, Jul 29, 2014 at 10:00:53PM +0800, Theodore Si wrote:
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: [...] How to install libbsd to solve this problem on CentOS (this works on Ubuntu)?
You need the 'libbsd' package, available in EPEL. (http://fedoraproject.org/wiki/EPEL)
The 'heapsort()' function is implemented there.
So all the packages of Fedora can also be used in CentOS?
于2014年7月29日 23:58:48,Jonathan Billings写到:
On Tue, Jul 29, 2014 at 10:00:53PM +0800, Theodore Si wrote:
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: [...] How to install libbsd to solve this problem on CentOS (this works on Ubuntu)?
You need the 'libbsd' package, available in EPEL. (http://fedoraproject.org/wiki/EPEL)
The 'heapsort()' function is implemented there.
I tried to install libbsd before, it didn't work.(I can execute man heapsort) Today, I installed epel-release-6-8.noarch.rpm and then yum install libbsd,(No result for man heapsort) but it still doesn't work.
于2014年7月29日 23:58:48,Jonathan Billings写到:
On Tue, Jul 29, 2014 at 10:00:53PM +0800, Theodore Si wrote:
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: [...] How to install libbsd to solve this problem on CentOS (this works on Ubuntu)?
You need the 'libbsd' package, available in EPEL. (http://fedoraproject.org/wiki/EPEL)
The 'heapsort()' function is implemented there.
I build the libbsd from source code that I downloaded from here: http://libbsd.freedesktop.org/wiki/
I think I got all things needed, right?
于2014年7月30日 10:35:39,Theodore Si写到:
I tried to install libbsd before, it didn't work.(I can execute man heapsort) Today, I installed epel-release-6-8.noarch.rpm and then yum install libbsd,(No result for man heapsort) but it still doesn't work.
于2014年7月29日 23:58:48,Jonathan Billings写到:
On Tue, Jul 29, 2014 at 10:00:53PM +0800, Theodore Si wrote:
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: [...] How to install libbsd to solve this problem on CentOS (this works on Ubuntu)?
You need the 'libbsd' package, available in EPEL. (http://fedoraproject.org/wiki/EPEL)
The 'heapsort()' function is implemented there.
I write a .c file and #include <bsd/stdlib.h> and call heapsort, I get this:
Apparently, heapsort can be called.
于2014年7月30日 11:46:55,Theodore Si写到:
I build the libbsd from source code that I downloaded from here: http://libbsd.freedesktop.org/wiki/
I think I got all things needed, right?
于2014年7月30日 10:35:39,Theodore Si写到:
I tried to install libbsd before, it didn't work.(I can execute man heapsort) Today, I installed epel-release-6-8.noarch.rpm and then yum install libbsd,(No result for man heapsort) but it still doesn't work.
于2014年7月29日 23:58:48,Jonathan Billings写到:
On Tue, Jul 29, 2014 at 10:00:53PM +0800, Theodore Si wrote:
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: [...] How to install libbsd to solve this problem on CentOS (this works on Ubuntu)?
You need the 'libbsd' package, available in EPEL. (http://fedoraproject.org/wiki/EPEL)
The 'heapsort()' function is implemented there.
You shouldn't need the bsd/stdlib.h if the barrier.c used the function definition you described in your original message. I was able to find and build the file on CentOS 6 with the EPEL libbsd package installed.
Are you sure you installed the right package? 32-bit vs. 64-bit?
On July 29, 2014 11:54:01 PM EDT, Theodore Si sjyzhxw@gmail.com wrote:
I write a .c file and #include <bsd/stdlib.h> and call heapsort, I get this:
Apparently, heapsort can be called.
于2014年7月30日 11:46:55,Theodore Si写到:
I build the libbsd from source code that I downloaded from here: http://libbsd.freedesktop.org/wiki/
I think I got all things needed, right?
于2014年7月30日 10:35:39,Theodore Si写到:
I tried to install libbsd before, it didn't work.(I can execute man heapsort) Today, I installed epel-release-6-8.noarch.rpm and then yum install libbsd,(No result for man heapsort) but it still doesn't work.
于2014年7月29日 23:58:48,Jonathan Billings写到:
On Tue, Jul 29, 2014 at 10:00:53PM +0800, Theodore Si wrote:
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: [...] How to install libbsd to solve this problem on CentOS (this works
on
Ubuntu)?
You need the 'libbsd' package, available in EPEL. (http://fedoraproject.org/wiki/EPEL)
The 'heapsort()' function is implemented there.
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
I build it myself, not using rpm since it doesn't work. My OS is 32bit. On Jul 31, 2014 4:21 AM, "Jonathan Billings" billings@negate.org wrote:
You shouldn't need the bsd/stdlib.h if the barrier.c used the function definition you described in your original message. I was able to find and build the file on CentOS 6 with the EPEL libbsd package installed.
Are you sure you installed the right package? 32-bit vs. 64-bit?
On July 29, 2014 11:54:01 PM EDT, Theodore Si sjyzhxw@gmail.com wrote:
I write a .c file and #include <bsd/stdlib.h> and call heapsort, I get this:
Apparently, heapsort can be called.
于2014年7月30日 11:46:55,Theodore Si写到:
I build the libbsd from source code that I downloaded from here: http://libbsd.freedesktop.org/wiki/
I think I got all things needed, right?
于2014年7月30日 10:35:39,Theodore Si写到:
I tried to install libbsd before, it didn't work.(I can execute man heapsort) Today, I installed epel-release-6-8.noarch.rpm and then yum install libbsd,(No result for man heapsort) but it still doesn't work.
于2014年7月29日 23:58:48,Jonathan Billings写到:
On Tue, Jul 29, 2014 at 10:00:53PM +0800, Theodore Si wrote:
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: [...] How to install libbsd to solve this problem on CentOS (this works
on
Ubuntu)?
You need the 'libbsd' package, available in EPEL. (http://fedoraproject.org/wiki/EPEL)
The 'heapsort()' function is implemented there.
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
-- Jonathan Billings billings@negate.org _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
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.
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.
I've installed libbsd(I think I have successed because when I execute man heapsort I see this)
and I make a link /lib/libbsd.so
since in the file Make.defines.linux the LDDIR is as follows:
then I add this to threads/barrier.c
howerver, I still get this:
? 2014/7/29 23:58, Jonathan Billings ??:
On Tue, Jul 29, 2014 at 10:00:53PM +0800, Theodore Si wrote:
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: [...] How to install libbsd to solve this problem on CentOS (this works on Ubuntu)?
You need the 'libbsd' package, available in EPEL. (http://fedoraproject.org/wiki/EPEL)
The 'heapsort()' function is implemented there.
2014-07-30 6:01 GMT+03:00 Theodore Si sjyzhxw@gmail.com:
I've installed libbsd(I think I have successed because when I execute man heapsort I see this)
install libbsd development package also?
-- Eero