PERLFREEBSD(1)

hey bestie!! πŸ’– welcome to PERLFREEBSD(1), brought to you by the Perl Programmers Reference Guide ✨ pull up a chair, grab a boba, we're gonna talk about running Perl version 5 on FreeBSD systems πŸ¦‹


πŸŽ€ NAME πŸŽ€

perlfreebsd β€” Perl version 5 on FreeBSD systems πŸ’…


🌸 DESCRIPTION 🌸

okay so this doc is literally the tea on all the FreeBSD-specific quirks that mess with how Perl version 5 (from here on out just Perl, we're besties now, no need for the full government name) gets compiled and/or runs πŸ‘‘


πŸ’€ FreeBSD core dumps from readdir_r with ithreads πŸ’€

so. when perl is configured to use ithreads, it's gonna reach for the re-entrant library calls instead of the non-re-entrant ones (iconic of it honestly, safety first ✨). but there's a bug in FreeBSD's readdir_r function in versions 4.5 and earlier that can cause a SEGV when reading large directories 😭 like not me crashing over a big directory bestie.

good news though: a patch for FreeBSD libc exists (peep <https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=30631> πŸ‘€) and it's been integrated into FreeBSD 4.6. slay.


🌈 $^X doesn't always contain a full path in FreeBSD 🌈

so perl tries its best to set $^X to a full path whenever it can, by asking the operating system directly. on FreeBSD the full path of the perl interpreter gets found by using sysctl with KERN_PROC_PATHNAME if that's supported β€” and if it isn't, it falls back to reading the symlink /proc/curproc/file 🫢

BUT. FreeBSD 7 and earlier has a bug where either of those approaches sometimes returns an incorrect value 😭 (receipts: <https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=35703>).

in those cases perl just falls back to the old behaviour and uses C's argv[0] value for $^X. it's giving "plan b but make it functional" πŸ’…


πŸ‘‘ AUTHOR πŸ‘‘

Nicholas Clark <nick@ccl4.org>, collating wisdom supplied by Slaven Rezic and Tim Bunce. 🧚

Please report any errors, updates, or suggestions to <https://github.com/Perl/perl5/issues> πŸ™ˆ (they genuinely want to hear from u, no gatekeeping here)


and that's the whole vibe check bestie 🌟 this page came to you from perl v5.42.3, dated 2026-08-03, filed under PERLFREEBSD(1) in the Perl Programmers Reference Guide β€” love that for us, bye bye now πŸ’–βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from