views:

1251

answers:

2

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?
+2  A: 

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

Richard
I saw your response after I posted my own answer. Thanks for the links though. I've also updated my question to reflect the BSD version number.
gvkv
+4  A: 

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.

gvkv
Seems like a bug in Perl's freebsd hints file. Have you submitted this back upstream to p5p?
mpeters
I haven't submitted it because it's not my solution. I'm pretty sure that both Perl and BSD people know about it because there were some hints that it will be fixed for 7.2.
gvkv