Re: "Undefined symbol" running ruby script

From: James B. Byrne <byrnejb_at_harte-lyne.ca>
Date: Wed, 20 Jul 2022 18:52:11 UTC
On Thu, July 14, 2022 10:03, Alberto Mijares wrote:
> Hello everyone,
>
> I need to run a ruby script on a legacy host:
>
> % freebsd-version -ku
> 12.1-RELEASE-p1
> 12.1-RELEASE-p1
>
> % ruby -v
> ruby 2.7.3p183 (2021-04-05 revision 6847ee089d) [amd64-freebsd12]
>
> However, when I run the script, I get the following error:
>
> ld-elf.so.1: /usr/local/lib/libruby27.so.27: Undefined symbol
> "pthread_setname_np@FBSD_1.6"
>
> Is there a workaround that doesn't include getting ports collection
> and compiling ruby or upgrading the system?
>
> Thanks for your help.
>
>
> Alberto Mijares
>

Is it the case that Ruby was previously installed on this legacy system and you
tried to upgrade?  If so then go back to the previously installed version and
determine if that works.

If not then 12.1-RELEASE reached EOL in November 2019.  The last version of
Ruby that I installed on 12.1-RELEASE was ruby-2.7.2_1,1.

pkg info --dependencies -F /var/cache/pkg/ruby-2.7.2_1,1.txz
ruby-2.7.2_1,1:
	libedit-3.1.20191231,1
	libffi-3.3_1
	libunwind-20200331_1
	libyaml-0.2.5

If Ruby was not previously installed on the legacy system then you should be
able to install it from that package file, providing the dependencies are met. 
You can check using 'pkg info'.

As an aside: since running into this situation myself I run 'pkg fetch -a'
after every 'freebsd-update install'.  This guarantees that I have a pkg file
in cache to install software onto that FreeBSD version should the need arise
and the system is EOL.