Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I compile Perl 5.10 with thread support under FreeBSD 7.1?

I'm trying to compile Perl 5.10 on my FreeBSD 7.1 (BSD) server but when I run the Configure script and answer the questions I get the following error:

...POSTIX threads should be supported by FreeBSD 7.1 ... but your system is missing the shared libc_r.

Googling for the answer came up with installing gethostnamadr.c which is fine except for two things:

  1. I don't know where to put this file and
  2. How does this solve my problem if Configure wants to see libc_r?
like image 835
gvkv Avatar asked May 02 '09 06:05

gvkv


2 Answers

To enable Perl 5.10 threads on FreeBSD 7.* all you have to do is apply the following patch using patch. You can then build perl with -Dusethreads or answer the Configure file questions to enable threading and you're good to go. I haven't done any significant testing or comparisons yet but everything compiles fine including the thread libs and all my Perl programs work fine.

--- hints/freebsd.sh 2008/10/20 04:59:30 1.1
+++ hints/freebsd.sh 2008/10/20 22:49:29
@@ -211,6 +211,14 @@
exit 1
;;

+ 7.*)
+ # 7.x doesn't install libc_r by default, and Configure
+ # would fail in the code following
+ #
+ # gethostbyaddr_r() appears to have been implemented in 6.x+
+ ldflags="-pthread $ldflags"
+ ;;
+
*)
if [ ! -r "$lc_r" ]; then
cat <<EOM >&4 

EDIT: I forgot my reference; check here for more info: http://www.gossamer-threads.com/lists/perl/porters/232518?nohighlight=1#232518.

like image 177
gvkv Avatar answered Sep 21 '22 19:09

gvkv


Contrary to Spolsky who said "perl is pretty much forgotten"... perl is very much alive.

You have not indicated which version of FreeBSD you have installed... But assuming that you have installed a min of FreeBSD 7.1 then you failed to install the threads libraries or the thread libs are not in the library path.

NOTE that libc is a general 'c' library and that libc_r is the thread-safe version of that file. Some of the 2005 google results suggest that libc_r has been deprecated.

With that in mind it is likely that you are in the middle of a "revision collision". Sadly FreeBSD does not provide the thread safe version of perl natively, however, they do package perl 5.10 and several later revisions. I found this link to be useful:

http://www.nabble.com/How---where-to-get-a-Perl-that-has-threads--td22270858.html

you might also want to try installing the p5-fork library which is included with FreeBSD

http://www.nabble.com/How---where-to-get-a-Perl-that-has-threads--td22270858.html

like image 40
Richard Avatar answered Sep 20 '22 19:09

Richard